Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
f7cf7d6
First draft, needs tests & fixes
cakedev0 Sep 2, 2025
7061ff6
Merge remote-tracking branch 'upstream/main' into mae-split-optim
cakedev0 Sep 2, 2025
f4edaa2
fixed compilation errors
cakedev0 Sep 3, 2025
01fd9b2
fixed compilation errors
cakedev0 Sep 3, 2025
3f87b99
Moved AE computation in external helper to be able to unit-test it; a…
cakedev0 Sep 3, 2025
e8adf96
WIP some additional tests that helped me, some will be kept in my fin…
cakedev0 Sep 3, 2025
4ed868e
tests cleanup
cakedev0 Sep 3, 2025
83d89a4
cleanup
cakedev0 Sep 3, 2025
1ca34bf
cleanup
cakedev0 Sep 3, 2025
43692f7
Merge remote-tracking branch 'upstream/main' into mae-split-optim
cakedev0 Sep 3, 2025
d463558
WIP fixing linting issues
cakedev0 Sep 3, 2025
fa993d4
fixed linting
cakedev0 Sep 3, 2025
cbf5405
fix spelling
cakedev0 Sep 3, 2025
a4bd310
Added test that would fail before this PR
cakedev0 Sep 4, 2025
f4a0e07
added changed logs
cakedev0 Sep 4, 2025
a86a190
cleanup
cakedev0 Sep 4, 2025
092af65
comments & cleanups
cakedev0 Sep 4, 2025
4a12dea
slight refactor of class inheritance
cakedev0 Sep 4, 2025
b44fb2b
Merge remote-tracking branch 'upstream/main' into mae-split-optim
cakedev0 Sep 4, 2025
81728c2
adressed PR comments; simplified dimension of left/right abs errors a…
cakedev0 Sep 9, 2025
7477f4c
removed print
cakedev0 Sep 9, 2025
8f035d0
heap methods docstring; test: split assertion
cakedev0 Sep 10, 2025
e6bf43b
unit test for heap
cakedev0 Sep 10, 2025
eb2ccf5
fix comment
cakedev0 Sep 10, 2025
66a2cb6
Merge remote-tracking branch 'upstream/main' into mae-split-optim
cakedev0 Sep 12, 2025
d13a2c5
Apply suggestions from code review
cakedev0 Sep 13, 2025
4fc78f4
comments & naming
cakedev0 Sep 13, 2025
220c34f
parameters docstring
cakedev0 Sep 13, 2025
d9b3c35
Update doc about MAE criterion speed
cakedev0 Sep 14, 2025
72e15b5
move precompute
cakedev0 Sep 14, 2025
debf965
minimal changes
cakedev0 Sep 14, 2025
6e267d5
AE to pinball loss
cakedev0 Sep 14, 2025
aa91439
doing typos is my signature move, sorry for taht
cakedev0 Sep 14, 2025
450290a
Update doc/modules/tree.rst
cakedev0 Sep 15, 2025
bc7685e
Add docstring for test_cython_weighted_heap_vs_heapq
cakedev0 Sep 15, 2025
390731a
Update comment about mem footprint
cakedev0 Sep 15, 2025
1153cb5
PERF: Decision trees: improve prefs by ~20% with very simple changes …
cakedev0 Sep 15, 2025
0f6d896
:lock: :robot: CI Update lock files for main CI build(s) :lock: :robo…
scikit-learn-bot Sep 15, 2025
f48a2a4
:lock: :robot: CI Update lock files for array-api CI build(s) :lock: …
scikit-learn-bot Sep 15, 2025
b32df28
:lock: :robot: CI Update lock files for free-threaded CI build(s) :lo…
scikit-learn-bot Sep 15, 2025
6cdacd1
TST Fix the error message in test_min_dependencies_readme (#32149)
jeremiedbb Sep 15, 2025
3a85d5c
Revert "API make murmurhash3_32 private (#32103)" (#32131)
jeremiedbb Sep 15, 2025
85b12c9
fix docstring
cakedev0 Sep 15, 2025
7996ed6
Merge remote-tracking branch 'upstream/main' into mae-split-optim
cakedev0 Sep 15, 2025
22c843e
addressed comments around test_absolute_errors_precomputation_function
cakedev0 Sep 15, 2025
319523a
update docstring
cakedev0 Sep 15, 2025
d7f5157
update docstring; again
cakedev0 Sep 15, 2025
592e74a
Pass down pinball_alpha
cakedev0 Sep 17, 2025
3c59ae7
Merge remote-tracking branch 'upstream/main' into mae-split-optim
cakedev0 Sep 17, 2025
a2f3a85
Merge branch 'mae-split-optim' into quantile-regression
cakedev0 Sep 17, 2025
ecd2f15
small changes
cakedev0 Sep 19, 2025
075243c
fixes
cakedev0 Sep 23, 2025
3819c50
Merge remote-tracking branch 'upstream/main' into mae-split-optim
cakedev0 Sep 26, 2025
77dcb19
new test and fix
cakedev0 Sep 26, 2025
14014f5
fix typo
cakedev0 Sep 26, 2025
ad16ae0
remove np.pow
cakedev0 Sep 26, 2025
1e9c74f
Apply suggestion from @ogrisel
cakedev0 Sep 26, 2025
b21040e
Apply suggestion from @cakedev0
cakedev0 Sep 26, 2025
e557f9e
added explanation test; more tests with integer weights
cakedev0 Sep 29, 2025
f920379
Merge branch 'mae-split-optim' of github.com:cakedev0/scikit-learn in…
cakedev0 Sep 29, 2025
c204c20
Merge branch 'mae-split-optim' into quantile-regression
cakedev0 Sep 29, 2025
c842e59
Merge remote-tracking branch 'upstream/main' into mae-split-optim
cakedev0 Oct 2, 2025
bec926a
Merge branch 'main' into mae-split-optim
cakedev0 Oct 3, 2025
0cdeaaf
Merge branch 'mae-split-optim' into quantile-regression
cakedev0 Oct 7, 2025
bf0007f
Merge branch 'main' into quantile-regression
cakedev0 Dec 15, 2025
19bf4a6
cleanup, comments updates, renamings, ...
cakedev0 Dec 15, 2025
aaa4b2a
remove old changelog
cakedev0 Dec 15, 2025
4023c02
Added simple changelog
cakedev0 Dec 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/whats_new/upcoming_changes/sklearn.tree/32903.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- :class:`tree.DecisionTreeRegressor` now supports `criterion="pinball"`
for the pinball loss, also known as the quantile loss. This effectively
allows to do quantile regression.
By :user:`Arthur Lacote <cakedev0>`
25 changes: 23 additions & 2 deletions sklearn/tree/_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"friedman_mse": _criterion.FriedmanMSE,
"absolute_error": _criterion.MAE,
"poisson": _criterion.Poisson,
"pinball": _criterion.Pinball,
}

DENSE_SPLITTERS = {"best": _splitter.BestSplitter, "random": _splitter.RandomSplitter}
Expand Down Expand Up @@ -383,7 +384,14 @@ def _fit(
self.n_outputs_, self.n_classes_
)
else:
criterion = CRITERIA_REG[self.criterion](self.n_outputs_, n_samples)
args = (self.n_outputs_, n_samples)
if self.criterion == "pinball":
args = (*args, self.pinball_alpha)
if self.criterion == "absolute_error":
# FIXME: this is coupled with code at a much lower level
# because of the inheritance behavior of __cinit__
args = (*args, 0.5)
criterion = CRITERIA_REG[self.criterion](*args)
else:
# Make a deepcopy in case the criterion has mutable attributes that
# might be shared and modified concurrently during parallel fitting
Expand Down Expand Up @@ -1338,9 +1346,18 @@ class DecisionTreeRegressor(RegressorMixin, BaseDecisionTree):
_parameter_constraints: dict = {
**BaseDecisionTree._parameter_constraints,
"criterion": [
StrOptions({"squared_error", "friedman_mse", "absolute_error", "poisson"}),
StrOptions(
{
"squared_error",
"friedman_mse",
"absolute_error",
"poisson",
"pinball",
}
),
Hidden(Criterion),
],
"pinball_alpha": [Interval(RealNotInt, 0.0, 1.0, closed="neither")],
}

def __init__(
Expand All @@ -1358,6 +1375,7 @@ def __init__(
min_impurity_decrease=0.0,
ccp_alpha=0.0,
monotonic_cst=None,
pinball_alpha=0.5,
):
super().__init__(
criterion=criterion,
Expand All @@ -1373,6 +1391,7 @@ def __init__(
ccp_alpha=ccp_alpha,
monotonic_cst=monotonic_cst,
)
self.pinball_alpha = pinball_alpha

@_fit_context(prefer_skip_nested_validation=True)
def fit(self, X, y, sample_weight=None, check_input=True):
Expand Down Expand Up @@ -1971,6 +1990,7 @@ def __init__(
max_leaf_nodes=None,
ccp_alpha=0.0,
monotonic_cst=None,
pinball_alpha=0.5,
):
super().__init__(
criterion=criterion,
Expand All @@ -1985,6 +2005,7 @@ def __init__(
random_state=random_state,
ccp_alpha=ccp_alpha,
monotonic_cst=monotonic_cst,
pinball_alpha=pinball_alpha,
)

def __sklearn_tags__(self):
Expand Down
Loading
Loading