Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201977

R-caret - retrieve coefficients

$
0
0

I am using R (package caret) to create a predictive model. I am rather satisfied now with my model (training and predict ok) and would like to get the coefficients of the different parameters (or the mathematical equation) the model has computed to run it on a daily basis.

Unfortunately, I am very new to R and can't find these back.

Could you please help me? Thanks

Here's the code I use ...

(-

library(caret) library(e1071) library(data.table) library(pracma)

mydata<-read.csv("C:/test1.txt", header=T , sep="\t") setDT(mydata)

mydata[,mmc:=movavg(mydata$a2,2)] mydata[,mml:=movavg(mydata$a2,5)]

mydata[, y:=shift(a2, 4, type="lead", fill=mydata$a2[length(mydata$a2)])]

training<-mydata[296:4198,] testing<-mydata[4199:length(mydata$a2),]

logit.fit<-train(y ~., data=training, type="brnn") pred<-predict(logit.fit, newdata=testing)

testing[,pred:=pred] write.csv(testing, "C:/result_machine_learning.csv")

-)

INPUT file format (C:/test1.txt)

(-

a1 b1 b2 a2 c

7277.68 7291.54 7221.00 7240.70 0

7266.55 7276.45 7197.38 7223.64 0

-)


Viewing all articles
Browse latest Browse all 201977

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>