OK, I think I know what is the answer to this question - first I have to
define a rsnns object factory, create a network (specify its architecture)
and only THEN I can use train (this is what I have understood from the RSNNS
manual)

However, for the sake of not being stuck with this one, I used MLPerceptron
for a time being to carry on with the task of forecasting.

Can someone give me a hint what is the reason for an error:
Error in predict.rsnns(nn_j, forexInTest[i]) : missing values in 'x'

that comes when I try to do a matrix of recursive forecasts with an mlp
model?

the code is below:
for (j in 1:length(inputsTest)){
    forexInTrain <- c(inputsTrain, inputsTest[1:j])
    forexOutTrain <- c(targetsTrain, targetsTest[1:j])
    nn_j<- mlp(forexInTrain, forexOutTrain, maxit=100)   <- this works on a
stand alone basis

     forexInTest <- inputsTest[j+1:length(inputsTest)]
     fc<-c()
     for (i in 1:length(forexInTest)){
      fc<-c(fc,predict.rsnns(nn_j, forexInTest[i]))   <-- the problem
appears here
     }
     array<-(dim=c(length(inputsTest),j))
     total<- as.matrix(fc)
     total<- cbind(total, fc)
    }
(lengths of inputsTest=49, of inputsTrain=targetsTrain=342)

cheers

Sara


2011/2/27 Sara Szeremeta <sara.szerem...@gmail.com>

> To provide more details:
>
> 1) the package I use is the RSNNS (as stated in the topic)
>
> 2) for input data to be split I fed in ts() object.. maybe this is a wrong
> move.
>     Does anybody knows what is the type of object that can be fed into the
> train() function from the RSNNS package?
>
>   The input data is a matrix with two columns: the first is a 1st lag of
> the second (I keep the number of inputs as simple as possible until I know
> how the model works), I removed NA values, the values are lagged exchange
> rates.
>
> The first rows look like this:
> Time Series:
> Start = 2
> End = 481
> Frequency = 1
>          IN.1       OUT
>   2 0.3855345 0.3782309
>   3 0.3782309 0.3824694
>   4 0.3824694 0.3870295
>
> The split performed with the splitForTrainingAndTest(inter[,1], inter[,2],
> ratio=0.10) seems good - the training and test data are appropriate.
>
> Then I defined:
> inputsTrain<-splitForTrainingAndTest(inter[,1], inter[,2],
> ratio=0.10)$inputsTrain
> and so on for targets and test data.
>
> The train() function uses those values: nn <- train(inputsTrain,
> targetsTrain,...)
>
>
>  I would greatly appreciate your help.
>
>
> 2011/2/25 Sara Szeremeta <sara.szerem...@gmail.com>
>
> Hello All!
>>
>>  I am training to train a NN with function train() after splitting data
>> with the function splitForTrainingAndTest(). The split is ok (checked
>> it), but when I get a try on training I get this message:
>>
>> Error in UseMethod("train") :
>>   no applicable method for 'train' applied to an object of class
>> "c('double', 'numeric')"
>>
>> The input data are logrithms of some financial values and their first
>> lags.
>>
>>
>> Does anybody can give me a hint how to make the train() function work
>> correctly?
>>
>>
>>
>> Thank you and have a good day!
>>
>> Sara
>>
>>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to