Applying AutoML (Part-4) using H2O

Also, Check out our Article on:

Advantages

Python Implementation

→ Installing H2O AutoML

!pip install h2o

→ Importing Packages

import h2o 
from h2o.automl import H2OAutoML

→ Initializing the H2O Cluster

h2o.init()

→ Reading the data

crime = h2o.import_file("https://raw.githubusercontent.com/insaid2018/Term-2/master/CaseStudy/criminal_train.csv")

→ Checking data statistics

crime.describe()
crime['Criminal'] = crime['Criminal'].asfactor()

→ Splitting the data

train, valid, test = crime.split_frame(ratios=[0.7,0.2], seed=1234)print("Number of rows in train : ", train.shape[0])
print("Number of rows in test : ", test.shape[0])
print("Number of rows in Validation : ", valid.shape[0])

→ fitting the data

aml = H2OAutoML(max_models = 10, max_runtime_secs=300,exclude_algos=
['StackedEnsemble','DeepLearning'], seed = 1)

→ Training H2O AutoML

aml.train(x = independent_features, y = dependent_features,
training_frame = train, validation_frame=valid)

→ Checking the Leaderboard

lb = aml.leaderboardlb.head(10)

→ getting model explanation

explain_model = aml.leader.explain(train)

→ Predicting on test data

preds = aml.predict(test)

→ Checking model performance on test data

aml.leader.model_performance(test)

Also, Check out our Article on:

Visit us on https://www.insaid.co/

One of India’s leading institutions providing world-class Data Science & AI programs for working professionals with a mission to groom Data leaders of tomorrow!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Support Vector Machines (SVM)

Machine Learning for Clinical Trials

Predicting House Prices with Linear Regression

Zoom in... enhance: a Deep Learning based magnifying glass - part 2

Assessing Image Similarity Using Inception V3 and FID Score

Augment your data easily with Pytorch

Data Augmentation by fastai v1 – mc.ai

[Paper Reading] A survey on Image Data Augmentation for Deep Learning

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
INSAID

INSAID

One of India’s leading institutions providing world-class Data Science & AI programs for working professionals with a mission to groom Data leaders of tomorrow!

More from Medium

Introduction to RAPIDS | NVIDIA

Noun-phrase frequency analysis on Spark dataframes

Sentiment Analysis using Pyspark

Predict Churn with PySpark