Novel neural network based optimization approach for photonic devices