neurodata / scikit-learn

scikit-learn-tree fork: A fork that enables extensions of Python and Cython API for decision trees
https://scikit-learn.org
BSD 3-Clause "New" or "Revised" License
7 stars 6 forks source link

[example] Testing oob computation parallel #60

Closed adam2392 closed 4 months ago

adam2392 commented 9 months ago

Reference Issues/PRs

What does this implement/fix? Explain your changes.

Any other comments?

github-actions[bot] commented 9 months ago

❌ Linting issues

This PR is introducing linting issues. Here's a summary of the issues. Note that you can avoid having linting issues by enabling pre-commit hooks. Instructions to enable them can be found here.

You can see the details of the linting issues under the lint job here


black

black detected issues. Please run black . locally and push the changes. Here you can see the detected issues. Note that running black might also fix some of the issues which might be detected by ruff. Note that the installed black version is black=23.3.0.

``` --- /home/runner/work/scikit-learn/scikit-learn/sklearn/ensemble/_forest.py 2024-02-17 17:45:33.639552 +0000 +++ /home/runner/work/scikit-learn/scikit-learn/sklearn/ensemble/_forest.py 2024-02-17 17:45:48.688961 +0000 @@ -599,12 +599,21 @@ n_samples, self.max_samples, ) lock = threading.Lock() Parallel(n_jobs=self.n_jobs, verbose=self.verbose, require="sharedmem")( - delayed(_accumulate_oob_prediction)(self._get_oob_predictions, e, X, n_samples, n_samples_bootstrap, - oob_pred, n_oob_pred, e.random_state, lock) + delayed(_accumulate_oob_prediction)( + self._get_oob_predictions, + e, + X, + n_samples, + n_samples_bootstrap, + oob_pred, + n_oob_pred, + e.random_state, + lock, + ) for e in self.estimators_ ) for k in range(n_outputs): if (n_oob_pred == 0).any(): @@ -731,11 +740,13 @@ else: for i in range(len(out)): out[i] += prediction[i] -def _accumulate_oob_prediction(predict, tree, X, n_samples, n_samples_bootstrap, out, out_count, random_state, lock): +def _accumulate_oob_prediction( + predict, tree, X, n_samples, n_samples_bootstrap, out, out_count, random_state, lock +): """ This is a utility function for joblib's Parallel. It can't go locally in ForestClassifier or ForestRegressor, because joblib complains that it cannot pickle it when placed there. would reformat /home/runner/work/scikit-learn/scikit-learn/sklearn/ensemble/_forest.py Oh no! 💥 💔 💥 1 file would be reformatted, 907 files would be left unchanged. ```

ruff

ruff detected issues. Please run ruff --fix --show-source . locally, fix the remaining issues, and push the changes. Here you can see the detected issues. Note that the installed ruff version is ruff=0.2.1.

``` warning: The `--show-source` argument is deprecated. Use `--output-format=full` instead. warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `pyproject.toml`: - 'ignore' -> 'lint.ignore' - 'select' -> 'lint.select' - 'per-file-ignores' -> 'lint.per-file-ignores' sklearn/ensemble/_forest.py:604:89: E501 Line too long (112 > 88) | 602 | lock = threading.Lock() 603 | Parallel(n_jobs=self.n_jobs, verbose=self.verbose, require="sharedmem")( 604 | delayed(_accumulate_oob_prediction)(self._get_oob_predictions, e, X, n_samples, n_samples_bootstrap, | ^^^^^^^^^^^^^^^^^^^^^^^^ E501 605 | oob_pred, n_oob_pred, e.random_state, lock) 606 | for e in self.estimators_ | sklearn/ensemble/_forest.py:605:89: E501 Line too long (91 > 88) | 603 | Parallel(n_jobs=self.n_jobs, verbose=self.verbose, require="sharedmem")( 604 | delayed(_accumulate_oob_prediction)(self._get_oob_predictions, e, X, n_samples, n_samples_bootstrap, 605 | oob_pred, n_oob_pred, e.random_state, lock) | ^^^ E501 606 | for e in self.estimators_ 607 | ) | sklearn/ensemble/_forest.py:736:89: E501 Line too long (117 > 88) | 736 | def _accumulate_oob_prediction(predict, tree, X, n_samples, n_samples_bootstrap, out, out_count, random_state, lock): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E501 737 | """ 738 | This is a utility function for joblib's Parallel. | Found 3 errors. ```

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