Skip to content

Commit

Permalink
fix mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuawe committed Dec 27, 2023
1 parent 160876a commit 37d51a3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.analysis.typeCheckingMode": "basic"
}
4 changes: 2 additions & 2 deletions plotsandgraphs/binary_classifier.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pathlib import Path
from typing import Optional
from typing import Optional, Any, Union
import matplotlib.pyplot as plt
from matplotlib.colors import to_rgba
from matplotlib.figure import Figure
Expand Down Expand Up @@ -469,7 +469,7 @@ def plot_calibration_curve(


def plot_y_score_histogram(
y_true: Optional[np.ndarray], y_score: np.ndarray = None, save_fig_path=None
y_true: Union[np.ndarray[Any, Any], None], y_score: np.ndarray[Any, Any], save_fig_path=None
) -> Figure:
"""
Provides a histogram for the predicted probabilities of a binary classifier. If ```y_true``` is provided, it divides the ```y_score``` values into the two classes and plots them jointly into the same plot with different colors.
Expand Down
4 changes: 2 additions & 2 deletions plotsandgraphs/multiclass_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ def auroc_metric_function(y_true, y_score, average, multi_class):
fig_aurocs.savefig(path, bbox_inches="tight")
# save roc curves plot
if save_fig_path is not None:
path = save_fig_path[0] if split_plots is True else save_fig_path
path = Path(path)
path = save_fig_path[0] if split_plots is True else save_fig_path # type: ignore
path = Path(path) # type: ignore
path.parent.mkdir(parents=True, exist_ok=True)
fig.savefig(path, bbox_inches="tight")
return fig, fig_aurocs
Expand Down
4 changes: 2 additions & 2 deletions plotsandgraphs/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, List, Callable, Dict, Tuple, TYPE_CHECKING
from typing import Optional, List, Callable, Dict, Tuple, TYPE_CHECKING, Any
from tqdm import tqdm
from sklearn.utils import resample
import numpy as np
Expand Down Expand Up @@ -133,7 +133,7 @@ def _set_black_title_box(


def set_black_title_boxes(
axes: "np.ndarray[Axes]",
axes: "np.ndarray[Any, Axes]",
titles: List[str],
backgroundcolor="black",
color="white",
Expand Down

0 comments on commit 37d51a3

Please sign in to comment.