当试图训练神经网络时,我得到以下错误
神经元中的错误[[i]]%*%权重[[i]]:不一致的参数
nn.model <- neuralnet(formula = Attrition ~ Age + Attrition + BusinessTravel + Department +
+ DistanceFromHome + Education + EducationField +
+ EnvironmentSatisfaction + Gender + JobInvolvement +
+ JobLevel + JobRole + JobSatisfaction + MaritalStatus +
+ MonthlyIncome + NumCompaniesWorked + OverTime +
+ PerformanceRating + RelationshipSatisfaction + StockOptionLevel +
+ TotalWorkingYears + WorkLifeBalance + YearsAtCompany + YearsInCurrentRole +
+ YearsWithCurrManager , data = TrainData, hidden = 40,
+ err.fct = "sse", linear.output = FALSE,
+ lifesign = "full",lifesign.step = 1,
+ threshold = 0.1)
示例数据:
Attrition Age BusinessTravel Department DistanceFromHome Education EducationField
1781 2 -0.6485577827 -0.5899479808 2.3887402665 -0.88736416029 0.08503478649 2.4710614174
2852 2 -0.9770074637 2.4160261328 0.4937331474 0.83986126473 0.08503478649 0.3754112538
513 2 -1.0864906907 -0.5899479808 0.4937331474 -0.76399091564 1.06160616261 0.3754112538
1398 2 1.8695564380 -0.5899479808 0.4937331474 -0.02375144778 -0.89153658963 -1.0216888553
2128 2 -0.8675242367 -0.5899479808 0.4937331474 -0.27049793707 -1.86810796575 0.3754112538
2572 2 -0.5390745557 -0.5899479808 0.4937331474 -0.51724442636 -0.89153658963 -1.0216888553
EnvironmentSatisfaction Gender JobInvolvement JobLevel JobRole JobSatisfaction
1781 -1.5754182775 0.8163577092 -1.0259922033 -0.05777771663 2.3442756382 -1.5676398930
2852 0.2545816181 0.8163577092 0.3796075533 -0.96132285967 -0.6684127991 0.2461583303
513 -1.5754182775 0.8163577092 -1.0259922033 -0.96132285967 -0.6684127991 1.1530574420
1398 -1.5754182775 -1.2245365637 0.3796075533 -0.05777771663 -0.6684127991 0.2461583303
2128 -1.5754182775 -1.2245365637 -1.0259922033 -0.96132285967 -0.2380287366 1.1530574420
2572 1.1695815659 -1.2245365637 -1.0259922033 -0.05777771663 -0.6684127991 -0.6607407814
MaritalStatus MonthlyIncome NumCompaniesWorked OverTime PerformanceRating
1781 0.1332594155 -0.0197425573 0.1228398011 0.6281342689 -0.4261575208
2852 -1.2366101006 -0.9260223171 -0.6779340687 0.6281342689 -0.4261575208
513 -1.2366101006 -0.9470541258 -1.0783210036 0.6281342689 -0.4261575208
1398 0.1332594155 -0.7660531049 0.1228398011 0.6281342689 -0.4261575208
2128 1.5031289317 -0.8435946221 1.3240006059 0.6281342689 -0.4261575208
2572 0.1332594155 -0.1327619741 0.1228398011 0.6281342689 -0.4261575208
RelationshipSatisfaction StockOptionLevel TotalWorkingYears WorkLifeBalance YearsAtCompany
1781 1.1912353428 -0.9318558699 -0.2930270824 0.3380386595 -0.817594864371
2852 0.2661872953 -0.9318558699 -0.8072017302 -1.0776788035 -0.327837549528
513 1.1912353428 -0.9318558699 -0.8072017302 0.3380386595 -0.491089987809
1398 0.2661872953 1.4157501777 -0.2930270824 -1.0776788035 -0.491089987809
2128 0.2661872953 2.5895532015 -0.4215707444 0.3380386595 -0.491089987809
2572 -1.5839087997 0.2419471539 0.0926039034 0.3380386595 -0.001332672966
YearsInCurrentRole YearsWithCurrManager
1781 -0.6153868953 -1.15573810597
2852 -0.3393360146 -0.03451387513
513 -0.6153868953 -0.87543204826
1398 -0.3393360146 -0.31481993284
2128 -0.3393360146 -0.31481993284
2572 -0.8914377760 0.24579218258
请有人建议我缺少什么。
感谢您的帮助。
最诚挚的问候。 Shaz
答案 0 :(得分:0)
我的坏。这里有一个语法错误,正确的语法应该是:
nn.model <- neuralnet(formula = Attrition ~ Age + Attrition + BusinessTravel + Department +
+ DistanceFromHome + Education + EducationField +
+ EnvironmentSatisfaction + Gender + JobInvolvement +
+ JobLevel + JobRole + JobSatisfaction + MaritalStatus +
+ MonthlyIncome + NumCompaniesWorked + OverTime +
+ PerformanceRating + RelationshipSatisfaction + StockOptionLevel +
+ TotalWorkingYears + WorkLifeBalance + YearsAtCompany + YearsInCurrentRole +
+ YearsWithCurrManager , data = TrainData, hidden = 40,
+ err.fct = "sse", linear.output = FALSE,
+ lifesign = "full",lifesign.step = 1,
+ threshold = 0.1)
干杯。 Shaz