Package: lightautoml
LightAutoML - automatic model creation frameworkLightAutoML (LAMA) is an AutoML framework which provides automatic model creation for the following tasks:binary classificationmulticlass  classificationregressionCurrent version of the package handles datasets that have independent samples in each row. I.e.each row is an object with its specific features and target.
Multitable datasets and sequences are a work in progress :)Note: we useAutoWoElibrary to automatically create interpretable models.Authors:Alexander Ryzhkov,Anton Vakhrushev,Dmitry Simakov, Rinchin Damdinov, Vasilii Bunakov, Alexander Kirilin, Pavel Shvets.Documentationof LightAutoML is availablehere, you can alsogenerateit.(New features) GPU and Spark pipelinesFull GPU and Spark pipelines for LightAutoML currently available for developers testing (still in progress). The code and tutorials for:GPU pipeline isavailable hereSpark pipeline isavailable hereTable of ContentsInstallation LightAutoML from PyPIQuick tourResourcesContributing to LightAutoMLLicenseFor developersSupport and feature requestsInstallationTo install LAMA framework on your machine from PyPI, execute following commands:# Install base functionality:pipinstall-Ulightautoml# For partial installation use corresponding option.# Extra dependecies: [nlp, cv, report]# Or you can use 'all' to install everythingpipinstall-Ulightautoml[nlp]Additionaly, run following commands to enable pdf report generation:# MacOSbrewinstallcairopangogdk-pixbuflibffi# Debian / Ubuntusudoapt-getinstallbuild-essentiallibcairo2libpango-1.0-0libpangocairo-1.0-0libgdk-pixbuf2.0-0libffi-devshared-mime-info# Fedorasudoyuminstallredhat-rpm-configlibffi-develcairopangogdk-pixbuf2# Windows# follow this tutorial https://weasyprint.readthedocs.io/en/stable/install.html#windowsBack to topQuick tourLet's solve the popular Kaggle Titanic competition below. There are two main ways to solve machine learning problems using LightAutoML:Use ready preset for tabular data:importpandasaspdfromsklearn.metricsimportf1_scorefromlightautoml.automl.presets.tabular_presetsimportTabularAutoMLfromlightautoml.tasksimportTaskdf_train=pd.read_csv('../input/titanic/train.csv')df_test=pd.read_csv('../input/titanic/test.csv')automl=TabularAutoML(task=Task(name='binary',metric=lambday_true,y_pred:f1_score(y_true,(y_pred>0.5)*1)))oof_pred=automl.fit_predict(df_train,roles={'target':'Survived','drop':['PassengerId']})test_pred=automl.predict(df_test)pd.DataFrame({'PassengerId':df_test.PassengerId,'Survived':(test_pred.data[:,0]>0.5)*1}).to_csv('submit.csv',index=False)LighAutoML framework has a lot of ready-to-use parts and extensive customization options, to learn more check out theresourcessection.Back to topResourcesKaggle kernel examples of LightAutoML usage:Tabular Playground Series April 2021 competition solutionTitanic competition solution (80% accuracy)Titanic12-code-linescompetition solution (78% accuracy)House prices competition solutionNatural Language Processing with Disaster Tweets solutionTabular Playground Series March 2021 competition solutionTabular Playground Series February 2021 competition solutionInterpretable WhiteBox solutionCustom ML pipeline elements inside existing onesCustom ML pipeline elements inside existing onesTabular Playground Series November 2022 competition solution with Neural NetworksGoogle Colab tutorials andother examples:Tutorial_1_basics.ipynb- get started with LightAutoML on tabular data.Tutorial_2_WhiteBox_AutoWoE.ipynb- creating interpretable models.Tutorial_3_sql_data_source.ipynb- shows how to use LightAutoML presets (both standalone and time utilized variants) for solving ML tasks on tabular data from SQL data base instead of CSV.Tutorial_4_NLP_Interpretation.ipynb- example of using TabularNLPAutoML preset, LimeTextExplainer.Tutorial_5_uplift.ipynb- shows how to use LightAutoML for a uplift-modeling task.Tutorial_6_custom_pipeline.ipynb- shows how to create your own pipeline from specified blocks: pipelines for feature generation and feature selection, ML algorithms, hyperparameter optimization etc.Tutorial_7_ICE_and_PDP_interpretation.ipynb- shows how to obtain local and global interpretation of model results using ICE and PDP approaches.Tutorial_8_CV_preset.ipynb- example of using TabularCVAutoML preset in CV multi-class classification task.Tutorial_9_neural_networks.ipynb- example of using Tabular preset with neural networks.Tutorial_10_relational_data_with_star_scheme.ipynb- example of using Tabular preset with neural networks.Tutorial_11_time_series.ipynb- example of using Tabular preset with timeseries data.Tutorial_12_Matching.ipynb- example of using addon for matchig.Note 1: for production you have no need to use profiler (which increase work time and memory consomption), so please do not turn it on - it is in off state by defaultNote 2: to take a look at this report after the run, please comment last line of demo with report deletion command.Courses, videos and papersLightAutoML crash courses:(Russian)AutoML course for OpenDataScience communityVideo guides:(Russian)LightAutoML webinar for Sberloga community(Alexander Ryzhkov,Dmitry Simakov)(Russian)LightAutoML hands-on tutorial in Kaggle Kernels(Alexander Ryzhkov)(English)Automated Machine Learning with LightAutoML: theory and practice(Alexander Ryzhkov)(English)LightAutoML framework general overview, benchmarks and advantages for business(Alexander Ryzhkov)(English)LightAutoML practical guide - ML pipeline presets overview(Dmitry Simakov)Papers:Anton Vakhrushev, Alexander Ryzhkov, Dmitry Simakov, Rinchin Damdinov, Maxim Savchenko, Alexander Tuzhilin"LightAutoML: AutoML Solution for a Large Financial Services Ecosystem". arXiv:2109.01528, 2021.Articles about LightAutoML:(English)LightAutoML vs Titanic: 80% accuracy in several lines of code (Medium)(English)Hands-On Python Guide to LightAutoML – An Automatic ML Model Creation Framework (Analytic Indian Mag)Back to topContributing to LightAutoMLIf you are interested in contributing to LightAutoML, please read theContributing Guideto get started.Back to topLicenseThis project is licensed under the Apache License, Version 2.0. SeeLICENSEfile for more details.Back to topFor developersBuild your own custom pipeline:importpandasaspdfromsklearn.metricsimportf1_scorefromlightautoml.automl.presets.tabular_presetsimportTabularAutoMLfromlightautoml.tasksimportTaskdf_train=pd.read_csv('../input/titanic/train.csv')df_test=pd.read_csv('../input/titanic/test.csv')# define that machine learning problem is binary classificationtask=Task("binary")reader=PandasToPandasReader(task,cv=N_FOLDS,random_state=RANDOM_STATE)# create a feature selectormodel0=BoostLGBM(default_params={'learning_rate':0.05,'num_leaves':64,'seed':42,'num_threads':N_THREADS})pipe0=LGBSimpleFeatures()mbie=ModelBasedImportanceEstimator()selector=ImportanceCutoffSelector(pipe0,model0,mbie,cutoff=0)# build first level pipeline for AutoMLpipe=LGBSimpleFeatures()# stop after 20 iterations or after 30 secondsparams_tuner1=OptunaTuner(n_trials=20,timeout=30)model1=BoostLGBM(default_params={'learning_rate':0.05,'num_leaves':128,'seed':1,'num_threads':N_THREADS})model2=BoostLGBM(default_params={'learning_rate':0.025,'num_leaves':64,'seed':2,'num_threads':N_THREADS})pipeline_lvl1=MLPipeline([(model1,params_tuner1),model2],pre_selection=selector,features_pipeline=pipe,post_selection=None)# build second level pipeline for AutoMLpipe1=LGBSimpleFeatures()model=BoostLGBM(default_params={'learning_rate':0.05,'num_leaves':64,'max_bin':1024,'seed':3,'num_threads':N_THREADS},freeze_defaults=True)pipeline_lvl2=MLPipeline([model],pre_selection=None,features_pipeline=pipe1,post_selection=None)# build AutoML pipelineautoml=AutoML(reader,[[pipeline_lvl1],[pipeline_lvl2],],skip_conn=False)# train AutoML and get predictionsoof_pred=automl.fit_predict(df_train,roles={'target':'Survived','drop':['PassengerId']})test_pred=automl.predict(df_test)pd.DataFrame({'PassengerId':df_test.PassengerId,'Survived':(test_pred.data[:,0]>0.5)*1}).to_csv('submit.csv',index=False)Back to topSupport and feature requestsSeek prompt advice atTelegram group.Open bug reports and feature requests on GitHubissues.