R packets related to "R" Neural network

Source: Internet
Author: User

Undergraduate graduation design involves using machine learning methods to train predictive models, linear regression, SVM, RF and other methods are not ideal, so we need to use a simple neural network method to do comparative experiments. Without in-depth understanding of the optimization of the NN, the interface provided by the R package is called directly, where it is briefly recorded for later reflection and improvement.

The main use of nnet, neuralnet, H2O These several packages, concrete modeling, prediction, optimization method in the manual can be found. Nnet and Neuralnet provide a simple neural network with a single hidden layer, H2O provides a DNN method.

1 Library (nnet)2Data<-read.csv ("Tomcat_done_1.csv", header=T)3   4Total_size <-3635Test_size <-906   7Train=sample (1:dim (data) [1],total_size-test_size)8   9train_set<-Data[train,]Ten    OneTest<-data[-train,1:35] A    -test_effort<-data[-train,36] -    theCount <-0 -    -    -M<-nnet (effort~.,train_set,size=9,decay=0.015,maxit=10,linout=t,trace=f,maxnwts=8000) +    -Preds <-predict (m,test)

1 Library (neuralnet)2Data<-read.csv ("Tomcat_done_2.csv", header=T)3   4Total_size <-3635Test_size <-906   7Train=sample (1:dim (data) [1],total_size-test_size)8   9train_set<-Data[train,]Ten    OneTest<-data[-train,1:35] A    -test_effort<-data[-train,36] -    theCount <-0 -    -    -M<-neuralnet (effort~countdeclclass+countdeclclassmethod+countdeclclassvariable ++countdeclfunction+countdeclinstancemethod+countdeclinstancevariable -+countdeclmethod+countdeclmethoddefault+countdeclmethodprivate ++countdeclmethodprotected+countdeclmethodpublic+Countline A+countlineblank+countlinecode+countlinecodedecl+Countlinecodeexe at+countlinecomment+countsemicolon+countstmt+countstmtdecl+Countstmtexe -+sumcyclomatic+sumcyclomaticmodified+sumcyclomaticstrict+sumessential -+maxcyclomatic+maxcyclomaticmodified+maxcyclomaticstrict+maxessential -+maxnesting+avgcyclomatic+avgcyclomaticmodified+avgcyclomaticstrict -+avgessential+ratiocommenttocode,data = Train_set,hidden = 2) -    in    -    toPreds <-Compute (m,test)

Data needs to be preprocessed and re-entered according to the format requirements of the model, for example, some packages require that the label information be mapped to [0,1]. Read more manuals and original papers to understand the optimization method, remember!

R packets related to "R" 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.