R Model

<< Click to Display Table of Contents >>

Current:  Advanced Analytics > Experiment and Application of Advanced Analytic > Y-Advanced Analytics 

R Model

Previous pageReturn to chapter overviewNext page

Neural network analysis

You can use the R model node to reference any R package to connect to R data or R drawing for analysis. The example in this chapter is to analyze the bank telemarketing effect of by referring to the R package of the neural network.

1. Drag the data set node "Bank- train set" to the edit area. Add the "R Model" node and connect the node to the data set.

2. Input script in the R model

#import(__ALL__)                                                                                              // Reference all columns of the data set

library(nnet)                                                                                                     //Referenced package: nnet refers to neural network

MODEL<-nnet(y ~ ., data=col,size=10,rang=0.1,decay=5e-4,maxit=200)   // Modeling. Size: Number of hidden layers; Rang: Parameter range; Decay: Decay parameter; Maxit: number of iterations

3. Right-click the R model and choose "Run" from the context menu. Then wait until the running is successful.

4. Drag the data set node "Bank- train set” to the edit area.

5. Drag the "R Data" node to the edit area.

6. Connect the "R Data" node to the "Bank- train set” and "R Model" nodes.

ML107

7.Input script in the R data node.

#import(__ALL__)                                                                                 // Reference all columns of the data set

library(nnet)                                                                                       // Referenced package: nnet refers to neural network

pred <- predict(MODEL, col, type="class")                                         // Reference MODEL variable. col is a data frame containing all columns of the data set.

list(pred = pred)                                                                                // list(pred = pred) //Return the list result

8.Select the exploration data for R data and increase the prediction column RDataCal_pred.

ML108