Neural network for control and diagnostic