Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Add support for PreferentialStudy in study type validation #418

Merged
merged 1 commit into from
Mar 13, 2025
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
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"HITL",
"hovertemplate",
"Hyperband",
"isinstance",
"libpython",
"rhinocode",
"showlegend",
Expand Down
5 changes: 3 additions & 2 deletions Optuna/Study/StudyWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ public StudyWrapper(dynamic study)
PyInstance = study;

dynamic optuna = Py.Import("optuna");
dynamic dashboard = Py.Import("optuna_dashboard");
dynamic py = Py.Import("builtins");
if (!py.isinstance(study, optuna.study.Study))
if (!py.isinstance(study, optuna.study.Study) && !py.isinstance(study, dashboard.preferential.PreferentialStudy))
{
throw new ArgumentException("study must be an instance of optuna.study.Study.");
throw new ArgumentException("study must be an instance of optuna.study.Study or optuna_dashboard.preferential.PreferentialStudy.");
}
}

Expand Down
Loading