Skip to content

FIX add argument to _check_sample_weight #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: submodulev3
Choose a base branch
from

Conversation

PSSF23
Copy link
Member

@PSSF23 PSSF23 commented Jun 23, 2025

Fix the following bug:

>>> from treeple.ensemble import ObliqueRandomForestClassifier
>>> from sklearn.datasets import make_classification
>>> X,y = make_classification(n_samples=1000, n_features=4,n_informative=2,n_redundant=0,random_state=0,shuffle=False)
>>> clf = ObliqueRandomForestClassifier(max_depth=2, random_state=0)
>>> clf.fit(X,y)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/pssf23/miniconda3/envs/temp/lib/python3.10/site-packages/sklearn/base.py", line 1363, in wrapper
    return fit_method(estimator, *args, **kwargs)
  File "/Users/pssf23/miniconda3/envs/temp/lib/python3.10/site-packages/treeple/_lib/sklearn/ensemble/_forest.py", line 597, in fit
    self._construct_trees(
  File "/Users/pssf23/miniconda3/envs/temp/lib/python3.10/site-packages/treeple/_lib/sklearn/ensemble/_forest.py", line 663, in _construct_trees
    trees = Parallel(
  File "/Users/pssf23/miniconda3/envs/temp/lib/python3.10/site-packages/sklearn/utils/parallel.py", line 82, in __call__
    return super().__call__(iterable_with_config_and_warning_filters)
  File "/Users/pssf23/miniconda3/envs/temp/lib/python3.10/site-packages/joblib/parallel.py", line 1986, in __call__
    return output if self.return_generator else list(output)
  File "/Users/pssf23/miniconda3/envs/temp/lib/python3.10/site-packages/joblib/parallel.py", line 1914, in _get_sequential_output
    res = func(*args, **kwargs)
  File "/Users/pssf23/miniconda3/envs/temp/lib/python3.10/site-packages/sklearn/utils/parallel.py", line 147, in __call__
    return self.function(*args, **kwargs)
  File "/Users/pssf23/miniconda3/envs/temp/lib/python3.10/site-packages/treeple/_lib/sklearn/ensemble/_forest.py", line 211, in _parallel_build_trees
    tree._fit(
  File "/Users/pssf23/miniconda3/envs/temp/lib/python3.10/site-packages/treeple/_lib/sklearn/tree/_classes.py", line 395, in _fit
    sample_weight = _check_sample_weight(sample_weight, X, DOUBLE)
TypeError: _check_sample_weight() takes 2 positional arguments but 3 were given

@PSSF23 PSSF23 requested a review from SUKI-O June 23, 2025 18:24
Copy link

github-actions bot commented Jun 23, 2025

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: aad1584. Link to the linter CI: here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants