Deep Learning with H2O in Python
Step 1- First of all , we need to install H2o package in Python.
on anaconda prompt
pip install h2o
Step 2- Initialize and start the cluster -
Step 3- load train and test data set-
Step 4- Creating test and train data set using split-
Step 5- Configuring the model-
model = H2ODeepLearningEstimator(distribution = "AUTO",activation = "RectifierWithDropout",hidden = [32,32],input_dropout_ratio = 0.2,l1 = 1e-5,epochs = 10)
Step 6- train(fit the model)-
model.train(x="sepal_len", y=["petal_len"], training_frame=splits[0])
Step 7- predicting using trained model and creating a new column in test data-
(splits[1]['predicted_sepal_len'])=model.predict(splits[1])
reference- complete book is present at-
http://docs.h2o.ai/h2o/latest-stable/h2o-docs/booklets/DeepLearningBooklet.pdf
on anaconda prompt
pip install h2o
Step 2- Initialize and start the cluster -
h2o.init()
from h2o.estimators.deeplearning import H2ODeepLearningEstimator
Step 3- load train and test data set-
train = h2o.import_file("https://h2o-public-test-data.s3.amazonaws.com/smalldata/iris/iris_wheader.csv")
Step 4- Creating test and train data set using split-
splits = train.split_frame(ratios=[0.75], seed=1234)
Step 5- Configuring the model-
model = H2ODeepLearningEstimator(distribution = "AUTO",activation = "RectifierWithDropout",hidden = [32,32],input_dropout_ratio = 0.2,l1 = 1e-5,epochs = 10)
Step 6- train(fit the model)-
model.train(x="sepal_len", y=["petal_len"], training_frame=splits[0])
Step 7- predicting using trained model and creating a new column in test data-
(splits[1]['predicted_sepal_len'])=model.predict(splits[1])
http://docs.h2o.ai/h2o/latest-stable/h2o-docs/booklets/DeepLearningBooklet.pdf
Comments
Post a Comment