Skip to content

Commit

Permalink
fix(integrations): remove wandb.sklearn.plot_decision_boundaries th…
Browse files Browse the repository at this point in the history
…at contains dead logic (#4348)

remove plot decision_boundaries
  • Loading branch information
kptkin authored and andrewtruong committed Dec 2, 2022
1 parent 9e9d2ad commit e43628c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 69 deletions.
2 changes: 0 additions & 2 deletions wandb/sklearn/__init__.py
Expand Up @@ -5,7 +5,6 @@
plot_classifier,
plot_clusterer,
plot_confusion_matrix,
plot_decision_boundaries,
plot_elbow_curve,
plot_feature_importances,
plot_learning_curve,
Expand All @@ -30,7 +29,6 @@
"plot_roc",
"plot_precision_recall",
"plot_confusion_matrix",
"plot_decision_boundaries",
"plot_elbow_curve",
"plot_silhouette",
"plot_residuals",
Expand Down
2 changes: 0 additions & 2 deletions wandb/sklearn/plot/__init__.py
Expand Up @@ -3,7 +3,6 @@
from .classifier import class_proportions as plot_class_proportions
from .classifier import classifier as plot_classifier
from .classifier import confusion_matrix as plot_confusion_matrix
from .classifier import decision_boundaries as plot_decision_boundaries
from .classifier import feature_importances as plot_feature_importances
from .classifier import precision_recall as plot_precision_recall
from .classifier import roc as plot_roc
Expand All @@ -28,7 +27,6 @@
"plot_roc",
"plot_precision_recall",
"plot_confusion_matrix",
"plot_decision_boundaries",
"plot_elbow_curve",
"plot_silhouette",
"plot_residuals",
Expand Down
65 changes: 0 additions & 65 deletions wandb/sklearn/plot/classifier.py
Expand Up @@ -319,68 +319,3 @@ def calibration_curve(clf=None, X=None, y=None, clf_name="Classifier"):
calibration_curve_chart = calculate.calibration_curves(clf, X, y, clf_name)

wandb.log({"calibration_curve": calibration_curve_chart})


def decision_boundaries(binary_clf=None, X=None, y=None):
"""Visualizes decision boundaries of a binary classifier.
Works by sampling from the feature space where the classifier's uncertainty
if greater than > 0.5 and projecting these point to 2D space.
Useful for measuring model (decision boundary) complexity, visualizing
regions where the model falters, and to determine whether any over or
underfitting occured.
Should only be called with a fitted **binary** classifer (otherwise an error is
thrown). Please note this function fits variations of the model on the
training set when called.
Arguments:
model: (clf) Takes in a fitted binary classifier.
X_train: (arr) Training set features.
y_train: (arr) Training set labels.
Returns:
None: To see plots, go to your W&B run page then expand the 'media' tab
under 'auto visualizations'.
Example:
```python
wandb.sklearn.plot_decision_boundaries(binary_classifier, X, y)
```
"""
if utils.test_missing(binary_clf=binary_clf, X=X, y=y) and utils.test_types(
binary_clf=binary_clf, X=X, y=y
):
y = np.asarray(y)
# plot high-dimensional decision boundary
db = DBPlot(binary_clf)
db = None
db.fit(X, y)
(
decision_boundary_x,
decision_boundary_y,
decision_boundary_color,
train_x,
train_y,
train_color,
test_x,
test_y,
test_color,
) = db.plot()

wandb.log(
{
"decision_boundaries": calculate.decision_boundaries(
decision_boundary_x,
decision_boundary_y,
decision_boundary_color,
train_x,
train_y,
train_color,
test_x,
test_y,
test_color,
)
}
)

0 comments on commit e43628c

Please sign in to comment.