diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml index 4091264a8..edce58a49 100644 --- a/.github/workflows/deploy-gh-pages.yml +++ b/.github/workflows/deploy-gh-pages.yml @@ -25,7 +25,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.11 - name: Install dependencies run: | diff --git a/check_env.py b/check_env.py index c5ae4086e..3c168abe3 100644 --- a/check_env.py +++ b/check_env.py @@ -18,11 +18,11 @@ pyversion_str = f"{sys.version_info.major}.{sys.version_info.minor}" pyversion = Version(pyversion_str) -if pyversion < Version("3.8"): +if pyversion < Version("3.11"): print( FAIL, ( - "Python version 3.8 or above is required," + "Python version 3.11 or above is required," f" but {pyversion_str} is installed." ), ) @@ -66,7 +66,7 @@ def import_version(pkg, min_ver, fail_msg=""): "numpy": "1.16", "scipy": "1.2", "matplotlib": "3.0", - "sklearn": "1.6", + "sklearn": "1.8", "pandas": "1", "seaborn": "0.11", "notebook": "5.7", diff --git a/environment-dev.yml b/environment-dev.yml index fe6de1e72..42a9e093e 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -2,7 +2,8 @@ name: scikit-learn-course channels: - conda-forge dependencies: - - scikit-learn >= 1.6 + - python=3.11 + - scikit-learn >= 1.8 - pandas >= 1 - matplotlib-base - seaborn >= 0.13 @@ -13,4 +14,4 @@ dependencies: - packaging - pip - pip: - - jupyter-book >= 0.11 + - jupyter-book < 2.0 diff --git a/environment.yml b/environment.yml index b73214414..9b6cc2127 100644 --- a/environment.yml +++ b/environment.yml @@ -4,7 +4,8 @@ channels: - conda-forge dependencies: - - scikit-learn >= 1.6 + - python=3.11 + - scikit-learn >= 1.8 - pandas >= 1 - matplotlib-base - seaborn >= 0.13 diff --git a/local-install-instructions.md b/local-install-instructions.md index 2155b6917..77575610b 100644 --- a/local-install-instructions.md +++ b/local-install-instructions.md @@ -46,7 +46,7 @@ Using python in /home/lesteve/miniconda3/envs/scikit-learn-course [ OK ] numpy version 1.19.5 [ OK ] scipy version 1.6.0 [ OK ] matplotlib version 3.3.3 -[ OK ] sklearn version 1.6 +[ OK ] sklearn version 1.8 [ OK ] pandas version 2.0 [ OK ] seaborn version 0.13 [ OK ] notebook version 6.2.0 diff --git a/notebooks/linear_models_ex_01.ipynb b/notebooks/linear_models_ex_01.ipynb index 3d85324d3..cf82db379 100644 --- a/notebooks/linear_models_ex_01.ipynb +++ b/notebooks/linear_models_ex_01.ipynb @@ -43,7 +43,7 @@ "penguins = pd.read_csv(\"../datasets/penguins_regression.csv\")\n", "feature_name = \"Flipper Length (mm)\"\n", "target_name = \"Body Mass (g)\"\n", - "data, target = penguins[[feature_name]], penguins[target_name]" + "data, target = penguins[[feature_name]], penguins[[target_name]]" ] }, { diff --git a/notebooks/linear_models_sol_01.ipynb b/notebooks/linear_models_sol_01.ipynb index f6f710ade..9d6ff3e4a 100644 --- a/notebooks/linear_models_sol_01.ipynb +++ b/notebooks/linear_models_sol_01.ipynb @@ -43,7 +43,7 @@ "penguins = pd.read_csv(\"../datasets/penguins_regression.csv\")\n", "feature_name = \"Flipper Length (mm)\"\n", "target_name = \"Body Mass (g)\"\n", - "data, target = penguins[[feature_name]], penguins[target_name]" + "data, target = penguins[[feature_name]], penguins[[target_name]]" ] }, { @@ -152,7 +152,7 @@ "def goodness_fit_measure(true_values, predictions):\n", " # we compute the error between the true values and the predictions of our\n", " # model\n", - " errors = np.ravel(true_values) - np.ravel(predictions)\n", + " errors = true_values - predictions\n", " # We have several possible strategies to reduce all errors to a single value.\n", " # Computing the mean error (sum divided by the number of element) might seem\n", " # like a good solution. However, we have negative errors that will misleadingly\n", diff --git a/python_scripts/linear_models_ex_01.py b/python_scripts/linear_models_ex_01.py index 4ddf7b808..17ec8ebc0 100644 --- a/python_scripts/linear_models_ex_01.py +++ b/python_scripts/linear_models_ex_01.py @@ -40,7 +40,7 @@ penguins = pd.read_csv("../datasets/penguins_regression.csv") feature_name = "Flipper Length (mm)" target_name = "Body Mass (g)" -data, target = penguins[[feature_name]], penguins[target_name] +data, target = penguins[[feature_name]], penguins[[target_name]] # %% [markdown] # ### Model definition diff --git a/python_scripts/linear_models_sol_01.py b/python_scripts/linear_models_sol_01.py index 0f98303be..1bf53ec66 100644 --- a/python_scripts/linear_models_sol_01.py +++ b/python_scripts/linear_models_sol_01.py @@ -34,7 +34,7 @@ penguins = pd.read_csv("../datasets/penguins_regression.csv") feature_name = "Flipper Length (mm)" target_name = "Body Mass (g)" -data, target = penguins[[feature_name]], penguins[target_name] +data, target = penguins[[feature_name]], penguins[[target_name]] # %% [markdown] # ### Model definition @@ -106,7 +106,7 @@ def linear_model_flipper_mass( def goodness_fit_measure(true_values, predictions): # we compute the error between the true values and the predictions of our # model - errors = np.ravel(true_values) - np.ravel(predictions) + errors = true_values - predictions # We have several possible strategies to reduce all errors to a single value. # Computing the mean error (sum divided by the number of element) might seem # like a good solution. However, we have negative errors that will misleadingly diff --git a/python_scripts/parameter_tuning_grid_search.py b/python_scripts/parameter_tuning_grid_search.py index 30979909a..e029fb80e 100644 --- a/python_scripts/parameter_tuning_grid_search.py +++ b/python_scripts/parameter_tuning_grid_search.py @@ -91,7 +91,6 @@ remainder="passthrough", # Silence a deprecation warning in scikit-learn v1.6 related to how the # ColumnTransformer stores an attribute that we do not use in this notebook - force_int_remainder_cols=False, ) # %% [markdown] diff --git a/python_scripts/parameter_tuning_nested.py b/python_scripts/parameter_tuning_nested.py index 690398a27..6acc173ad 100644 --- a/python_scripts/parameter_tuning_nested.py +++ b/python_scripts/parameter_tuning_nested.py @@ -54,7 +54,6 @@ preprocessor = make_column_transformer( (categorical_preprocessor, categorical_columns), remainder="passthrough", - force_int_remainder_cols=False, # Silence a warning in scikit-learn v1.6. ) # %% diff --git a/python_scripts/parameter_tuning_randomized_search.py b/python_scripts/parameter_tuning_randomized_search.py index 7acf7da7e..678bdf00f 100644 --- a/python_scripts/parameter_tuning_randomized_search.py +++ b/python_scripts/parameter_tuning_randomized_search.py @@ -73,7 +73,6 @@ preprocessor = make_column_transformer( (categorical_preprocessor, categorical_columns), remainder="passthrough", - force_int_remainder_cols=False, # Silence a warning in scikit-learn v1.6. ) # %% diff --git a/requirements-dev.txt b/requirements-dev.txt index 503d326e1..500297a6e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,9 +1,9 @@ -scikit-learn>=1.6 +scikit-learn>=1.8 pandas >= 1 matplotlib seaborn >= 0.13 plotly -jupyter-book>=0.11 +jupyter-book < 2.0 jupytext beautifulsoup4 IPython diff --git a/requirements.txt b/requirements.txt index b0a22e372..eefe6a50d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -scikit-learn>=1.6 +scikit-learn>=1.8 pandas >= 1 matplotlib>=3.10 seaborn >= 0.13