h2o_peach: DNN peach

Description Usage Value Examples

View source: R/DNN peach.R

Description

DNN peach

Usage

1
2
3
4
5
h2o_peach(x, y, train.data, test.data, ntrees_opts = c(1000),
  max_depth_opts = seq(1, 10), min_rows_opts = c(1, 5, 10, 20, 50, 100),
  learn_rate_opts = seq(0.001, 0.01, 0.001), sample_rate_opts = seq(0.4, 1,
  0.05), col_sample_rate_opts = seq(0.4, 1, 0.05),
  col_sample_rate_per_tree_opts = seq(0.4, 1, 0.05))

Value

list

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
 #ex1
set.seed(960806)
setwd('../')
a<-paste0(getwd(),'/Desktop')
setwd(a)
library(h2o)
h2o.init()
h2o.rm('mygrid')


pre.price<- t.data1$mean_price
t.data1<-t.data1[-1,]
t.data1$pre.price<- pre.price[-length(pre.price)]
sample1<- sample(1:nrow(t.data1),round(nrow(t.data1)*0.8,0))
train.data <- as.h2o(t.data1[sample1,])
test.data <- as.h2o(t.data1[-sample1,])
response1 <- "mean_price"
response2 <- "trade"
x=c("mean_T","min_T","max_T","prec","max_ws","mean_ws","rh","light","mon","weekday","trade",'prec1','pre.price')
y = response1
del<-h2o_peach(x,y,train.data,test.data)
yy<-as.data.frame(test.data$mean_price)
xx<-as.data.frame(del$dnn.pred)
plot(xx[,1],yy[,1],xlab=names(xx),ylab=names(yy))
abline(0,1,col=2)
abline(lm(yy[,1]~xx[,1]),col=4)

cor(xx[,1],yy[,1])^2


#ex2
library(peach)
library(h2o)
h2o.init()
h2o.rm('mygrid')
set.seed(960806)
sample1<- sample(1:nrow(t.data4),round(nrow(t.data4)*0.8,0))

train.data <- as.h2o(t.data4[sample1,])
test.data <- as.h2o(t.data4[-sample1,])
response1 <- "mean_price"
response2 <- "trade"
x=c("mean_T","min_T","max_T","prec","max_ws","mean_ws","rh","light","mon","weekday","trade",'prec1','pre.price')
y = response1
del<-h2o_peach(x,y,train.data,test.data)

summary(del$best_model)
y1<-as.data.frame(test.data$mean_price)
x1<-as.data.frame(del$dnn.pred)
plot(x1[,1],y1[,1],xlab=names(x1),ylab=names(y1))
abline(0,1,col=2)
abline(lm(y1[,1]~x1[,1]),col=4)

cor(x1[,1],y1[,1])^2

qkdrk777777/peach documentation built on May 24, 2019, 9:46 p.m.