Skip to content

Instantly share code, notes, and snippets.

hyper_params <- list(
activation=c("Rectifier","Tanh","Maxout","RectifierWithDropout","TanhWithDropout","MaxoutWithDropout"),
hidden=list(c(200,200),c(500,500),c(500,500,500)),
input_dropout_ratio=c(0,0.05,0.1,0.2),
l1=seq(0,1e-4,1e-6),
l2=seq(0,1e-4,1e-6)
)
model.class<-multinom(IR~ .,data = Ist.class.2)
Call:
multinom(formula = IR ~ ., data = Ist.class.2)
Coefficients:
(Intercept) unem.rate BankLoan RealExport Personal.Consumption.Expenditures RGDP Total.Vehicle.Sales U.S.Dollar.Index
0 -2.452802 0.5361296 -0.1061213 0.04649329 -0.2893107 0.1903935 0.3060163 -0.05124506
1 -6.171310 0.2994286 1.0046571 0.24750510 0.2660045 0.1271559 0.3456129 -0.02169250
Std. Errors:
randomForest(formula = IR ~ ., data = Ist.month.class.mc, importance = TRUE, subset = train.mc)
Type of random forest: classification
Number of trees: 500
No. of variables tried at each split: 2
OOB estimate of error rate: 26.25%
Confusion matrix:
-1 0 1 class.error
-1 21 54 1 0.7236842
0 17 362 25 0.1039604
###try to predict the outliers
abm<-Ist[c(373,622,667,706,709),-c(1,4)]
abm.pre<-predict(model.season_final.re,abm)
data.frame(Date=Ist$Date[c(373,622,667,706,709)],Prediction=abm.pre, Real=Ist$Interest.Rate[c(373,622,667,706,709)])
Date Prediction Real
373 1981-01-01 7.250878 13.00
622 2001-10-01 -2.935886 2.02
667 2005-07-01 -1.307811 4.25
706 2008-10-01 11.563449 1.25
x<-Ist[c(373,622,667,706),]
ir.pre<-predict(model.season_final,x,type = "response")
data.frame(Date=Ist$Date[c(373,622,667,706)],Prediction=ir.pre,Real=Ist$Interest.Rate[c(373,622,667,706)])
Date Prediction Real
373 1981-01-01 7.133682 13.00
622 2001-10-01 -1.161944 2.02
667 2005-07-01 -0.635116 4.25
706 2008-10-01 8.995944 1.25
@threefeather
threefeather / project3_linear.r
Last active December 8, 2016 22:03
Prediction of US Interest rate_2
####Remove the large outlier and leverage points:373,445,622,667,706,709
Residuals:
Min 1Q Median 3Q Max
-4.2856 -0.8929 0.0166 0.8256 4.5421
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 17.078169 2.274732 7.508 5.09e-12 ***
unem.rate -1.165918 0.127226 -9.164 3.70e-16 ***
BankLoan 1.354565 0.150751 8.985 1.06e-15 ***
@threefeather
threefeather / zq.r
Last active December 8, 2016 18:52
Call:
lm(formula = Interest.Rate ~ . - Date, data = Ist.complete_final)
Residuals:
Min 1Q Median 3Q Max
-7.7459 -0.9721 -0.1388 0.9188 5.8663
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 13.09168 2.50591 5.224 5.56e-07 ***