Amore of neural network with R language implementation

Source: Internet
Author: User

Paste the Experiment Code first
The target uses the Amore method of the neural network to train the data and then test the data

Library (amore)
X1 <-Round (runif (2000,1,2000))
X2 <-Round (runif (2000,1,2000))
X11 <-Scale (x1[1:1900])
X12 <-Scale (x2[1:1900])
x21 <-Scale (x1[1901:2000])
x22 <-Scale (x2[1901:2000])
Y1 <-x11^2+x12^2
Y2 <-x21^2+x22^2
P <-Cbind (x11,x12)
Q <-cbind (x21,x22)
Target =y1

NET <-newff (n.neurons = C (2,2,1), Learning.rate.global = 1e-2,momentum.global = 0.4
, Error.criterium = ' LMS ', Stao = Na,hidden.layer = "Tansig",
Output.layer = ' Purelin ', method = "ADAPTGDWM")
Result <-train (Net,p,target,error.criterium = "LMS", report = True,show.step = 100
, n.shows = 5)

z<-Sim (RESULT$NET,Q)
Plot (q[1:100,1],z, col= "Blue", pch= "+")
Points (q[1:100,1],y2,col= "Red", pch= "X")

NEWFF parameter Description
NEWFF (N.neurons, Learning.rate.global, Momentum.global, Error.criterium, Stao, Hidden.layer, Output.layer, method)
Functions: Creating Multilayer feedforward Neural networks
N.neurons the first element: the number of input neurons, and finally the number of output neurons, the rest are the number of different hidden layer neurons.
Learning.rate.global Learning Rate
Momentum.global Momentum Factor
Error.criterium Error measurement algorithm "LMS": error sum of squares; "lmls": Logarithmic squared difference "TAO" doesn't understand.
Stao Standard for error judgment (typically NA)
Hidden.layer hidden Layer-activation function of hidden layer "Purelin", "Tansig", "sigmoid", "Hardlim", "Custom": Custom
Output.layer hidden Layer-the activation function of the output layer
Methods for method Training
Adaptive gradient descent of "ADAPTGD"
"ADAPTGDWM" momentum adaptive gradient descent
"BATCHGD" Batch gradient descent
"BATCHGDWM" Momentum batch gradient descent
NEWFF returns an object of a multilayer feedforward neural network

Train parameter Description
Train (NET, P, T, Error.criterium, Report, Show.step, N.shows)
Function: Neural network training function

NET: Neural network training
P: Enter training set
T: Output Training Set
Error.criterium's criteria for measuring goodness of fit are generally consistent with the above net (LMS, lmls, TAO)
Report Boolean whether information is provided during training
Show.step until the training function gives the maximum value of the result
N.shows report the number of workouts

SIM (NET, P) function: Calculates the output value of a given data set neural network

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.