Skip to content
Snippets Groups Projects
Commit a024942d authored by Colbry, Dirk's avatar Colbry, Dirk
Browse files

merging changes

parent 8d9bb4d7
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:01d9c180 tags:
# GAMA AutoML Tutorial
%% Cell type:markdown id:bf57cd23 tags:
**Team Boeing - Abirami Varatharajan, Brandon Hang, Deepak Ghimirey, Emily Lang, Jack Haas**
%% Cell type:markdown id:14c7d7c0 tags:
<img src="https://github.com/openml-labs/gama/raw/master/images/logos/Logo-With-Grey-Name-Transparent.png" alt="W3Schools.com" width="800">
Image source: https://github.com/openml-labs/gama/raw/master/images/logos/Logo-With-Grey-Name-Transparent.png
%% Cell type:markdown id:481fae1c tags:
## View Documentation At:
* https://openml-labs.github.io/gama/master/
* https://github.com/openml-labs/gama
* https://openml-labs.github.io/gama/master/index.html
* https://openml-labs.github.io/gama/master/user_guide/index.html#dashboard
* https://openml-labs.github.io/gama/master/api/index.html
%% Cell type:markdown id:25258b82 tags:
## Software Setup and Install
%% Cell type:markdown id:debdea63 tags:
Run the following command from inside an activated Conda Env to install the GAMA library with Pip:
%% Cell type:code id:bded45a9 tags:
``` python
# pip install gama
# *or*
# pip3 install gama
```
%% Cell type:markdown id:32af5ac3 tags:
TODO: I think GAMA requires python=3.9? I cant get it to work. -- Dirk
%% Cell type:markdown id:192cbbad tags:
Alternatively, the source code can be downloaded from the following Github repository:
https://github.com/openml-labs/gama
%% Cell type:markdown id:ce52d2cf tags:
## Accessing the Software
%% Cell type:markdown id:ebfccd27 tags:
To access the GAMA library after it is installed, run the following Python import command:
%% Cell type:code id:00a14ad0 tags:
``` python
import gama
```
%% Cell type:markdown id:ad7f01c2 tags:
## Overview
%% Cell type:markdown id:bedce649 tags:
GAMA is an AutoML package that generates optimized machine learning pipelines, given specific input data and resource constraints. To simplify intensive labor work of selecting the correct algorithm, all the user needs to do is supply the data, and GAMA will automatically try to find a good machine learning pipeline by considering data preprocessing steps, machine learning algorithm, and hyperparameter configurations. GAMA can also combine multiple tuned machine learning pipelines together into an ensemble, which can help model performance. GAMA is currently restricted to classification and regression problems on tabular data. <br><br>
For more information about GAMA, see the link below:
https://openml-labs.github.io/gama/master/index.html
%% Cell type:markdown id:c65233ea tags:
## Visualization
%% Cell type:markdown id:8a157003 tags:
In addition to its general use AutoML functionality, GAMA aims to serve AutoML researchers as well. During the optimization process, GAMA keeps an extensive log of progress made. Using this log, insight can be obtained on the behaviour of the search procedure. For example, it can produce a graph that shows pipeline fitness over time: graph of fitness over time
%% Cell type:markdown id:5b3d0114 tags:
## Code Examples
%% Cell type:markdown id:6c9141bd tags:
For detailed API documentation see the following link:
https://openml-labs.github.io/gama/master/api/index.html
%% Cell type:markdown id:3427585f tags:
### Classification
Example sourced from: https://openml-labs.github.io/gama/master/user_guide/index.html#dashboard
%% Cell type:code id:a43e62f3 tags:
``` python
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.metrics import log_loss, accuracy_score
from gama import GamaClassifier
X, y = load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(
X, y, stratify=y, random_state=0
)
automl = GamaClassifier(max_total_time=180, store="nothing", n_jobs=-1)
print("Starting `fit` which will take roughly 3 minutes...")
automl.fit(X_train, y_train)
label_predictions = automl.predict(X_test)
probability_predictions = automl.predict_proba(X_test)
print("accuracy:", accuracy_score(y_test, label_predictions))
print("log loss:", log_loss(y_test, probability_predictions))
```
%% Output
%% Cell type:markdown id:1bfbb41b tags:
Starting `fit` which will take roughly 3 minutes...
accuracy: 0.951048951048951
log loss: 0.13989498044372267
Some issues with the classifier receiving "ValueError: population must be at least of size 3 for a pair to be selected"
%% Cell type:markdown id:de9afff2 tags:
### Regression
Example sourced from: https://openml-labs.github.io/gama/master/user_guide/index.html#dashboard
%% Cell type:code id:35f68b4c tags:
``` python
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
from gama import GamaRegressor
X, y = load_boston(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)
automl = GamaRegressor(max_total_time=180, store="nothing", n_jobs=-1)
print("Starting `fit` which will take roughly 3 minutes...")
automl.fit(X_train, y_train)
predictions = automl.predict(X_test)
print("MSE:", mean_squared_error(y_test, predictions))
```
%% Output
Starting `fit` which will take roughly 3 minutes...
MSE: 17.566521076771657
%% Cell type:markdown id:a8051ac9 tags:
## Applications
%% Cell type:markdown id:cc6caab0 tags:
This tool could be helpful when we are in the preprocessing stage and when we are comparing various models, this would be a great tool to understand which kinds of models would be best for the given data set and a create a foundation for your model. GAMA can also combine multiple tuned machine learning pipelines together into an ensemble, which should help model performance. Due to the current version of GAMA this tool currently restricted to classification and regression datasets.
%% Cell type:markdown id:e0a28b97 tags:
---
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment