Skip to content

Commit fedc1bc

Browse files
committed
Release v0.1.6
1 parent b5b69c8 commit fedc1bc

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

fastwoe/fastwoe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ def fit(
697697
self.is_multiclass_target = None
698698

699699
self.is_continuous_target = bool(is_continuous)
700-
self.is_binary_target = is_binary
700+
self.is_binary_target = bool(is_binary)
701701
self.is_multiclass_target = bool(is_multiclass)
702702

703703
# Update encoder_kwargs based on target type
@@ -1730,7 +1730,7 @@ def _bin_with_tree(
17301730
# Bin the non-missing values
17311731
col_data = X_fit[col]
17321732
if hasattr(col_data, "values"):
1733-
col_values = col_data.values
1733+
col_values = np.asarray(col_data.values, dtype=float)
17341734
else:
17351735
col_values = np.array(col_data)
17361736
# Custom binning logic to handle right-inclusive intervals correctly

fastwoe/logging_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
logging across the entire codebase.
66
"""
77

8+
from typing import Any
9+
810
_HAS_LOGGING = False
911

1012
try:
@@ -22,7 +24,7 @@ def _noop(self, *args, **kwargs):
2224

2325
info = debug = warning = error = critical = _noop
2426

25-
logger = _NullLogger()
27+
logger: Any = _NullLogger() # type: ignore[assignment, no-redef]
2628

2729

2830
def setup_logger(level: str = "INFO") -> None:

fastwoe/plots.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@
1616
if TYPE_CHECKING:
1717
from matplotlib import pyplot as plt
1818
from matplotlib.axes import Axes
19+
from matplotlib.figure import Figure
1920
else:
2021
# Runtime import - needed for actual plotting
2122
try:
2223
from matplotlib import pyplot as plt # noqa: F401
2324
from matplotlib.axes import Axes # noqa: F401
25+
from matplotlib.figure import Figure # noqa: F401
2426
except ImportError:
2527
plt = None # type: ignore[assignment]
2628
Axes = Any # type: ignore[assignment, misc]
29+
Figure = Any # type: ignore[assignment, misc]
2730

2831
from .metrics import somersd_yx
2932

@@ -134,7 +137,11 @@ def plot_performance(
134137
fig, ax1 = plt.subplots(1, 1, figsize=figsize, dpi=dpi)
135138
else:
136139
ax1 = ax
137-
fig = ax1.get_figure()
140+
fig_raw = ax1.get_figure()
141+
if fig_raw is None:
142+
raise ValueError("Could not get figure from axes")
143+
# Type narrowing for matplotlib figure
144+
fig = fig_raw # type: ignore[assignment, no-redef]
138145

139146
# CAP curve for binary and continuous targets
140147
n = len(y_true)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ dev = [
172172
"seaborn>=0.11.0",
173173
"rich>=13.7.0", # Required for pretty printing
174174
"ty>=0.0.1a21",
175+
"mypy>=1.11.0", # Type checker
175176
"faiss-cpu>=1.12.0", # Required for FAISS tests
176177
"pandas-stubs>=2.0.0", # Type stubs for pandas (for mypy/type checking)
177178
]

0 commit comments

Comments
 (0)