简体   繁体   English

R 中的 MLP 神经网络

[英]MLP neural network in R

I'm trying to write a code in R to predict the currency rate of USD/EUR using MLP neural Network I facing a problem with the input of the function neuralnet it keeps giving me an error of我正在尝试在 R 中编写代码,以使用 MLP 神经网络预测美元/欧元的汇率我在 function 神经网络的输入方面遇到问题,它一直给我一个错误

Error in terms.formula(formula, data = data) : 
  invalid model formula in ExtractVars  

This is the code that i have written so far这是我到目前为止写的代码

library(readxl)
ExchangeUSD <- read_excel("C:/Users/GTS/Desktop/ML project/ExchangeUSD.xlsx")
plot(ExchangeUSD$`USD/EUR`)

#traning and test data 
trainset <- ExchangeUSD[1:350,]
testset <- ExchangeUSD[351:500,] 

set.seed(12345)
library(neuralnet)
nn <- neuralnet(`USD/EUR`~ "YYYY/MM/DD"+"Wdy",data = trainset)

the data-set contains 500 rows and 3 columns the first column is YYYY/MM/DD and it contains the date from October 2011 until October 2013 (500 data).数据集包含 500 行和 3 列,第一列是 YYYY/MM/DD,它包含从 2011 年 10 月到 2013 年 10 月的日期(500 个数据)。 the second column is Wdy and it contain the weakly days the final column is the USD/EUR and contains the currency rate a part of the data set第二列是 Wdy,它包含疲软的日子最后一列是 USD/EUR,包含数据集的一部分的货币汇率

Use nn <- neuralnet(USD/EUR ~ YYYY/MM/DD + Wdy, data = trainset) (ie remove the quotes from the variable names).使用nn <- neuralnet(USD/EUR ~ YYYY/MM/DD + Wdy, data = trainset) (即从变量名中删除引号)。

It would be even better if you rename the USD/EUR as USD and YYYY/MM/DD as date .如果将USD/EUR重命名为USD并将YYYY/MM/DD重命名为date会更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM