Hello Pappu Murthy,
I understand that you are facing trouble explaining why the same neural network is converging faster when run in python and not in MATLAB.
There could be multiple reasons as to why this is happening. Since I don’t have the script, data and configurations used in MATLAB and python, I can only speculate as to why this could be happening.
One possible explanation for this behaviour could be the random network initialization before training. Another reason could be that the 5-layer network is not able to provide consistent outputs for this problem. The optimal size and training hyperparameters for a neural network depend on factors such as complexity of the problem and the amount of quality data available. An ablation study would help arrive at a concrete conclusion.
To identify the specific cause of discrepancy, the code and the configurations used in both MATLAB and python implementations need to be compared. Kindly verify if the issue persists after importing the network to MATLAB. Here is a MATLAB documentation on importing networks from external platforms: https://in.mathworks.com/help/deeplearning/networks-from-external-platforms.html?s_tid=CRUX_lftnav
Hope this helps!