Google Colab and AutoML: Auto-sklearn Setup

Logos of Google Drive + Colab + Scikit-learn + Auto-sklearn
!sudo apt-get install build-essential swig
!pip install auto-sklearn==0.11.1
Airbnb dataset description
Training dataset before transformations
Training dataset after transformations
import autosklearn.regression
automl = autosklearn.regression.AutoSklearnRegressor(
time_left_for_this_task=120,
per_run_time_limit=30,
n_jobs=1
)
automl.fit(
X_train_transformed,
y_train
)
import sklearn.metrics
predictions = automl.predict(X_test_transformed)
sklearn.metrics.r2_score(y_test, predictions)
# output: 0.1862
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import GridSearchCV
model = RandomForestRegressor(max_depth=3, random_state=0)
parameters = {
"max_depth": (2, 3, 5)
}
grid = GridSearchCV(model, parameters, cv=5, scoring="r2")
grid.fit(X_train_transformed, y_train.values.ravel())
predictions = grid.predict(X_test_transformed)
sklearn.metrics.r2_score(y_test, predictions)
# output: 0.0982

--

--

--

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

Recommended from Medium

How to Become a Machine Learning Engineer: 3 Pros Share Career Insights

Easy Distributed Scikit-Learn Training with Ray

AI/ML Practicalities: More Data isn’t Always Better

Training Deep Neural Networks

The first step towards learning ML

Sentiment Analysis with CNN using keras

Winter 2018 @ Aspiring Minds’ Research Lab

Introduction to FAST (Features from Accelerated Segment Test)

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
Adam Novotny

Adam Novotny

More from Medium

Phishing Detection using Machine Learning (ML)

Key takeaways from building multiple machine learning models

How to Build a Machine Learning Web App in Python Using Gradio

Installing and setting up Apache Mahout