Skip to content

Commit f8d6977

Browse files
committed
[ci skip] FIX HistGradientBoosting fitting time too long (INRIA#860) 55577e5
1 parent 6d8b2bd commit f8d6977

File tree

8 files changed

+117
-103
lines changed

8 files changed

+117
-103
lines changed

_sources/python_scripts/ensemble_hist_gradient_boosting.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
data,
5959
target,
6060
scoring="neg_mean_absolute_error",
61-
n_jobs=2,
61+
# n_jobs=2, # Uncomment this line if you run locally
6262
)
6363

6464
# %%
@@ -122,7 +122,7 @@
122122
data,
123123
target,
124124
scoring="neg_mean_absolute_error",
125-
n_jobs=2,
125+
# n_jobs=2, # Uncomment this line if you run locally
126126
)
127127

128128
# %%
@@ -161,7 +161,7 @@
161161
data,
162162
target,
163163
scoring="neg_mean_absolute_error",
164-
n_jobs=2,
164+
# n_jobs=2, # Uncomment this line if you run locally
165165
)
166166

167167
# %%

_sources/python_scripts/ensemble_hyperparameters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
scoring="neg_mean_absolute_error",
9797
n_iter=10,
9898
random_state=0,
99-
n_jobs=2,
99+
# n_jobs=2, # Uncomment this line if you run locally
100100
)
101101
search_cv.fit(data_train, target_train)
102102

@@ -184,7 +184,7 @@
184184
scoring="neg_mean_absolute_error",
185185
n_iter=20,
186186
random_state=0,
187-
n_jobs=2,
187+
# n_jobs=2, # Uncomment this line if you run locally
188188
)
189189
search_cv.fit(data_train, target_train)
190190

_sources/python_scripts/ensemble_sol_04.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@
7070

7171
cv = KFold(n_splits=5, shuffle=True, random_state=0)
7272
results = cross_validate(
73-
search, data, target, cv=cv, return_estimator=True, n_jobs=2
73+
search,
74+
data,
75+
target,
76+
cv=cv,
77+
return_estimator=True,
78+
# n_jobs=2 # Uncomment this if you run locally
7479
)
7580

7681
# %% [markdown]

appendix/notebook_timings.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -935,15 +935,15 @@ <h1>Notebook timings<a class="headerlink" href="#notebook-timings" title="Link t
935935
<td><p></p></td>
936936
</tr>
937937
<tr class="row-odd"><td><p><a class="xref doc reference internal" href="../python_scripts/ensemble_hist_gradient_boosting.html"><span class="doc">python_scripts/ensemble_hist_gradient_boosting</span></a></p></td>
938-
<td><p>2025-09-10 17:40</p></td>
938+
<td><p>2025-09-17 11:34</p></td>
939939
<td><p>cache</p></td>
940-
<td><p>41.85</p></td>
940+
<td><p>64.74</p></td>
941941
<td><p></p></td>
942942
</tr>
943943
<tr class="row-even"><td><p><a class="xref doc reference internal" href="../python_scripts/ensemble_hyperparameters.html"><span class="doc">python_scripts/ensemble_hyperparameters</span></a></p></td>
944-
<td><p>2025-09-10 17:41</p></td>
944+
<td><p>2025-09-17 11:36</p></td>
945945
<td><p>cache</p></td>
946-
<td><p>59.13</p></td>
946+
<td><p>91.64</p></td>
947947
<td><p></p></td>
948948
</tr>
949949
<tr class="row-odd"><td><p><a class="xref doc reference internal" href="../python_scripts/ensemble_introduction.html"><span class="doc">python_scripts/ensemble_introduction</span></a></p></td>
@@ -977,9 +977,9 @@ <h1>Notebook timings<a class="headerlink" href="#notebook-timings" title="Link t
977977
<td><p></p></td>
978978
</tr>
979979
<tr class="row-even"><td><p><a class="xref doc reference internal" href="../python_scripts/ensemble_sol_04.html"><span class="doc">python_scripts/ensemble_sol_04</span></a></p></td>
980-
<td><p>2025-09-10 17:44</p></td>
980+
<td><p>2025-09-17 11:37</p></td>
981981
<td><p>cache</p></td>
982-
<td><p>38.47</p></td>
982+
<td><p>57.64</p></td>
983983
<td><p></p></td>
984984
</tr>
985985
<tr class="row-odd"><td><p><a class="xref doc reference internal" href="../python_scripts/feature_selection_ex_01.html"><span class="doc">python_scripts/feature_selection_ex_01</span></a></p></td>

