Training a neural network with neuralnet
用神经网络神经网络的训练
The neural network is constructed with an interconnected group of nodes, which involves the
input, connected weights, processing element, and output. Neural networks can be applied to
many areas, such as classification, clustering, and prediction. To train a neural network in R,
you can use neuralnet, which is built to train multilayer perceptron in the context of regression
analysis, and contains many flexible functions to train forward neural networks. In this recipe,
we will introduce how to use neuralnet to train a neural network.
神经网络的构建与一组相互连接的节点,其中涉及的输入,连接的权重,处理单元,和输出。神经网络可以应用到许多领域,如分类、聚类、预测。在训练一个神经网络,可以使用神经网络,它是建立在回归分析的语境训练多层感知器,并包含了许多灵活的功能训练前馈神经网络。在这个食谱中,我们将介绍如何利用神经网络来训练神经网络。
Getting ready
In this recipe, we will use an iris dataset as our example dataset. We will first split the iris
dataset into a training and testing datasets, respectively.
在这个配方中,我们将使用IRIS数据集作为我们的示例数据集。我们将首先分割成一个训练和测试数据集的虹膜数据集,分别。
How to do it...
Perform the following steps to train a neural network with neuralnet:
执行以下步骤来训练一个神经网络与神经网络:
- First load the iris dataset and split the data into training and testing datasets:
首先加载虹膜数据集并将数据分割成训练和测试数据集:
> data(iris)
> ind = sample(2, nrow(iris), replace = TRUE, prob=c(0.7, 0.3))
> trainset = iris[ind == 1,]
> testset = iris[ind == 2,]
2. Then, install and load the neuralnet package:
然后,安装和负荷的神经网络软件包:
> install.packages("neuralnet")
> library(neuralnet)
3. Add the columns versicolor, setosa, and virginica based on the name matched value
in the Species column:
3.添加列云芝,粗糙,和锦葵基于名称匹配的值在物种列:
> trainset$setosa = trainset$Species == "setosa"
> trainset$virginica = trainset$Species == "virginica"
> trainset$versicolor = trainset$Species == "versicolor"
4. Next, train the neural network with the neuralnet function with three hidden
neurons in each layer. Notice that the results may vary with each training, so you
might not get the same result. However, you can use set.seed at the beginning, so
you can get the same result in every training process
4。其次,训练神经网络与神经网络的功能有三个隐层神经元。注意,每次培训的结果可能会有所不同,所以你可能不会得到相同的结果。然而,你可以使用set.seed开始,所以你可以在每一个训练过程得到相同的结果。
> network = neuralnet(versicolor + virginica + setosa~ Sepal.
Length + Sepal.Width + Petal.Length + Petal.Width, trainset,
hidden=3)
> network
Call: neuralnet(formula = versicolor + virginica + setosa ~ Sepal.
Length + Sepal.Width + Petal.Length + Petal.Width, data =
trainset, hidden = 3)
1 repetition was calculated.
Error Reached Threshold Steps
1 0.8156100175 0.009994274769 11063
5. Now, you can view the summary information by accessing the result.matrix
attribute of the built neural network model:
5。现在,你可以通过访问建立的神经网络模型的result.matrix属性查看摘要信息:
> network$result.matrix
error 0.815610017474
reached.threshold 0.009994274769
steps 11063.000000000000
Intercept.to.1layhid1 1.686593311644
Sepal.Length.to.1layhid1 0.947415215237
Sepal.Width.to.1layhid1 -7.220058260187
Petal.Length.to.1layhid1 1.790333443486
Petal.Width.to.1layhid1 9.943109233330
Intercept.to.1layhid2 1.411026063895
Sepal.Length.to.1layhid2 0.240309549505
Sepal.Width.to.1layhid2 0.480654059973
Petal.Length.to.1layhid2 2.221435192437
Petal.Width.to.1layhid2 0.154879347818
Intercept.to.1layhid3 24.399329878242
Sepal.Length.to.1layhid3 3.313958088512
Sepal.Width.to.1layhid3 5.845670010464
Petal.Length.to.1layhid3 -6.337082722485
Petal.Width.to.1layhid3 -17.990352566695
Intercept.to.versicolor -1.959842102421
1layhid.1.to.versicolor 1.010292389835
1layhid.2.to.versicolor 0.936519720978
1layhid.3.to.versicolor 1.023305801833
Intercept.to.virginica -0.908909982893
1layhid.1.to.virginica -0.009904635231
1layhid.2.to.virginica 1.931747950462
1layhid.3.to.virginica -1.021438938226
Intercept.to.setosa 1.500533827729
1layhid.1.to.setosa -1.001683936613
1layhid.2.to.setosa -0.498758815934
1layhid.3.to.setosa -0.001881935696
- Lastly, you can view the generalized weight by accessing it in the network:
6,最后,您可以通过在网络中访问它来查看广义权重:
> head(network$generalized.weights[[1]])
How it works...
The neural network is a network made up of artificial neurons (or nodes). There are three
types of neurons within the network: input neurons, hidden neurons, and output neurons.
In the network, neurons are connected; the connection strength between neurons is called
weights. If the weight is greater than zero, it is in an excitation status. Otherwise, it is in an
inhibition status. Input neurons receive the input information; the higher the input value, the
greater the activation. Then, the activation value is passed through the network in regard to
weights and transfer functions in the graph. The hidden neurons (or output neurons) then
sum up the activation values and modify the summed values with the transfer function. The
activation value then flows through hidden neurons and stops when it reaches the output
nodes. As a result, one can use the output value from the output neurons to classify the data.
神经网络是一种由人工神经元网络(或节点)。网络中有三种类型的神经元:输入神经元、隐藏神经元和输出神经元,在网络中,神经元连接,神经元之间的连接强度称为权值。如果重量大于零,则处于激发状态。否则,处于抑制状态。输入神经元接收输入信息,输入值越高,激活越大。然后,激活值是通过网络在图中的权重和传递函数方面。隐藏的神经元(或输出神经元),然后总结了激活值和修改的总和值与传递函数。活性值然后流经隐藏神经元和停止时输出节点。因此,可以使用输出神经元的输出值对数据进行分类。
The advantages of a neural network are: first, it can detect nonlinear relationships between
the dependent and independent variable. Second, one can efficiently train large datasets
using the parallel architecture. Third, it is a nonparametric model so that one can eliminate
errors in the estimation of parameters. The main disadvantages of a neural network are that
it often converges to the local minimum rather than the global minimum. Also, it might over-fit
when the training process goes on for too long.
神经网络的优点是:RST,它可以检测依赖和独立变量之间的非线性关系。其次,可以有效地培养大数据集,采用并行体系结构。第三,它是一个非参数模型,这样就可以消除参数估计中的错误。神经网络的主要缺点是,它往往收敛到局部极小,而不是全局最小。此外,它可能超过T时,训练过程持续太久。
In this recipe, we demonstrate how to train a neural network. First, we split the iris dataset
into training and testing datasets, and then install the neuralnet package and load the
library into an R session. Next, we add the columns versicolor , setosa , and virginica
based on the name matched value in the Species column, respectively. We then use the
neuralnet function to train the network model. Besides specifying the label (the column
where the name equals to versicolor, virginica, and setosa) and training attributes in the
function, we also configure the number of hidden neurons (vertices) as three in each layer.
在这个食谱中,我们演示了如何训练神经网络。首先,我们把IRIS数据为训练和测试数据集,然后安装神经网络包和加载的库到一个R会话。接下来,我们添加的列云芝,粗糙,和锦葵基于名称匹配的值在物种列,分别。然后用神经网络函数训练网络模型。除了指定的标签(如名称为云芝,锦葵,和粗糙的柱)和功能训练的属性,我们也配置隐层神经元的个数(顶点)三在每一层。
Then, we examine the basic information about the training process and the trained network
saved in the network. From the output message, it shows the training process needed
11,063 steps until all the absolute partial derivatives of the error function were lower than
0.01 (specified in the threshold). The error refers to the likelihood of calculating Akaike
Information Criterion (AIC). To see detailed information on this, you can access the result.
matrix of the built neural network to see the estimated weight. The output reveals that the
estimated weight ranges from -18 to 24.40; the intercepts of the first hidden layer are 1.69,
1.41 and 24.40, and the two weights leading to the first hidden neuron are estimated as 0.95
( Sepal.Length ), -7.22 ( Sepal.Width ), 1.79 ( Petal.Length ), and 9.94 ( Petal.Width ).
We can lastly determine that the trained neural network information includes generalized
weights, which express the effect of each covariate. In this recipe, the model generates
12 generalized weights, which are the combination of four covariates ( Sepal.Length ,
Sepal.Width , Petal.Length , Petal.Width ) to three responses ( setosa , virginica ,
versicolor ).
然后,我们研究的基本信息的训练过程和训练有素的网络中保存的网络。从输出信息,它示出训练过程所需的11063个步骤,直到所有的绝对偏导数的误差函数均低于0.01(在阈值中指定)。误差是指计算Akaike信息准则(AIC)的可能性。要查看详细信息,您可以访问结果。建立人工神经网络的矩阵估计权值。输出显示,估计重量范围从18到24.40;截获的第一个隐藏层的1.69、1.41和24.40,和两个重量导致第一个隐藏神经元估计为0.95(萼片长度),-7.22(萼片宽度)、1.79(花瓣长度),和9.94(花瓣宽度)。最后,我们可以确定受过训练的神经网络信息包括广义权重,表示各协变量的影响。在这个配方中,模型生成12广义的权重,这是四个变量的组合(sepal.length,萼片宽度、花瓣长度、花瓣宽度)三反应(粗糙、锦葵、云芝)
See also
For a more detailed introduction on neuralnet, one can refer to the following paper:
Günther, F., and Fritsch, S. (2010). neuralnet: Training of neural networks. The R
journal, 2(1), 30-38
一个更详细的介绍了神经网络,可以参考以下文件:古?舌鳎,F,和弗里奇,S(2010)。神经网络:神经网络训练。R学报,2(1),30-38。
Visualizing a neural network trained by neuralnet
想象一个由受过训练的神经网络神经网络
The package, neuralnet , provides the plot function to visualize a built neural network and
the gwplot function to visualize generalized weights. In following recipe, we will cover how to
use these two functions.
这个包,神经网络,提供了绘图功能,可视化的神经网络建模和可视化gwplot函数广义权重。在下面的食谱中,我们将介绍如何使用这两个函数。
Getting ready
You need to have completed the previous recipe by training a neural network and have all
basic information saved in the network.
你需要通过训练一个神经网络来完成以前的配方,并保存在网络中的所有基本信息。
How to do it...
Perform the following steps to visualize the neural network and the generalized weights:
- You can visualize the trained neural network with the plot function:
1。你可以可视化训练的神经网络的情节功能:
> plot(network)
2. Furthermore, you can use gwplot to visualize the generalized weights: > par(mfrow=c(2,2)) > gwplot(network,selected.covariate="Petal.Width") > gwplot(network,selected.covariate="Sepal.Width") > gwplot(network,selected.covariate="Petal.Length") > gwplot(network,selected.covariate="Petal.Width")
How it works...
In this recipe, we demonstrate how to visualize the trained neural network and the generalized
weights of each trained attribute. As per Figure 10, the plot displays the network topology of
the trained neural network. Also, the plot includes the estimated weight, intercepts and basic
information about the training process. At the bottom of the figure, one can find the overall
error and number of steps required to converge.
在这个食谱中,我们演示了如何可视化训练的神经网络和广义权重的每一个训练有素的属性。如图10所示,该图显示受过训练的神经网络的网络拓扑结构。此外,情节包括估计重量,拦截和基本信息的培训过程。在图的底部,可以发现整体误差和收敛所需步骤数。
Figure 11 presents the generalized weight plot in regard to network$generalized.weights .
The four plots in Figure 11 display the four covariates: Petal.Width , Sepal.Width , Petal.
Length , and Petal.Width , in regard to the versicolor response. If all the generalized weights
are close to zero on the plot, it means the covariate has little effect. However, if the overall
variance is greater than one, it means the covariate has a nonlinear effect.
图11给出了关于网络generalized.weights美元广义重情节。四图显示在图11的四个变量:花瓣,萼片宽度、宽度、花瓣。长度,和花瓣,宽度,关于花斑癣反应。如果所有的广义权重接近零的情节,这意味着协变量的影响不大。然而,如果整体方差大于1,这意味着协变量具有非线性效应。
See also
For more information about gwplot , one can use the help function to access the
following document:
关于gwplot的更多信息,可以使用帮助功能访问下列文件:
> ?gwplot
Predicting labels based on a model trainedby neuralnet
基于训练的神经网络预测模型标签
Similar to other classification methods, we can predict the labels of new observations based
on trained neural networks. Furthermore, we can validate the performance of these networks
through the use of a confusion matrix. In the following recipe, we will introduce how to use
the compute function in a neural network to obtain a probability matrix of the testing dataset
labels, and use a table and confusion matrix to measure the prediction performance.
类似于其他的分类方法,我们可以预测基于神经网络新的观测结果的标签。此外,我们可以验证这些网络的性能,通过使用混淆矩阵。在下面的配方中,我们将介绍如何使用神经网络中的计算功能,得到测试数据集标签的概率矩阵,并使用表和混淆矩阵来衡量预测性能。
Getting ready
You need to have completed the previous recipe by generating the training dataset, trainset ,
and the testing dataset, testset . The trained neural network needs to be saved in the network.
你需要通过生成训练数据集,完成了以前的配方的动车组,和测试数据,测试。训练后的神经网络需要保存在网络中。
How to do it...
Perform the following steps to measure the prediction performance of the trained neural
network:
执行以下步骤来测量训练神经网络的预测性能:
1. First, generate a prediction probability matrix based on a trained neural network and
the testing dataset, testset :
1。首先,生成一个基于神经网络的预测概率矩阵和测试数据,测试:
> net.predict = compute(network, testset[-5])$net.result
2. Then, obtain other possible labels by finding the column with the greatest probability:
2。然后,通过在柱以最大概率获得其他可能的标签:
> net.prediction = c("versicolor", "virginica", "setosa")
[apply(net.predict, 1, which.max)]
3. Generate a classification table based on the predicted labels and the labels of the
testing dataset:
3.生成一个基于预测的标签和标签的测试数据集的分类表:
> predict.table = table(testset$Species, net.prediction)
> predict.table
prediction
setosa versicolor virginica
setosa 20 0 0
versicolor 0 19 1
virginica 0 2 16
- Next, generate classAgreement from the classification table:
接下来,从分类表生成类协议:
> classAgreement(predict.table)
$diag
[1] 0.9444444444
$kappa
[1] 0.9154488518
$rand
[1] 0.9224318658
$crand
[1] 0.8248251737
5. Finally, use confusionMatrix to measure the prediction performance:
5。最后,利用混淆矩阵来衡量预测性能:
> confusionMatrix(predict.table)
Confusion Matrix and Statistics
prediction
setosa versicolor virginica
setosa 20 0 0
versicolor 0 19 1
virginica 0 2 16
Overall Statistics
Accuracy : 0.9482759
95% CI : (0.8561954, 0.9892035)
No Information Rate : 0.362069
P-Value [Acc > NIR] : < 0.00000000000000022204
Kappa : 0.922252
Mcnemar‘s Test P-Value : NA
Statistics by Class:
Class: setosa Class: versicolor Class:
virginica
Sensitivity 1.0000000 0.9047619
0.9411765
Specificity 1.0000000 0.9729730
0.9512195
Pos Pred Value 1.0000000 0.9500000
0.8888889
Neg Pred Value 1.0000000 0.9473684
0.9750000
Prevalence 0.3448276 0.3620690
0.2931034
Detection Rate 0.3448276 0.3275862
0.2758621
Detection Prevalence 0.3448276 0.3448276
0.3103448
Balanced Accuracy 1.0000000 0.9388674
0.9461980
How it works...
In this recipe, we demonstrate how to predict labels based on a model trained by neuralnet.
Initially, we use the compute function to create an output probability matrix based on the
trained neural network and the testing dataset. Then, to convert the probability matrix to class
labels, we use the which.max function to determine the class label by selecting the column
with the maximum probability within the row. Next, we use a table to generate a classification
matrix based on the labels of the testing dataset and the predicted labels. As we have
created the classification table, we can employ a confusion matrix to measure the prediction
performance of the built neural network.
在这个谱中,我们演示了如何预测基于训练的神经网络模型的标签。最初,我们使用的计算函数来创建一个输出概率矩阵的基础上受过训练的神经网络和测试数据集。然后,转换概率矩阵类的标签,我们使用which.max功能通过行内的最大概率选择的列确定的类标签。接下来,我们使用一个表来生成一个基于测试数据集的标签和标签的预测分类矩阵。我们已经创建了分类表,我们可以用混淆矩阵测量建立的神经网络的预测性能。
See also
In this recipe, we use the net.result function, which is the overall result of
the neural network, used to predict the labels of the testing dataset. Apart from
examining the overall result by accessing net.result , the compute function also
generates the output from neurons in each layer. You can examine the output of
neurons to get a better understanding of how compute works:
在这个谱中,我们使用net.result功能,这是整体的结果,神经网络,用于预测的测试数据集的标签。除了通过访问net.result检查结果,计算功能也从每层中的神经元产生的输出。你可以检查神经元的输出,以便更好地理解计算机是如何工作的:
> compute(network, testset[-5])
Training a neural network with nnet
The nnet package is another package that can deal with artificial neural networks. This
package provides the functionality to train feed-forward neural networks with traditional
back propagation. As you can find most of the neural network function implemented in
the neuralnet package, in this recipe we provide a short overview of how to train neural
networks with nnet .
该网络包是另一个包,可以处理的人工神经网络的。包提供了训练前馈神经网络与传统的功能反向传播,你可以找到最中实现的神经网络函数的神经网络软件包,这个配方中我们提供了一个简短的分析如何培养神经网络与神经网络
Getting ready
In this recipe, we do not use the trainset and trainset generated from the previous step;
please reload the iris dataset again.
在这个食谱中,我们不使用上一步产生,动车组,动车组;请重新加载虹膜数据集
How to do it...
Perform the following steps to train the neural network with nnet :
执行以下步骤来训练神经网络与神经网络
1. First, install and load the nnet package:
> install.packages("nnet")
> library(nnet)
2. Next, split the dataset into training and testing datasets:
> data(iris)
> set.seed(2)
> ind = sample(2, nrow(iris), replace = TRUE, prob=c(0.7, 0.3))
> trainset = iris[ind == 1,]
> testset = iris[ind == 2,]
3. Then, train the neural network with nnet :
> iris.nn = nnet(Species ~ ., data = trainset, size = 2, rang =
0.1, decay = 5e-4, maxit = 200)
# weights: 19
initial value 165.086674
iter 10 value 70.447976
iter 20 value 69.667465
iter 30 value 69.505739
iter 40 value 21.588943
iter 50 value 8.691760
iter 60 value 8.521214
iter 70 value 8.138961
ter 80 value 7.291365
iter 90 value 7.039209
iter 100 value 6.570987
iter 110 value 6.355346
iter 120 value 6.345511
iter 130 value 6.340208
iter 140 value 6.337271
iter 150 value 6.334285
iter 160 value 6.333792
iter 170 value 6.333578
iter 180 value 6.333498
final value 6.333471
converged
4. Use the summary to obtain information about the trained neural network:
> summary(iris.nn)
a 4-2-3 network with 19 weights
options were - softmax modelling decay=0.0005
b->h1 i1->h1 i2->h1 i3->h1 i4->h1
-0.38 -0.63 -1.96 3.13 1.53
b->h2 i1->h2 i2->h2 i3->h2 i4->h2
8.95 0.52 1.42 -1.98 -3.85
b->o1 h1->o1 h2->o1
3.08 -10.78 4.99
b->o2 h1->o2 h2->o2
-7.41 6.37 7.18
b->o3 h1->o3 h2->o3
4.33 4.42 -12.16
How it works...
In this recipe, we demonstrate steps to train a neural network model with the nnet package.
We first use nnet to train the neural network. With this function, we can set the classification
formula, source of data, number of hidden units in the size parameter, initial random
weight in the rang parameter, parameter for weight decay in the decay parameter, and the
maximum iteration in the maxit parameter. As we set maxit to 200, the training process
repeatedly runs till the value of the fitting criterion plus the decay term converge. Finally, we
use the summary function to obtain information about the built neural network, which reveals
that the model is built with 4-2-3 networks with 19 weights. Also, the model shows a list of
weight transitions from one node to another at the bottom of the printed message.
初始随机参数中的权重,衰减参数中的重量衰减参数,以及在麦克斯参数最大迭代。我们的麦克斯200、训练过程反复运行仍将拟合标准值加上衰减项收敛,最后,我们使用汇总函数在建立神经网络的形成入手,揭示了该模型是4-2-3网络与19权重的建立。同时,该模型显示从一个节点到另一个在印刷信息的底单重量转换
See also
For those who are interested in the background theory of nnet and how it is made, please
refer to the following articles:
对于那些在网络背景下的理论感兴趣,它是如何产生的,请参见以下文章:Ripley,博士(1996)模式识别与神经网络。剑桥维纳布尔斯,w.n.,和Ripley,博士(2002)。现代应用统计学与S第四版。施普林格
f Ripley, B. D. (1996) Pattern Recognition and Neural Networks. Cambridge
f Venables, W. N., and Ripley, B. D. (2002). Modern applied statistics with S. Fourth
edition. Springer
Predicting labels based on a model trained by nnet
基于预测的标签培养的神经网络模型
As we have trained aneural network with nnet in the previous recipe,we can now predict the labels of the testing dataset based on the trained neural network
.我们训练的神经网络在以前的配方的神经网络,我们现在可以预测基于训练的神经网络的测试数据集的标签.
Furthermore,we can assess the model with a confusion matrix adapted from the caret package.
此外,我们可以评估从插入包装采用混淆矩阵模型
Getting ready
You need to have completed the previous recipe by generating the training dataset,trainset,and the testing dataset, testset, from their is dataset.
.您需要通过生成训练数据集来完成前一个配方,动车组,和测试数据,测试,从他们的数据。
The trained neural network also needs to be saved as iris.nn.
神经网络也需要保存为iris.nn
How to do it...
Performthefollowingstepstopredictlabelsbasedonthetrainedneuralnetwork:
1.Generatethepredictionsofthetestingdatasetbasedonthemodel,iris.nn:
>iris.predict=predict(iris.nn,testset,type="class")
2.Generateaclassificationtablebasedonthepredictedlabelsandlabelsofthetesting
dataset:
>nn.table=table(testset$Species,iris.predict)
iris.predict
setosaversicolorvirginica
setosa1700
versicolor0140
virginica0114
3.Lastly,generateaconfusionmatrixbasedontheclassiicationtable:
>confusionMatrix(nn.table)
ConfusionMatrixandStatistics
iris.predict
setosaversicolorvirginica
setosa1700
versicolor0140
virginica0114
OverallStatistics
Accuracy:0.9782609
95%CI:(0.8847282,0.9994498)
NoInformationRate:0.3695652
P-Value[Acc>NIR]:<0.00000000000000022204
Kappa:0.9673063
Mcnemar‘sTestP-Value:NA
StatisticsbyClass:
Class:setosaClass:versicolor
Sensitivity1.00000000.9333333
Specificity1.00000001.0000000
PosPredValue1.00000001.0000000
NegPredValue1.00000000.9687500
Prevalence0.36956520.3260870
DetectionRate0.36956520.3043478
DetectionPrevalence0.36956520.3043478
BalancedAccuracy1.00000000.9666667
Class:virginica
Sensitivity1.0000000
Specificity0.9687500
PosPredValue0.9333333
NegPredValue1.0000000
Prevalence0.3043478
DetectionRate0.3043478
DetectionPrevalence0.3260870
BalancedAccuracy0.9843750
How it works...
Similar to other classiication methods,one can also predict labels based on the neural networks trained by nnet.First,we use the predict function to generate the predicted labels based on a testing dataset, testset.Within the predict function,we specify the type argument to the class,so the output will be class labels in stead of a probability matrix.Next,we use the table function to generate a classification table based on predicted labels and labels written in the testing dataset.Finally,as we have created the classification table,we can employ a confusion matrix from the caret package to measure the prediction performance of the trained neural network.
类似于其他的分类方法,也可以预测标签的基础上的神经由受过训练的神经网络网络。首先,我们使用的预测功能来生成预测标签基于测试数据、测试。在功能的预测,我们指定类的参数,所以输出将是类标签代替概率矩阵。接下来,我们使用表函数生成一个分类表的基础上预测标签和在测试数据集中写入的标签,最后,我们创建了分类表,我们可以从符号包测量预测采用混淆矩阵训练神经网络的性能
See also
For the predict function,if the type argument to class is not speciied,by default,it will generate a probability matrix as a prediction result,which isvery similar to net.result generated from the compute function within the neuralnet package:
对于预测函数,如果未指定类的类型参数,默认情况下,它会生成一个概率矩阵作为预测结:
>head(predict(iris.nn,testset))
结论:神经网络是由大量处理单元(神经元)相互连接而成的网络,ANN(Artificial Neural Network)是生物神经系统的一种抽象、简化和模拟。神经网络的信息处理是通过神经元的相互作用来实现的,知识与信息的存储表现在网络元件互连的分布式结构与联系,神经网络的学习与识别就是神经元连接权系数的动态演化过程。实践中常用的基本神经网络模型有:感知器(perceptron)神经网络、线性神经(AdalinePerceptron)网络、BP神经网络、径向基神经网络、自组织神经网络、Hopfield反馈神经网络等。
--------摘自百度
张月娥