Skip to content

Commit f3b742b

Browse files
committed
fix warnings
1 parent d323de9 commit f3b742b

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

octopus/modules/octo/core.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import copy
6+
import warnings
67
from typing import TYPE_CHECKING
78

89
import optuna
@@ -353,13 +354,16 @@ def _run_globalhp_optimization(
353354
)
354355

355356
# multivariate sampler with group option
356-
sampler = optuna.samplers.TPESampler(
357-
multivariate=True,
358-
group=True,
359-
constant_liar=True,
360-
seed=self.config.optuna_seed,
361-
n_startup_trials=self.config.n_optuna_startup_trials,
362-
)
357+
# Suppress ExperimentalWarning — these parameters have been stable for 3+ years
358+
with warnings.catch_warnings():
359+
warnings.filterwarnings("ignore", category=optuna.exceptions.ExperimentalWarning)
360+
sampler = optuna.samplers.TPESampler(
361+
multivariate=True,
362+
group=True,
363+
constant_liar=True,
364+
seed=self.config.optuna_seed,
365+
n_startup_trials=self.config.n_optuna_startup_trials,
366+
)
363367

364368
# create study with in-memory storage
365369
study = optuna.create_study(

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,10 @@ testpaths = ["tests"]
216216
markers = ["slow: mark test as slow.", "windows: mark test to run in windows."]
217217
addopts = ["--cov=octopus", "--durations=15"]
218218
tmp_path_retention_policy = "none"
219+
filterwarnings = [
220+
"default",
221+
# Ray: unclosed file handles in node management (third-party bug)
222+
"ignore::ResourceWarning:ray",
223+
# Ray subprocess cleanup (third-party)
224+
"ignore:subprocess.*is still running:ResourceWarning",
225+
]

tests/study/test_validator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ def test_validate_error_accumulation(validator_factory, sample_data):
195195
"""Test that validate() accumulates multiple errors."""
196196
data_with_issues = sample_data.copy()
197197
data_with_issues["datasplit_group"] = 0
198+
# Cast to object first to allow mixed types — direct assignment of a string
199+
# into a float64 column is deprecated in pandas 2.x and will raise in a future version.
200+
data_with_issues["feature1"] = data_with_issues["feature1"].astype(object)
198201
data_with_issues.loc[0, "feature1"] = "invalid_string" # This will fail dtype validation
199202

200203
validator = validator_factory(

0 commit comments

Comments
 (0)