开发者

matlab neural network gradient descent and mean square error

开发者 https://www.devze.com 2023-03-05 16:30 出处:网络
I want to know how grdient descent algorithm works on matlab network training and how MSE is calculated - I have my own app but it doesnt work as the matlab nn and I want to know why.

I want to know how grdient descent algorithm works on matlab network training and how MSE is calculated - I have my own app but it doesnt work as the matlab nn and I want to know why. My algorithm looks like this:

    foreach epoch
       gradient_vector = 0 // this is a vector
       rmse = 0

       foreach sample in data set
          output = CalculateForward(sample.input)
          error  = sample.target - output
         开发者_C百科 rmse += DotProduct(error,error)
          gradient_part = CalculateBackward(error)
          gradient_vector += (gradient_part / number_of_samples)
       end

       network.AddToWeights( gradient_vector * learning_rate)
       rmse = sqrt(rmse/number_of_samples)

    end

I it something similar what matlab does?


It appears close to what MATLAB does, but keep in mind that the toolbox is designed for a broad base of applications. Your algorithm gives each data entry once to the network once per epoch. Matlab's toolbox can present the data multiple times per epoch, update multiple times per epoch, and can update in a number of ways. I assure you that your exact method can be duplicated with the existing matlab toolbox, but with a very specific setting, which can be found by digging around in the help files for the neural network you're using. Some of them may be closer to what you're doing than others, so be discerning. Good luck!

0

精彩评论

暂无评论...
验证码 换一张
取 消