A Setup Your Environment

The examples in this book were tested with Python 3.12.7 within an Anaconda (Jupyter Team 2025) environment.

The source code is provided in the form of jupyter notebooks (Anaconda Team 2025). Each chapter (mistake) has its own related jupyter notebook file with .ipynb extension.

The scikit-learn version used in this book was 1.6.1. The pandas version is 2.2.2.

Be aware that the results and outputs may vary depending on the scikit-learn version even when setting the random seed.

The following steps describe how to setup your environment.

1. Download and install Anaconda. Download the Anaconda distribution based on your operating system. You can get Anaconda here: https://www.anaconda.com/download

2. Create an environment. Open the Anaconda prompt and run the following commands.

conda create -n mlmistakes python=3.12.7 scikit-learn=1.6.1 pandas=2.2.2

3. Activate the mlmistakes environment. To activate the environment, run the following code.

activate mlmistakes

4. Install Jupyter notebooks. Run the following command to install Jupyter notebooks.

conda install anaconda::jupyter

5. Run the notebooks. In the Anaconda prompt, change to the directory where the notebooks (.ipynb) are stored. In windows, you can use the cd command. To start Jupyter notebooks type jupyter notebook.

References

Anaconda Team. 2025. Anaconda. https://www.anaconda.com/.
Jupyter Team. 2025. Jupyter. https://jupyter.org/.