Skip to content

Commit 58e8203

Browse files
Nidhi MehtaNidhi Mehta
authored andcommitted
2 parents 5fc4f87 + ac26a47 commit 58e8203

7 files changed

Lines changed: 44029 additions & 39 deletions

File tree

tutorials/data/allyears2k.csv

Lines changed: 43979 additions & 0 deletions
Large diffs are not rendered by default.

tutorials/deeplearning/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Deep Learning Tips & Tricks
1515

1616
## Introduction
17-
This tutorial shows how a H2O [Deep Learning](http://en.wikipedia.org/wiki/Deep_learning) model can be used to do supervised classification and regression. This tutorial covers usage of H2O from R. A python version of this tutorial will be available as well in a separate document. This file is available in plain R, R markdown and regular markdown formats, and the plots are available as PDF files. More examples and explanations can be found in our [H2O Deep Learning booklet](http://h2o.ai/resources/) and on our [H2O Github Repository](http://github.com/h2oai/h2o-3/).
17+
This tutorial shows how a H2O [Deep Learning](http://en.wikipedia.org/wiki/Deep_learning) model can be used to do supervised classification and regression. This tutorial covers usage of H2O from R. A python version of this tutorial will be available as well in a separate document. This file is available in plain R, R markdown and regular markdown formats, and the plots are available as PDF files. More examples and explanations can be found in our [H2O Deep Learning booklet](http://h2o.ai/resources/) and on our [H2O Github Repository](http://github.com/h2oai/h2o-3/). The PDF slide deck can be found [on Github](https://github.com/h2oai/h2o-world-2015-training/raw/master/tutorials/deeplearning/deeplearning.pdf).
1818

1919
First, set the path to the directory in which the tutorial is located on the server that runs H2O (here, locally):
2020

tutorials/deeplearning/deeplearning.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#* Deep Learning Tips & Tricks
1515
#
1616
### Introduction
17-
#This tutorial shows how a H2O [Deep Learning](http://en.wikipedia.org/wiki/Deep_learning) model can be used to do supervised classification and regression. This tutorial covers usage of H2O from R. A python version of this tutorial will be available as well in a separate document. This file is available in plain R, R markdown and regular markdown formats, and the plots are available as PDF files. More examples and explanations can be found in our [H2O Deep Learning booklet](http://h2o.ai/resources/) and on our [H2O Github Repository](http://github.com/h2oai/h2o-3/).
17+
#This tutorial shows how a H2O [Deep Learning](http://en.wikipedia.org/wiki/Deep_learning) model can be used to do supervised classification and regression. This tutorial covers usage of H2O from R. A python version of this tutorial will be available as well in a separate document. This file is available in plain R, R markdown and regular markdown formats, and the plots are available as PDF files. More examples and explanations can be found in our [H2O Deep Learning booklet](http://h2o.ai/resources/) and on our [H2O Github Repository](http://github.com/h2oai/h2o-3/). The PDF slide deck can be found [on Github](https://github.com/h2oai/h2o-world-2015-training/raw/master/tutorials/deeplearning/deeplearning.pdf).
1818
#
1919
#First, set the path to the directory in which the tutorial is located on the server that runs H2O (here, locally):
2020
#

tutorials/deeplearning/deeplearning.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Deep Learning Tips & Tricks
1515

1616
## Introduction
17-
This tutorial shows how a H2O [Deep Learning](http://en.wikipedia.org/wiki/Deep_learning) model can be used to do supervised classification and regression. This tutorial covers usage of H2O from R. A python version of this tutorial will be available as well in a separate document. This file is available in plain R, R markdown and regular markdown formats, and the plots are available as PDF files. More examples and explanations can be found in our [H2O Deep Learning booklet](http://h2o.ai/resources/) and on our [H2O Github Repository](http://github.com/h2oai/h2o-3/).
17+
This tutorial shows how a H2O [Deep Learning](http://en.wikipedia.org/wiki/Deep_learning) model can be used to do supervised classification and regression. This tutorial covers usage of H2O from R. A python version of this tutorial will be available as well in a separate document. This file is available in plain R, R markdown and regular markdown formats, and the plots are available as PDF files. More examples and explanations can be found in our [H2O Deep Learning booklet](http://h2o.ai/resources/) and on our [H2O Github Repository](http://github.com/h2oai/h2o-3/). The PDF slide deck can be found [on Github](https://github.com/h2oai/h2o-world-2015-training/raw/master/tutorials/deeplearning/deeplearning.pdf).
1818

1919
First, set the path to the directory in which the tutorial is located on the server that runs H2O (here, locally):
2020

tutorials/deeplearning/deeplearning.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Deep Learning Tips & Tricks
1515

1616
## Introduction
17-
This tutorial shows how a H2O [Deep Learning](http://en.wikipedia.org/wiki/Deep_learning) model can be used to do supervised classification and regression. This tutorial covers usage of H2O from R. A python version of this tutorial will be available as well in a separate document. This file is available in plain R, R markdown and regular markdown formats, and the plots are available as PDF files. More examples and explanations can be found in our [H2O Deep Learning booklet](http://h2o.ai/resources/) and on our [H2O Github Repository](http://github.com/h2oai/h2o-3/).
17+
This tutorial shows how a H2O [Deep Learning](http://en.wikipedia.org/wiki/Deep_learning) model can be used to do supervised classification and regression. This tutorial covers usage of H2O from R. A python version of this tutorial will be available as well in a separate document. This file is available in plain R, R markdown and regular markdown formats, and the plots are available as PDF files. More examples and explanations can be found in our [H2O Deep Learning booklet](http://h2o.ai/resources/) and on our [H2O Github Repository](http://github.com/h2oai/h2o-3/). The PDF slide deck can be found [on Github](https://github.com/h2oai/h2o-world-2015-training/raw/master/tutorials/deeplearning/deeplearning.pdf).
1818

1919
First, set the path to the directory in which the tutorial is located on the server that runs H2O (here, locally):
2020

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Predicting Airline Delays with H2O in R
2+
3+
### Load the H2O R package and start an local H2O cluster
4+
###### Connection to an H2O cloud is established through the `h2o.init` function from the `h2o` package.
5+
###### When starting H2O from R, specify `nthreads` equal to -1, in order to utilize all the cores on your machine.
6+
###### To connect to a pre-existing H2O cluster make sure to edit the H2O location with argument `myIP` and `myPort`.
7+
8+
library(h2o)
9+
h2o.init(nthreads = -1)
10+
11+
### Import Data into H2O
12+
###### We will use the `h2o.importFile` function to do a parallel read of the data into the H2O distributed key-value store.
13+
###### During import of the data, features Year, Month, DayOfWeek, and FlightNum were set to be parsed as enumerator or categorical rather than numeric columns.
14+
15+
airlines.hex <- h2o.uploadFile(path = normalizePath("../data/allyears2k.csv"), destination_frame = "allyears2k.hex")
16+
17+
###### Get an overview of the airlines dataset quickly by running `summary`.
18+
19+
summary(airlines.hex)
20+
21+
### Building a GLM Model
22+
###### Run a logistic regression model using function `h2o.glm` and selecting “binomial” for parameter `Family`.
23+
###### Add some regularization by setting alpha to 0.5 and lambda to 1e-05.
24+
25+
y <- "IsDepDelayed"
26+
x <- c("Dest", "Origin", "DayofMonth", "Year", "UniqueCarrier", "DayOfWeek", "Month", "Distance")
27+
glm_model <- h2o.glm(x = x, y = y, training_frame = airlines.hex, model_id = "glm_model",
28+
solver = "IRLSM", standardize = T, link = "logit",
29+
family = "binomial", alpha = 0.5, lambda = 1e-05)
30+
31+
auc <- h2o.auc(object = glm_model)
32+
print(paste0("AUC of the training set : ", round(auc, 4)))
33+
print(glm_model@model$standardized_coefficient_magnitudes)
34+
print(glm_model@model$scoring_history)
35+
36+
### Building a Deep Learning Model
37+
###### Build a binary classfication model using function `h2o.deeplearning` and selecting “bernoulli” for parameter `Distribution`.
38+
###### Run 100 passes over the data by setting parameter `epoch` to 100.
39+
40+
dl_model <- h2o.deeplearning(x = x, y = y, training_frame = airlines.hex, distribution = "bernoulli", model_id = "deeplearning_model2",
41+
epochs = 100, target_ratio_comm_to_comp = 0.02, seed = 6765686131094811000, variable_importances = T)
42+
auc2 <- h2o.auc(object = dl_model)
43+
print(paste0("AUC of the training set : ", round(auc2, 4)))
44+
print(h2o.varimp(dl_model))
45+
print(h2o.scoreHistory(dl_model))
46+

tutorials/model-selection/README.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)