### Install Development Dependencies Source: https://github.com/automl/auto-sklearn/blob/development/CONTRIBUTING.md Install all necessary development dependencies, including test, examples, and documentation packages, using the provided make command. ```bash make install-dev ``` -------------------------------- ### Development Setup and Workflow Source: https://github.com/automl/auto-sklearn/blob/development/CONTRIBUTING.md This snippet outlines the essential steps for setting up a development environment, including cloning the repository, creating a virtual environment, installing dependencies, formatting code, running checks, and testing. ```bash git clone git@github.com:your-username/auto-sklearn.git cd auto-sklearn git checkout -b my_new_branch development # Initialize autosklearn/automl_common submodule git submodule update --init --recursive # Create a virtual environment and activate it so there are no package # conflicts python -m venv my-virtual-env source my-virtual-env/bin/activate make install-dev # pip install -e "[test,docs,examples]" # To manually install things # Edit files... # Format code make format # Check for any issues make check # ... fix any issues # If you changed documentation: # This will generate all documentation and check links make doc make links make examples # mainly needed if you modified some examples # ... fix any issues # If you edited any code # Check out pytest --help if you want to only run specific tests pytest # ... fix any issues # If you want to run pre-commit, the formatting checks we run on github pre-commit install pre-commit run --all-files # ... fix any issues # Check the changed files git status # Add the changes git add {changed files} git commit -m "Meaningful as you can make it message" # Push back to your fork git push --set-upstream origin my_new_branch ``` -------------------------------- ### Generate Example Documentation Source: https://github.com/automl/auto-sklearn/blob/development/CONTRIBUTING.md Process Python files in the 'examples' folder to generate HTML output showcasing code and its results using sphinx-gallery. ```bash make examples ``` -------------------------------- ### Manually Install Submodules Source: https://github.com/automl/auto-sklearn/blob/development/CONTRIBUTING.md If submodules were not cloned initially or need manual installation, use this command. ```bash git submodule update --init --recursive ``` -------------------------------- ### Manually Install Editable Package with Extras Source: https://github.com/automl/auto-sklearn/blob/development/CONTRIBUTING.md Install the current package in editable mode with optional dependencies for testing, examples, and documentation. Use quotes if your shell requires it. ```bash pip install -e .[test,examples,doc] ``` ```bash pip install -e " .[test,examples,doc]" ``` -------------------------------- ### Install build tools and SWIG on Ubuntu Source: https://github.com/automl/auto-sklearn/blob/development/doc/installation.rst Install necessary build tools (g++, make) and SWIG on Ubuntu systems to ensure a smooth installation of auto-sklearn and its dependencies. ```bash sudo apt-get install build-essential swig python3-dev ``` -------------------------------- ### Install auto-sklearn using pip Source: https://github.com/automl/auto-sklearn/blob/development/doc/installation.rst Install the auto-sklearn package using pip. This is the standard installation method. ```bash pip3 install auto-sklearn ``` -------------------------------- ### Install auto-sklearn in editable mode from source Source: https://github.com/automl/auto-sklearn/blob/development/doc/installation.rst Install auto-sklearn in editable mode from the cloned source code, including optional dependencies for testing and documentation. ```bash pip install -e ".[test,doc,examples]" ``` -------------------------------- ### Create Virtual Environment Source: https://github.com/automl/auto-sklearn/blob/development/CONTRIBUTING.md Set up a Python virtual environment to manage project dependencies separately. This example creates an environment named 'my-virtual-env'. ```bash python -m venv my-virtual-env source my-virtual-env/bin/activate ``` -------------------------------- ### Install Pre-commit Hook Source: https://github.com/automl/auto-sklearn/blob/development/CONTRIBUTING.md Set up the pre-commit framework to automatically run code checks before each commit. Assumes `make install-dev` has been run. ```bash pre-commit install ``` -------------------------------- ### Start Jupyter Notebook in Docker Source: https://github.com/automl/auto-sklearn/blob/development/doc/installation.rst Run a Docker container to start a Jupyter notebook server, mapping the current directory and exposing port 8888. ```bash docker run -it -v ${PWD}:/opt/nb -p 8888:8888 mfeurer/auto-sklearn:master /bin/bash -c "mkdir -p /opt/nb && jupyter notebook --notebook-dir=/opt/nb --ip='0.0.0.0' --port=8888 --no-browser --allow-root" ``` -------------------------------- ### Start Interactive Docker Session Source: https://github.com/automl/auto-sklearn/blob/development/doc/installation.rst Launch an interactive terminal session within the Auto-Sklearn Docker container. ```bash docker run -it mfeurer/auto-sklearn:master ``` -------------------------------- ### Install GCC and SWIG with Conda Source: https://github.com/automl/auto-sklearn/blob/development/doc/installation.rst Install the Conda-shipped GCC compiler and SWIG on Linux distributions to resolve potential compiler version incompatibilities when using Anaconda. ```bash conda install gxx_linux-64 gcc_linux-64 swig ``` -------------------------------- ### Initialize AutoSklearnClassifier Source: https://github.com/automl/auto-sklearn/blob/development/doc/manual.rst This snippet shows how to initialize an AutoSklearnClassifier. Ensure you have the autosklearn library installed and imported. ```python import autosklearn.classification automl = autosklearn.classification.AutoSklearnClassifier() automl.fit(X_train, y_train) ``` -------------------------------- ### Initialize git submodules after cloning Source: https://github.com/automl/auto-sklearn/blob/development/doc/installation.rst Update and initialize git submodules if the initial clone did not include them recursively. This is necessary for source installations. ```bash git clone git@github.com:automl/auto-sklearn.git cd auto-sklearn git submodule update --init --recursive ``` -------------------------------- ### Configure Vanilla Auto-Sklearn Classifier Source: https://github.com/automl/auto-sklearn/blob/development/doc/faq.rst Use this configuration to obtain the vanilla auto-sklearn setup. Set `ensemble_class` to `autosklearn.ensembles.SingleBest` and `initial_configurations_via_metalearning` to 0. This ensures the best model is chosen based on the validation set and SMAC is used for hyperparameter configuration. ```python import autosklearn.classification import autosklearn.ensembles automl = autosklearn.classification.AutoSklearnClassifier( ensemble_class=autosklearn.ensembles.SingleBest, initial_configurations_via_metalearning=0 ) ``` -------------------------------- ### Create Working Directory Source: https://github.com/automl/auto-sklearn/blob/development/scripts/readme.md Sets up a directory to store metadata and output. Ensure the directory path is correctly specified. ```bash working_directory=~/auto-sklearn-metadata/001 mkdir -p $working_directory ``` -------------------------------- ### Install auto-sklearn with Conda Source: https://github.com/automl/auto-sklearn/blob/development/doc/installation.rst Install auto-sklearn using Conda after enabling the conda-forge channel. Ensure your conda version is at least 4.9. ```bash conda install auto-sklearn ``` -------------------------------- ### View Generated Documentation Source: https://github.com/automl/auto-sklearn/blob/development/CONTRIBUTING.md Open the generated HTML documentation in a web browser. Ensure documentation is built before attempting to view. ```bash # Firefox firefox ./doc/build/html/index.html ``` ```bash # Using your default browser xdg-open ./doc/build/html/index.html ``` -------------------------------- ### Generate Documentation with Sphinx Source: https://github.com/automl/auto-sklearn/blob/development/CONTRIBUTING.md Build the project's HTML documentation using Sphinx. Ensure all documentation is up-to-date and correctly formatted. ```bash make doc ``` -------------------------------- ### Check Documentation Links Source: https://github.com/automl/auto-sklearn/blob/development/CONTRIBUTING.md Verify that all links within the generated documentation are valid and point to correct destinations. ```bash make links ``` -------------------------------- ### Add conda-forge channel Source: https://github.com/automl/auto-sklearn/blob/development/doc/installation.rst Configure Conda to use the conda-forge channel, which is necessary for installing auto-sklearn via Anaconda. ```bash conda config --add channels conda-forge ``` ```bash conda config --set channel_priority strict ``` -------------------------------- ### Create ASlib Files Source: https://github.com/automl/auto-sklearn/blob/development/scripts/readme.md Generates ASlib (Algorithm Selection Library) files, which are used for algorithm selection tasks. ```bash python3 04_create_aslib_files.py --working-directory $working_directory --task-type $task_type ``` -------------------------------- ### Create and Checkout New Branch Source: https://github.com/automl/auto-sklearn/blob/development/CONTRIBUTING.md Navigate into the cloned repository and create a new branch based on the 'development' branch for your changes. ```bash cd auto-sklearn git checkout -b my_new_branch development ``` -------------------------------- ### Create Commands File Source: https://github.com/automl/auto-sklearn/blob/development/scripts/2015_nips_paper/Readme.md Generates the commands.txt file needed to run the experiment. Modify the script to change runtime or tasks. ```bash cd setup bash create_commands.sh ``` -------------------------------- ### AutoSklearn Classifier with Dataset Loading and Evaluation Source: https://github.com/automl/auto-sklearn/blob/development/doc/index.rst This example demonstrates a more complete usage of AutoSklearnClassifier, including loading a dataset, splitting it into training and testing sets, fitting the classifier, making predictions, and evaluating accuracy. It is intended to run for approximately one hour and achieve an accuracy above 0.98. ```python import autosklearn.classification import sklearn.model_selection import sklearn.datasets import sklearn.metrics if __name__ == "__main__": X, y = sklearn.datasets.load_digits(return_X_y=True) X_train, X_test, y_train, y_test = \ sklearn.model_selection.train_test_split(X, y, random_state=1) automl = autosklearn.classification.AutoSklearnClassifier() automl.fit(X_train, y_train) y_hat = automl.predict(X_test) print("Accuracy score", sklearn.metrics.accuracy_score(y_test, y_hat)) ``` -------------------------------- ### Configure Vanilla Auto-Sklearn Source: https://github.com/automl/auto-sklearn/blob/development/doc/manual.rst Set these parameters to replicate the 'vanilla auto-sklearn' configuration as described in the 'Efficient and Robust Automated Machine Learning' paper. This configuration uses an ensemble size of 1, disables meta-learning for initial configurations, and disallows string features. ```python import autosklearn.classification automl = autosklearn.classification.AutoSklearnClassifier( ensemble_size=1, initial_configurations_via_metalearning=0, allow_string_features=False, ) ``` -------------------------------- ### Execute Experiment Commands Source: https://github.com/automl/auto-sklearn/blob/development/scripts/2015_nips_paper/Readme.md Runs the commands listed in commands.txt for model fitting and trajectory creation. Commands can be run in parallel. ```bash cd run bash run_commands.sh ```