I usually use Google Colaboratory (Colaboratory) [^ Google Colaboratory], but install AutoGluon [^ AutoGluon] [Introduction of machine learning framework AutoGluon for AutoML] which is AutoML on Colaboratory. I once thought about importing and using it. However, there were times when I stumbled upon the solution. I wrote this article because I thought that some people would give up the experience of AutoML after having a similar experience. Write the procedure as carefully as possible so that even an unfamiliar person can reproduce it. (Information on January 20, 2021. If the situation changes, please let us know in the comments etc.)
Execute the following command referring to the information described in the README [^ AutoGluon (GitHub)] published on GitHub.
!pip install --upgrade pip
!pip install --upgrade setuptools
!pip install --upgrade "mxnet<2.0.0"
!pip install --pre autogluon
The disturbing execution result is displayed. Press "RESTART RUNTIME" at the bottom left to restart the runtime.
Press "Yes".
Then, the following import statement can be executed.
from autogluon.tabular import TabularDataset, TabularPredictor
Of course, you can also run the sample code in the README.
train_data = TabularDataset(file_path='https://autogluon.s3.amazonaws.com/datasets/Inc/train.csv')
test_data = TabularDataset(file_path='https://autogluon.s3.amazonaws.com/datasets/Inc/test.csv')
predictor = TabularPredictor(label='class').fit(train_data, time_limit=60) # Fit models for 60s
leaderboard = predictor.leaderboard(test_data)
You can see very interesting execution results!
(abridgement)
Fitting model: WeightedEnsemble_L1 ... Training model for up to 59.61s of the -10.88s of remaining time.
0.8848 = Validation accuracy score
1.07s = Training runtime
0.01s = Validation runtime
AutoGluon training complete, total runtime = 72.03s ...
TabularPredictor saved. To load, use: TabularPredictor.load("AutogluonModels/ag-20210118_155144/")
model score_test score_val pred_time_test pred_time_val fit_time pred_time_test_marginal pred_time_val_marginal fit_time_marginal stack_level can_infer fit_order
0 WeightedEnsemble_L1 0.873989 0.8848 1.739362 0.587412 29.211715 0.025570 0.005142 1.072552 1 True 10
1 LightGBM 0.873375 0.8800 0.101678 0.042709 1.115279 0.101678 0.042709 1.115279 0 True 7
2 CatBoost 0.872761 0.8804 0.032807 0.020380 14.926486 0.032807 0.020380 14.926486 0 True 9
3 LightGBMXT 0.870202 0.8756 0.245106 0.078389 1.704540 0.245106 0.078389 1.704540 0 True 8
4 RandomForestGini 0.859863 0.8600 0.821455 0.215100 9.762229 0.821455 0.215100 9.762229 0 True 1
5 RandomForestEntr 0.858225 0.8612 0.805670 0.315070 12.275200 0.805670 0.315070 12.275200 0 True 2
6 ExtraTreesGini 0.845839 0.8468 1.188539 0.315290 9.466483 1.188539 0.315290 9.466483 0 True 3
7 ExtraTreesEntr 0.845737 0.8432 1.195231 0.316842 8.752100 1.195231 0.316842 8.752100 0 True 4
8 KNeighborsUnif 0.773365 0.7752 0.108888 0.116532 0.319212 0.108888 0.116532 0.319212 0 True 5
9 KNeighborsDist 0.762514 0.7660 0.403860 0.109161 0.311418 0.403860 0.109161 0.311418 0 True 6
I introduced how to install & import AutoGluon in Colaboratory. Let's experience AutoML including AutoGluon more and more!
---> 32 from dask.utils import ensure_dict, format_bytes, funcname, stringify
ImportError: cannot import name 'stringify'
I personally often encountered this error statement. I wrote it because I want it to reach such a person. (Scratched by search!)
Recommended Posts