Skip to content

Commit

Permalink
fix: Create Visualizer from a copy of the regressor to prevent update…
Browse files Browse the repository at this point in the history
…s to original regressor
  • Loading branch information
SiddhantSadangi committed Jul 3, 2024
1 parent 6dff9b6 commit 28a6f6c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args: [--settings-path, pyproject.toml]
- repo: https://github.com/psf/black
rev: 22.6.0
rev: 24.4.2
hooks:
- id: black
args: [--config, pyproject.toml]
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## neptune-sklearn 2.1.4

### Fixes
- `create_feature_importance_chart()` now does not update the original coefficients of the regressor ([#29](https://github.com/neptune-ai/neptune-sklearn/pull/29))

## neptune-sklearn 2.1.3

### Fixes
Expand Down
3 changes: 2 additions & 1 deletion src/neptune_sklearn/impl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
)
from neptune.new.utils import stringify_unsupported

from copy import deepcopy
from warnings import warn


Expand Down Expand Up @@ -628,7 +629,7 @@ def create_feature_importance_chart(regressor, X_train, y_train):

try:
fig, ax = plt.subplots()
visualizer = FeatureImportances(regressor, is_fitted=True, ax=ax)
visualizer = FeatureImportances(deepcopy(regressor), is_fitted=True, ax=ax)
visualizer.fit(X_train, y_train)
visualizer.finalize()

Expand Down

0 comments on commit 28a6f6c

Please sign in to comment.