Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ def compute_deterministic(
)

metrics: MetricsDict = {}
metrics["num_predicted_peaks"] = cm.true_positives.sum() + cm.false_positives.sum()
metrics["num_true_peaks"] = cm.true_positives.sum() + cm.false_negatives.sum()
metrics["num_predicted_peaks"] = int(cm.true_positives.sum() + cm.false_positives.sum())
metrics["num_true_peaks"] = int(cm.true_positives.sum() + cm.false_negatives.sum())
peak_pr = precision_recall(cm, effective=False)
effective_pr = precision_recall(cm, effective=True)
metrics["precision"], metrics["recall"] = peak_pr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class LinearComponentSplitter(ComponentSplitter):
... components=[EnergyComponentType.SOLAR, EnergyComponentType.WIND, EnergyComponentType.OTHER],
... )
>>> splitter = LinearComponentSplitter(config)
>>> components = splitter.predict(time_series_data) # doctest: +SKIP
>>> components = splitter.predict(time_series_data) # doctest: +SKIP
"""

_config: LinearComponentSplitterConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def model_post_init(self, _context: object, /) -> None:
# Boosting structure control
feature_selector=self.hyperparams.feature_selector,
updater=self.hyperparams.updater,
quantile_alpha=[float(q) for q in self.quantiles],
quantile_alpha=sorted([float(q) for q in self.quantiles]),
top_k=self.hyperparams.top_k if self.hyperparams.feature_selector == "thrifty" else None,
# Objective
objective=get_objective_function(function_type=self.hyperparams.objective, quantiles=self.quantiles)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Designed to work with scikit-learn compatible regressors that support quantile regression.
"""

import inspect
import logging

import numpy as np
Expand Down Expand Up @@ -89,15 +90,27 @@ def fit(

for model in self._models:
# Check if early stopping is supported
# Check that eval_set is supported
if eval_set is None and "early_stopping_rounds" in self.hyperparams:
model.set_params(early_stopping_rounds=None)

if eval_set is not None and self.learner_eval_sample_weight_param is not None:
kwargs["eval_set"] = [
(x_array if eval_x is X else np.asarray(eval_x), eval_y) for eval_x, eval_y in eval_set
]
kwargs[self.learner_eval_sample_weight_param] = eval_sample_weight
fit_signature = inspect.signature(getattr(model, "fit")) # noqa: B009
has_eval_x_param = "eval_X" in fit_signature.parameters

if has_eval_x_param:
# Extract X and y from eval_set tuples for LightGBM
eval_x_data = tuple((x_array if eval_x is X else np.asarray(eval_x)) for eval_x, _ in eval_set)
eval_y_data = tuple(eval_y for _, eval_y in eval_set)
kwargs["eval_X"] = eval_x_data
kwargs["eval_y"] = eval_y_data
kwargs["eval_sample_weight"] = eval_sample_weight
else:
# XGBoost uses eval_set
kwargs["eval_set"] = [
(x_array if eval_x is X else np.asarray(eval_x), eval_y) for eval_x, eval_y in eval_set
]
kwargs[self.learner_eval_sample_weight_param] = eval_sample_weight

if "early_stopping_rounds" in self.hyperparams:
model.set_params(early_stopping_rounds=self.hyperparams["early_stopping_rounds"])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
(date(2025, 4, 26), "King's Day", "king_s_day"),
(date(2025, 5, 5), "Liberation Day", "liberation_day"),
(date(2025, 5, 29), "Ascension Day", "ascension_day"),
(date(2025, 6, 8), "Whit Sunday", "whit_sunday"),
(date(2025, 6, 9), "Whit Monday", "whit_monday"),
(date(2025, 6, 8), "Pentecost", "pentecost"),
(date(2025, 6, 9), "Pentecost Monday", "pentecost_monday"),
(date(2025, 12, 25), "Christmas Day", "christmas_day"),
(date(2025, 12, 26), "Second Day of Christmas", "second_day_of_christmas"),
]
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ ini_options.filterwarnings = [
# that Python cannot propagate. Scope the ignore to CPython's fixed ctypes-callback
# wording so genuine unraisable exceptions still fail.
"ignore:.*Exception ignored on calling ctypes callback function.*:pytest.PytestUnraisableExceptionWarning",
# joblib upstream: NumPy 2.5+ deprecated array.shape assignment. joblib 1.5.3 uses this
# in its unpickling code and cannot be fixed without upgrading joblib (not yet available).
"ignore:.*Setting the shape on a NumPy array has been deprecated.*:DeprecationWarning:joblib",
# Ignore fork() deprecation warning from multiprocessing on macOS
# This warning occurs when pytest (multi-threaded) spawns processes using fork()
# Using spawn instead breaks test infrastructure (fixtures not picklable)
Expand Down
12 changes: 6 additions & 6 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading