{"id":16023933,"url":"https://github.com/owenodriscoll/automl","last_synced_at":"2025-03-16T07:32:23.317Z","repository":{"id":149017346,"uuid":"590020958","full_name":"owenodriscoll/AutoML","owner":"owenodriscoll","description":"Python package for automated hyperparameter-optimization of common machine-learning algorithms","archived":false,"fork":false,"pushed_at":"2025-01-27T09:12:55.000Z","size":3417,"stargazers_count":2,"open_issues_count":16,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-11T22:29:31.755Z","etag":null,"topics":["automl","catboost","classification","hyperparameter-optimization","lightgbm","machine-learning","optuna","regression","scikit-learn","xgboost"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/owenodriscoll.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-01-17T13:39:39.000Z","updated_at":"2025-01-27T09:12:56.000Z","dependencies_parsed_at":"2023-09-07T12:15:09.369Z","dependency_job_id":"cf5e16c2-77a3-49b9-ac2d-4f00f3e1dcd1","html_url":"https://github.com/owenodriscoll/AutoML","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owenodriscoll%2FAutoML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owenodriscoll%2FAutoML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owenodriscoll%2FAutoML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owenodriscoll%2FAutoML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/owenodriscoll","download_url":"https://codeload.github.com/owenodriscoll/AutoML/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243841150,"owners_count":20356441,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automl","catboost","classification","hyperparameter-optimization","lightgbm","machine-learning","optuna","regression","scikit-learn","xgboost"],"created_at":"2024-10-08T19:04:32.679Z","updated_at":"2025-03-16T07:32:23.309Z","avatar_url":"https://github.com/owenodriscoll.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PyPI version](https://img.shields.io/pypi/v/py-automl-lib.svg?color=4c1)](https://pypi.org/project/py-automl-lib/)\n\n# automl: Automated Machine Learning\n## Intro\nautoml is a python project focussed on automating much of the machine learning efforts encountered in zero-dimensional regression and classification (and thus not multidimensional data such as for a CNN). It relies on existing Python packages Sci-Kit Learn, Optuna and model specific packages LightGBM, CatBoost and XGBoost.\n\nautoml works by assessing the performance of various machine-learning models for a set number of trials over a pre-defined range of hyperparameters. During succesive trials the hyperparameters are optimized following a user-defined methodology (the default optimisation uses Bayesian search). Unpromising trials are stopped (pruned) early by assessing performance on an incrementally increasing fraction of training data, saving computational resources. Hyperparameter optimization trials are stored locally on disk, allowing the training to be picked up after interuption. The best trials of the defined models are reloaded and combined, or stacked, to form a final model. This final model is assessed and, due to the nature of stacking, tends to outperform any of its constituting models.\n\nautoml contains several additional functionalities beyond the hyperoptimization and stacking of models: \n* scaling of the input `X`-matrix (tested for on default)\n* normal transformation of the `y`-matrix (tested for on default)\n* PCA compression\n* spline transformation\n* polynomial expansion\n* categorical feature support (nominal and ordinal)\n* bagging of weak models in addition to optimized models\n* multithreading\n* feature-importance analyses with `shap`\n\n\n## Installation\nCreate a new environment to prevent pip install from breaking anything. Include Python version 3.11\n```\nconda create -n ENVNAME -c conda-forge python=3.11\n```\n\nActivate new environment\n```\nconda activate ENVNAME\n```\n\nPip install \n```\npython3 -m pip install py-automl-lib\n```\n\nOptionally include the `shap` package for feature-importance analyses (see `example_notebook.ipynb` chapter 7.)\n```\npython3 -m pip install py-automl-lib[shap]\n```\n\n\n## Use\n\nFor a more detailed example checkout `examples/example_notebook.ipynb`\n\nMinimal use case regression:\n```python\nfrom sklearn.metrics import r2_score\nfrom automl import AutomatedRegression\n\nX, y = make_regression(n_samples=1000, n_features=10, n_informative=2, random_state=42)\n\nregression = AutomatedRegression(\n    y=y,\n    X=X,\n    n_trial=10,\n    timeout_study=100\n    metric_optimise=r2_score,\n    optimisation_direction='maximize',\n    models_to_optimize=['bayesianridge', 'lightgbm'],\n    )\n    \nregression.apply()\nregression.summary\n```\n\nExpanded options use case regression:\n```python\nfrom optuna.samplers import TPESampler\nfrom optuna.pruners import HyperbandPruner\nfrom sklearn.metrics import r2_score\nfrom sklearn.model_selection import KFold\nfrom automl import AutomatedRegression\n\nX, y = make_regression(n_samples=1000, n_features=10, n_informative=2, random_state=42)\n\n# -- adding categorical features\ndf_X = pd.DataFrame(X)\ndf_X['nine'] = pd.cut(df_X[9], bins=[-float('Inf'), -3, -1, 1, 3, float('Inf')], labels=['a', 'b', 'c', 'd', 'e'])\ndf_X['ten'] = pd.cut(df_X[9], bins=[-float('Inf'), -1, 1, float('Inf')], labels=['A', 'B', 'C'])\ndf_y = pd.Series(y)\n\nregression = AutomatedRegression(\n    y=df_y,\n    X=df_X,\n    test_frac=0.2,\n    fit_frac=[0.2, 0.4, 0.6, 1],\n    n_trial=50,\n    timeout_study=600,\n    timeout_trial=120,\n    metric_optimise=r2_score,\n    optimisation_direction='maximize',\n    cross_validation=KFold(n_splits=5, shuffle=True, random_state=42),\n    sampler=TPESampler(seed=random_state),\n    pruner=HyperbandPruner(min_resource=1, max_resource='auto', reduction_factor=3),\n    reload_study=False,\n    reload_trial_cap=False,\n    write_folder='/auto_regression_test',\n    models_to_optimize=['bayesianridge', 'lightgbm'],\n    nominal_columns=['nine'],\n    ordinal_columns=['ten'],\n    pca_value=0.95,\n    spline_value={'n_knots': 5, 'degree':3},\n    poly_value={'degree': 2, 'interaction_only': True},\n    boosted_early_stopping_rounds=100,\n    n_weak_models=5,\n    random_state=42,\n    )\n\nregression.apply()\nregression.summary\n    \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowenodriscoll%2Fautoml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fowenodriscoll%2Fautoml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowenodriscoll%2Fautoml/lists"}