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

Machine learning to a Grandfather

Running Tensorflow Lite Image Classification Models in Python

Convolutions and Backpropagations

Training an Image Classifier from scratch in 15 minutes

7 costly surprises of machine learning: part 4

Titanic: Machine Learning From Disaster

MS-BERT: Using Neurological Examination Notes for Multiple Sclerosis Severity Classification

Google AI Machine Learning Model Transparency Reporting

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

Machine learning and deep learning approach to predict Pharmaceuticals Sales using python

Addition and Subtraction using Recurrent Neural Networks.

Churn Analysis of a Telephone Company to Increase Profits by Nearly $1 Million

SVD — Singular Value Decomposition using python