|
'neural' function
#462174
09/12/16 21:55
09/12/16 21:55
|
Joined: Jul 2016
Posts: 64
gtell
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2016
Posts: 64
|
Dear JCL, dear all, I am using adviceLong and I need to use:
prepr<-preProcess(X, method = "spatialSign")
in neural.train and: in neural.predict. Both in neural.train and neural.predict use the same "prepr" object. How can I save/load it? Could you give me an idea? What I want to achieve is to pre-process data in the same way both in training and test. Thanks. Cheers.
|
|
|
Re: 'neural' function
[Re: jcl]
#462184
09/13/16 10:18
09/13/16 10:18
|
Joined: Jul 2016
Posts: 64
gtell
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2016
Posts: 64
|
Thanks, good idea. Unfortunatelly I get an error in the testing phase after training. The following is my neural script:
library('deepnet', quietly = T)
library('caret', quietly = T)
neural.train = function(model,XY)
{
XY <- as.matrix(XY)
X <- XY[,-ncol(XY)]
Y <- XY[,ncol(XY)]
Y <- ifelse(Y > 0,1,0)
prepr<-preProcess(X, method = "spatialSign")
x.tr<-predict(prepr, X)
Preprs[[model]] <<- prepr
Models[[model]] <<- sae.dnn.train(x.tr,Y,
hidden = c(50,50,50),
activationfun = "tanh",
learningrate = 0.7,
momentum = 0.5,
learningrate_scale = 1.0,
output = "sigm",
sae_output = "linear",
#numepochs = 300,
batchsize = 100,
hidden_dropout = 0,
visible_dropout = 0)
}
neural.predict = function(model,X)
{
if(is.vector(X)) X <- t(X)
x.ts<-predict(Preprs[[model]], X)
return(nn.predict(Models[[model]], x.ts))
}
neural.init = function()
{
set.seed(365)
Models <<- vector("list")
Preprs <<- vector("list")
}
neural.save = function(name)
{
save(Models,Preprs,file=name)
}
neural.load = function(name)
{
load(Models,Preprs,file=name)
}
even if I remove "neural.load" (not sure if I need it) I always get the following error:
Load DeepLearnSAE2.4_EURUSD_2.ml
R error -
Error in newdata[, object$method$center, drop = FALSE] :
attribute 'dimnames' missing for array
Calls: neural.predict -> predict -> predict.preProcess -> sweep
Execution stopped
Profit 8$ MI 2$ DD 23$ Capital 100$
Trades 596 Win 52.2% Avg +0.1p Bars 2
AR 27% PF 1.06 SR 0.64 UI 38% R2 0.00
Quit
Time 00:01:16
If I run a TestOOS() from R, it works. I am not sure where it is the error. What do you think?
|
|
|
Re: 'neural' function
[Re: gtell]
#462224
09/14/16 16:07
09/14/16 16:07
|
Joined: Jul 2016
Posts: 64
gtell
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2016
Posts: 64
|
So, my question is very simple. If running the TestOOS function you get the following accurancy: (found in your article: http://www.financial-hacker.com/build-better-strategies-part-5-developing-a-machine-learning-system/ )
Confusion Matrix and Statistics
Reference
Prediction 0 1
0 1231 808
1 512 934
Accuracy : 0.6212
95% CI : (0.6049, 0.6374)
No Information Rate : 0.5001
P-Value [Acc > NIR] : < 2.2e-16
which is 62%, shall I expect the almost same rate of winning trades in Zorro? Because I am getting about 10-15% less. I do not understand what is the reason. Thanks. Cheers.
Last edited by gtell; 09/14/16 16:28.
|
|
|
|