python_scripts/ensemble_hist_gradient_boosting.html

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ <h1>Speeding-up gradient-boosting<a class="headerlink" href="#speeding-up-gradie
744744
<span class="n">data</span><span class="p">,</span>
745745
<span class="n">target</span><span class="p">,</span>
746746
<span class="n">scoring</span><span class="o">=</span><span class="s2">&quot;neg_mean_absolute_error&quot;</span><span class="p">,</span>
747-
<span class="n">n_jobs</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span>
747+
<span class="c1"># n_jobs=2, # Uncomment this line if you run locally</span>
748748
<span class="p">)</span>
749749
</pre></div>
750750
</div>
@@ -767,8 +767,8 @@ <h1>Speeding-up gradient-boosting<a class="headerlink" href="#speeding-up-gradie
767767
</div>
768768
<div class="cell_output docutils container">
769769
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Gradient Boosting Decision Tree
770-
Mean absolute error via cross-validation: 46.441 ± 2.910 k$
771-
Average fit time: 7.191 seconds
770+
Mean absolute error via cross-validation: 46.414 ± 2.914 k$
771+
Average fit time: 7.233 seconds
772772
Average score time: 0.008 seconds
773773
</pre></div>
774774
</div>
@@ -852,26 +852,28 @@ <h1>Speeding-up gradient-boosting<a class="headerlink" href="#speeding-up-gradie
852852
<span class="n">data</span><span class="p">,</span>
853853
<span class="n">target</span><span class="p">,</span>
854854
<span class="n">scoring</span><span class="o">=</span><span class="s2">&quot;neg_mean_absolute_error&quot;</span><span class="p">,</span>
855-
<span class="n">n_jobs</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span>
855+
<span class="c1"># n_jobs=2, # Uncomment this line if you run locally</span>
856856
<span class="p">)</span>
857857
</pre></div>
858858
</div>
859859
</div>
860860
<div class="cell_output docutils container">
861861
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 1 are removed. Consider decreasing the number of bins.
862862
warnings.warn(
863-
/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 1 are removed. Consider decreasing the number of bins.
864-
warnings.warn(
865-
/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 3 are removed. Consider decreasing the number of bins.
866-
warnings.warn(
867863
/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 3 are removed. Consider decreasing the number of bins.
868864
warnings.warn(
869865
/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 6 are removed. Consider decreasing the number of bins.
870866
warnings.warn(
871-
/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 6 are removed. Consider decreasing the number of bins.
872-
warnings.warn(
873867
/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 7 are removed. Consider decreasing the number of bins.
874868
warnings.warn(
869+
</pre></div>
870+
</div>
871+
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 1 are removed. Consider decreasing the number of bins.
872+
warnings.warn(
873+
/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 3 are removed. Consider decreasing the number of bins.
874+
warnings.warn(
875+
/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 6 are removed. Consider decreasing the number of bins.
876+
warnings.warn(
875877
/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 7 are removed. Consider decreasing the number of bins.
876878
warnings.warn(
877879
</pre></div>
@@ -884,7 +886,9 @@ <h1>Speeding-up gradient-boosting<a class="headerlink" href="#speeding-up-gradie
884886
warnings.warn(
885887
/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 7 are removed. Consider decreasing the number of bins.
886888
warnings.warn(
887-
/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 1 are removed. Consider decreasing the number of bins.
889+
</pre></div>
890+
</div>
891+
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 1 are removed. Consider decreasing the number of bins.
888892
warnings.warn(
889893
/opt/hostedtoolcache/Python/3.9.23/x64/lib/python3.9/site-packages/sklearn/preprocessing/_discretization.py:306: UserWarning: Bins whose width are too small (i.e., &lt;= 1e-8) in feature 3 are removed. Consider decreasing the number of bins.
890894
warnings.warn(
@@ -923,8 +927,8 @@ <h1>Speeding-up gradient-boosting<a class="headerlink" href="#speeding-up-gradie
923927
</div>
924928
<div class="cell_output docutils container">
925929
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Gradient Boosting Decision Tree with KBinsDiscretizer
926-
Mean absolute error via cross-validation: 45.781 ± 2.019 k$
927-
Average fit time: 4.459 seconds
930+
Mean absolute error via cross-validation: 45.771 ± 2.026 k$
931+
Average fit time: 4.466 seconds
928932
Average score time: 0.010 seconds
929933
</pre></div>
930934
</div>
@@ -952,7 +956,7 @@ <h1>Speeding-up gradient-boosting<a class="headerlink" href="#speeding-up-gradie
952956
<span class="n">data</span><span class="p">,</span>
953957
<span class="n">target</span><span class="p">,</span>
954958
<span class="n">scoring</span><span class="o">=</span><span class="s2">&quot;neg_mean_absolute_error&quot;</span><span class="p">,</span>
955-
<span class="n">n_jobs</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span>
959+
<span class="c1"># n_jobs=2, # Uncomment this line if you run locally</span>
956960
<span class="p">)</span>
957961
</pre></div>
958962
</div>
@@ -976,7 +980,7 @@ <h1>Speeding-up gradient-boosting<a class="headerlink" href="#speeding-up-gradie
976980
<div class="cell_output docutils container">
977981
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Histogram Gradient Boosting Decision Tree
978982
Mean absolute error via cross-validation: 43.758 ± 2.694 k$
979-
Average fit time: 0.509 seconds
983+
Average fit time: 0.506 seconds
980984
Average score time: 0.061 seconds
981985
</pre></div>
982986
</div>

0 commit comments

Comments
 (0)