optuna の API リファレンス
optuna (optuna/optuna) の公開 API 188 件 —— クラス 66、関数 31、メソッド 91。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。
リポジトリ: optuna/optuna
| 種別 | 件数 |
|---|---|
| クラス | 66 |
| 関数 | 31 |
| メソッド | 91 |
API 一覧
class
optuna._callbacks.MaxTrialsCallbackSet a maximum number of trials before ending the study.
func
optuna._deprecated.deprecated_class(deprecated_version:str, removed_version:str, name:str | None=None, text:str | None=None) -> 'Callable[[CT], CT]'Decorate class as deprecated.
func
optuna._deprecated.deprecated_func(deprecated_version:str, removed_version:str, name:str | None=None, text:str | None=None) -> 'Callable[[Callable[FP, FT]], Callable[FP, FT]]'Decorate function as deprecated.
func
optuna._deprecated.wrapper(*args:Any, **kwargs:Any) -> 'FT'Decorates a function as deprecated.
func
optuna._experimental.experimental_class(version:str, name:str | None=None) -> Callable[[CT], CT]Decorate class as experimental.
func
optuna._experimental.experimental_func(version:str, name:str | None=None) -> Callable[[Callable[FP, FT]], Callable[FP, FT]]Decorate function as experimental.
func
optuna._hypervolume.wfg.compute_hypervolume(loss_vals:np.ndarray, reference_point:np.ndarray, assume_pareto:bool=False) -> floatHypervolume calculator for any dimension.
class
optuna.artifacts._backoff.BackoffAn artifact store's middleware for exponential backoff.
class
optuna.artifacts._boto3.Boto3ArtifactStoreAn artifact backend for Boto3.
func
optuna.artifacts._download.download_artifact(*artifact_store:ArtifactStore, *file_path:str, *artifact_id:str) -> NoneDownload an artifact from the artifact store.
class
optuna.artifacts._filesystem.FileSystemArtifactStoreAn artifact store for file systems.
class
optuna.artifacts._gcs.GCSArtifactStoreAn artifact backend for Google Cloud Storage (GCS).
class
optuna.artifacts._protocol.ArtifactStoreA protocol defining the interface for an artifact backend.
method
optuna.artifacts._protocol.ArtifactStore.open_reader(artifact_id:str) -> BinaryIOOpen the artifact identified by the artifact_id.
method
optuna.artifacts._protocol.ArtifactStore.remove(artifact_id:str) -> NoneRemove the artifact identified by the artifact_id.
method
optuna.artifacts._protocol.ArtifactStore.write(artifact_id:str, content_body:BinaryIO) -> NoneSave the content to the backend.
class
optuna.artifacts._upload.ArtifactMetaMeta information for an artifact.
class
optuna.artifacts.exceptions.ArtifactNotFoundException raised when an artifact is not found.
class
optuna.distributions.BaseDistributionBase class for distributions.
class
optuna.distributions.CategoricalDistributionA categorical distribution.
class
optuna.distributions.DiscreteUniformDistributionA discretized uniform distribution in the linear domain.
method
optuna.distributions.DiscreteUniformDistribution.q() -> floatDiscretization step.
class
optuna.distributions.FloatDistributionA distribution on floats.
class
optuna.distributions.IntDistributionA distribution on integers.
class
optuna.distributions.IntLogUniformDistributionA uniform distribution on integers in the log domain.
class
optuna.distributions.IntUniformDistributionA uniform distribution on integers.
class
optuna.distributions.LogUniformDistributionA uniform distribution in the log domain.
class
optuna.distributions.UniformDistributionA uniform distribution in the linear domain.
func
optuna.distributions.check_distribution_compatibility(dist_old:BaseDistribution, dist_new:BaseDistribution) -> NoneA function to check compatibility of two distributions.
func
optuna.distributions.distribution_to_json(dist:BaseDistribution) -> strSerialize a distribution to JSON format.
func
optuna.distributions.json_to_distribution(json_str:str) -> BaseDistributionDeserialize a distribution in JSON format.
class
optuna.exceptions.CLIUsageErrorException for CLI.
class
optuna.exceptions.DuplicatedStudyErrorException for a duplicated study name.
class
optuna.exceptions.ExperimentalWarningExperimental Warning class.
class
optuna.exceptions.OptunaErrorBase class for Optuna specific errors.
class
optuna.exceptions.StorageInternalErrorException for storage operation.
class
optuna.exceptions.TrialPrunedException for pruned trials.
class
optuna.exceptions.UpdateFinishedTrialErrorException for updating a finished trial.
class
optuna.importance._base.BaseImportanceEvaluatorAbstract parameter importance evaluator.
class
optuna.importance._fanova._evaluator.FanovaImportanceEvaluatorfANOVA importance evaluator.
class
optuna.importance._ped_anova.evaluator.PedAnovaImportanceEvaluatorPED-ANOVA importance evaluator.
func
optuna.logging.create_default_formatter() -> logging.FormatterCreate a default formatter of log messages.
func
optuna.logging.disable_default_handler() -> NoneDisable the default handler of the Optuna's root logger.
func
optuna.logging.disable_propagation() -> NoneDisable propagation of the library log outputs.
func
optuna.logging.enable_default_handler() -> NoneEnable the default handler of the Optuna's root logger.
func
optuna.logging.enable_propagation() -> NoneEnable propagation of the library log outputs.
func
optuna.logging.get_logger(name:str) -> logging.LoggerReturn a logger with the specified name.
func
optuna.logging.get_verbosity() -> intReturn the current level for the Optuna's root logger.
func
optuna.logging.set_verbosity(verbosity:int) -> NoneSet the level for the Optuna's root logger.
class
optuna.pruners._base.BasePrunerBase class for pruners.
class
optuna.pruners._hyperband.HyperbandPrunerPruner using Hyperband.
class
optuna.pruners._median.MedianPrunerPruner using the median stopping rule.
class
optuna.pruners._nop.NopPrunerPruner which never prunes trials.
class
optuna.pruners._patient.PatientPrunerPruner which wraps another pruner with tolerance.
class
optuna.pruners._percentile.PercentilePrunerPruner to keep the specified percentile of the trials.
class
optuna.pruners._successive_halving.SuccessiveHalvingPrunerPruner using Asynchronous Successive Halving Algorithm.
class
optuna.pruners._threshold.ThresholdPrunerPruner to detect outlying metrics of the trials.
class
optuna.samplers._base.BaseSamplerBase class for samplers.
method
optuna.samplers._base.BaseSampler.after_trial(study:Study, trial:FrozenTrial, state:TrialState, values:Sequence[float] | None) -> NoneTrial post-processing.
method
optuna.samplers._base.BaseSampler.before_trial(study:Study, trial:FrozenTrial) -> NoneTrial pre-processing.
method
optuna.samplers._base.BaseSampler.reseed_rng() -> NoneReseed sampler's random number generator.
method
optuna.samplers._base.BaseSampler.sample_independent(study:Study, trial:FrozenTrial, param_name:str, param_distribution:BaseDistribution) -> AnySample a parameter for a given distribution.
method
optuna.samplers._base.BaseSampler.sample_relative(study:Study, trial:FrozenTrial, search_space:dict[str, BaseDistribution]) -> dict[str, Any]Sample parameters in a given search space.
class
optuna.samplers._ga._base.BaseGASamplerBase class for Genetic Algorithm (GA) samplers.
method
optuna.samplers._ga._base.BaseGASampler.get_parent_population(study:Study, generation:int) -> list[FrozenTrial]Get the parent population of the given generation.
method
optuna.samplers._ga._base.BaseGASampler.get_population(study:Study, generation:int) -> list[FrozenTrial]Get the population of the given generation.
method
optuna.samplers._ga._base.BaseGASampler.get_trial_generation(study:Study, trial:FrozenTrial) -> intGet the generation number of the given trial.
class
optuna.samplers._gp.sampler.GPSamplerSampler using Gaussian process-based Bayesian optimization.
class
optuna.samplers._lazy_random_state.LazyRandomStateLazy Random State class.
class
optuna.samplers._nsgaiii._sampler.NSGAIIISamplerMulti-objective sampler using the NSGA-III algorithm.
class
optuna.samplers._partial_fixed.PartialFixedSamplerSampler with partially fixed parameters.
class
optuna.samplers._random.RandomSamplerSampler using random sampling.
class
optuna.samplers.nsgaii._crossovers._base.BaseCrossoverBase class for crossovers.
class
optuna.samplers.nsgaii._mutations._base.BaseMutationBase class for mutations.
method
optuna.samplers.nsgaii._mutations._base.BaseMutation.mutation(param:float, rng:np.random.RandomState, study:Study, search_space_bounds:np.ndarray) -> floatMutate the given parameter.
class
optuna.samplers.nsgaii._sampler.NSGAIISamplerMulti-objective sampler using the NSGA-II algorithm.
class
optuna.storages._base.BaseStorageBase class for storages.
method
optuna.storages._base.BaseStorage.check_trial_is_updatable(trial_id:int, trial_state:TrialState) -> NoneCheck whether a trial state is updatable.
method
optuna.storages._base.BaseStorage.create_new_study(directions:Sequence[StudyDirection], study_name:str | None=None) -> intCreate a new study from a name.
method
optuna.storages._base.BaseStorage.create_new_trial(study_id:int, template_trial:FrozenTrial | None=None) -> intCreate and add a new trial to a study.
method
optuna.storages._base.BaseStorage.delete_study(study_id:int) -> NoneDelete a study.
method
optuna.storages._base.BaseStorage.get_all_trials(study_id:int, deepcopy:bool=True, states:Container[TrialState] | None=None) -> list[FrozenTrial]Read all trials in a study.
method
optuna.storages._base.BaseStorage.get_best_trial(study_id:int) -> FrozenTrialReturn the trial with the best value in a study.
method
optuna.storages._base.BaseStorage.get_n_trials(study_id:int, state:tuple[TrialState, ...] | TrialState | None=None) -> intCount the number of trials in a study.
method
optuna.storages._base.BaseStorage.get_study_directions(study_id:int) -> list[StudyDirection]Read whether a study maximizes or minimizes an objective.
method
optuna.storages._base.BaseStorage.get_study_id_from_name(study_name:str) -> intRead the ID of a study.
method
optuna.storages._base.BaseStorage.get_study_name_from_id(study_id:int) -> strRead the study name of a study.
method
optuna.storages._base.BaseStorage.get_study_system_attrs(study_id:int) -> dict[str, Any]Read the optuna-internal attributes of a study.
method
optuna.storages._base.BaseStorage.get_study_user_attrs(study_id:int) -> dict[str, Any]Read the user-defined attributes of a study.
method
optuna.storages._base.BaseStorage.get_trial(trial_id:int) -> FrozenTrialRead a trial.
method
optuna.storages._base.BaseStorage.get_trial_id_from_study_id_trial_number(study_id:int, trial_number:int) -> intRead the trial ID of a trial.
method
optuna.storages._base.BaseStorage.get_trial_number_from_id(trial_id:int) -> intRead the trial number of a trial.
method
optuna.storages._base.BaseStorage.get_trial_param(trial_id:int, param_name:str) -> floatRead the parameter of a trial.
method
optuna.storages._base.BaseStorage.get_trial_params(trial_id:int) -> dict[str, Any]Read the parameter dictionary of a trial.
method
optuna.storages._base.BaseStorage.get_trial_system_attrs(trial_id:int) -> dict[str, Any]Read the optuna-internal attributes of a trial.
method
optuna.storages._base.BaseStorage.get_trial_user_attrs(trial_id:int) -> dict[str, Any]Read the user-defined attributes of a trial.
method
optuna.storages._base.BaseStorage.remove_session() -> NoneClean up all connections to a database.
method
optuna.storages._base.BaseStorage.set_study_system_attr(study_id:int, key:str, value:JSONSerializable) -> NoneRegister an optuna-internal attribute to a study.
method
optuna.storages._base.BaseStorage.set_study_user_attr(study_id:int, key:str, value:Any) -> NoneRegister a user-defined attribute to a study.
method
optuna.storages._base.BaseStorage.set_trial_intermediate_value(trial_id:int, step:int, intermediate_value:float) -> NoneReport an intermediate value of an objective function.
method
optuna.storages._base.BaseStorage.set_trial_param(trial_id:int, param_name:str, param_value_internal:float, distribution:BaseDistribution) -> NoneSet a parameter to a trial.
method
optuna.storages._base.BaseStorage.set_trial_state_values(trial_id:int, state:TrialState, values:Sequence[float] | None=None) -> boolUpdate the state and values of a trial.
method
optuna.storages._base.BaseStorage.set_trial_system_attr(trial_id:int, key:str, value:JSONSerializable) -> NoneSet an optuna-internal attribute to a trial.
method
optuna.storages._base.BaseStorage.set_trial_user_attr(trial_id:int, key:str, value:Any) -> NoneSet a user-defined attribute to a trial.
class
optuna.storages._heartbeat.BaseHeartbeatBase class for heartbeat.
method
optuna.storages._heartbeat.BaseHeartbeat.get_heartbeat_interval() -> int | NoneGet the heartbeat interval if it is set.
method
optuna.storages._heartbeat.BaseHeartbeat.record_heartbeat(trial_id:int) -> NoneRecord the heartbeat of the trial.
func
optuna.storages._heartbeat.fail_stale_trials(study:'optuna.Study') -> NoneFail stale trials and run their failure callbacks.
func
optuna.storages._heartbeat.is_heartbeat_enabled(storage:BaseStorage) -> boolCheck whether the storage enables the heartbeat.
func
optuna.storages._rdb.alembic.env.run_migrations_offline()Run migrations in 'offline' mode.
func
optuna.storages._rdb.alembic.env.run_migrations_online()Run migrations in 'online' mode.
class
optuna.storages._rdb.storage.RDBStorageStorage class for RDB backend.
method
optuna.storages._rdb.storage.RDBStorage.get_all_versions() -> list[str]Return the schema version list.
method
optuna.storages._rdb.storage.RDBStorage.get_head_version() -> strReturn the latest schema version.
method
optuna.storages._rdb.storage.RDBStorage.remove_session() -> NoneRemoves the current session.
method
optuna.storages._rdb.storage.RDBStorage.upgrade() -> NoneUpgrade the storage schema.
func
optuna.storages.get_storage(storage:None | str | BaseStorage) -> BaseStorageOnly for internal usage.
class
optuna.storages.journal._base.BaseJournalBackendBase class for Journal storages.
method
optuna.storages.journal._base.BaseJournalBackend.append_logs(logs:list[dict[str, Any]]) -> NoneAppend logs to the backend.
class
optuna.storages.journal._base.BaseJournalLogStorageBase class for Journal storages.
class
optuna.storages.journal._base.BaseJournalSnapshotOptional base class for Journal storages.
method
optuna.storages.journal._base.BaseJournalSnapshot.load_snapshot() -> bytes | NoneLoad snapshot from the backend.
method
optuna.storages.journal._base.BaseJournalSnapshot.save_snapshot(snapshot:bytes) -> NoneSave snapshot to the backend.
class
optuna.storages.journal._file.JournalFileBackendFile storage class for Journal log backend.
method
optuna.storages.journal._file.JournalFileOpenLock.release() -> NoneRelease a lock by removing the created file.
method
optuna.storages.journal._file.JournalFileSymlinkLock.release() -> NoneRelease a lock by removing the symbolic link.
class
optuna.storages.journal._redis.JournalRedisBackendRedis storage class for Journal log backend.
class
optuna.storages.journal._storage.JournalStorageStorage class for Journal storage backend.
class
optuna.study._frozen.FrozenStudyBasic attributes of a :class:`~optuna.study.Study`.
class
optuna.study._study_direction.StudyDirectionDirection of a :class:`~optuna.study.Study`.
method
optuna.study.study.Study.add_trial(trial:FrozenTrial) -> NoneAdd trial to study.
method
optuna.study.study.Study.add_trials(trials:Iterable[FrozenTrial]) -> NoneAdd trials to study.
method
optuna.study.study.Study.best_params() -> dict[str, Any]Return parameters of the best trial in the study.
method
optuna.study.study.Study.best_trial() -> FrozenTrialReturn the best trial in the study.
method
optuna.study.study.Study.best_trials() -> list[FrozenTrial]Return trials located at the Pareto front in the study.
method
optuna.study.study.Study.best_value() -> floatReturn the best objective value in the study.
method
optuna.study.study.Study.direction() -> StudyDirectionReturn the direction of the study.
method
optuna.study.study.Study.directions() -> list[StudyDirection]Return the directions of the study.
method
optuna.study.study.Study.enqueue_trial(params:dict[str, Any], user_attrs:dict[str, Any] | None=None, skip_if_exists:bool=False) -> NoneEnqueue a trial with given parameter values.
method
optuna.study.study.Study.get_trials(deepcopy:bool=True, states:Container[TrialState] | None=None) -> list[FrozenTrial]Return all trials in the study.
method
optuna.study.study.Study.metric_names() -> list[str] | NoneReturn metric names.
method
optuna.study.study.Study.set_metric_names(metric_names:list[str]) -> NoneSet metric names.
method
optuna.study.study.Study.set_system_attr(key:str, value:Any) -> NoneSet a system attribute to the study.
method
optuna.study.study.Study.set_user_attr(key:str, value:Any) -> NoneSet a user attribute to the study.
method
optuna.study.study.Study.system_attrs() -> dict[str, Any]Return system attributes.
method
optuna.study.study.Study.trials() -> list[FrozenTrial]Return all trials in the study.
method
optuna.study.study.Study.user_attrs() -> dict[str, Any]Return user attributes.
func
optuna.study.study.copy_study(*from_study_name:str, *from_storage:str | storages.BaseStorage, *to_storage:str | storages.BaseStorage, *to_study_name:str | None=None) -> NoneCopy study from one storage to another.
func
optuna.study.study.delete_study(*study_name:str, *storage:str | storages.BaseStorage) -> NoneDelete a :class:`~optuna.study.Study` object.
func
optuna.study.study.get_all_study_names(storage:str | storages.BaseStorage) -> list[str]Get all study names stored in a specified storage.
class
optuna.terminator.erroreval.BaseErrorEvaluatorBase class for error evaluators.
class
optuna.terminator.erroreval.StaticErrorEvaluatorAn error evaluator that always returns a constant value.
func
optuna.terminator.erroreval.report_cross_validation_scores(trial:Trial, scores:list[float]) -> NoneA function to report cross-validation scores of a trial.
class
optuna.terminator.improvement.evaluator.BaseImprovementEvaluatorBase class for improvement evaluators.
class
optuna.terminator.terminator.BaseTerminatorBase class for terminators.
class
optuna.terminator.terminator.TerminatorAutomatic stopping mechanism for Optuna studies.
class
optuna.trial._base.BaseTrialBase class for trials.
class
optuna.trial._fixed.FixedTrialA trial class which suggests a fixed value for each parameter.
method
optuna.trial._fixed.FixedTrial.constraints() -> dict[str, float]Returns constraint values.
method
optuna.trial._fixed.FixedTrial.set_constraint(key:str, value:float) -> NoneSet a constraint value for the trial.
class
optuna.trial._frozen.FrozenTrialStatus and results of a :class:`~optuna.trial.Trial`.
method
optuna.trial._frozen.FrozenTrial.constraints() -> dict[str, float]Returns constraint values.
method
optuna.trial._frozen.FrozenTrial.duration() -> datetime.timedelta | NoneReturn the elapsed time taken to complete the trial.
method
optuna.trial._frozen.FrozenTrial.report(value:float, step:int) -> NoneInterface of report function.
method
optuna.trial._frozen.FrozenTrial.set_constraint(key:str, value:float) -> NoneSet a constraint value for the trial.
method
optuna.trial._frozen.FrozenTrial.should_prune() -> boolSuggest whether the trial should be pruned or not.
class
optuna.trial._state.TrialStateState of a :class:`~optuna.trial.Trial`.
class
optuna.trial._trial.TrialA trial is a process of evaluating an objective function.
method
optuna.trial._trial.Trial.constraints() -> dict[str, float]Returns constraint values.
method
optuna.trial._trial.Trial.datetime_start() -> datetime.datetime | NoneReturn start datetime.
method
optuna.trial._trial.Trial.distributions() -> dict[str, BaseDistribution]Return distributions of parameters to be optimized.
method
optuna.trial._trial.Trial.params() -> dict[str, Any]Return parameters to be optimized.
method
optuna.trial._trial.Trial.report(value:float, step:int) -> NoneReport an objective function value for a given step.
method
optuna.trial._trial.Trial.set_constraint(key:str, value:float) -> NoneSet a constraint value for the trial.
method
optuna.trial._trial.Trial.set_system_attr(key:str, value:Any) -> NoneSet system attributes to the trial.
method
optuna.trial._trial.Trial.set_user_attr(key:str, value:Any) -> NoneSet user attributes to the trial.
method
optuna.trial._trial.Trial.should_prune() -> boolSuggest whether the trial should be pruned or not.
method
optuna.trial._trial.Trial.suggest_discrete_uniform(name:str, low:float, high:float, q:float) -> floatSuggest a value for the discrete parameter.
method
optuna.trial._trial.Trial.suggest_float(name:str, low:float, high:float, *step:float | None=None, *log:bool=False) -> floatSuggest a value for the floating point parameter.
method
optuna.trial._trial.Trial.suggest_int(name:str, low:int, high:int, *step:int=1, *log:bool=False) -> intSuggest a value for the integer parameter.
method
optuna.trial._trial.Trial.suggest_loguniform(name:str, low:float, high:float) -> floatSuggest a value for the continuous parameter.
method
optuna.trial._trial.Trial.suggest_uniform(name:str, low:float, high:float) -> floatSuggest a value for the continuous parameter.
method
optuna.trial._trial.Trial.system_attrs() -> dict[str, Any]Return system attributes.
method
optuna.trial._trial.Trial.user_attrs() -> dict[str, Any]Return user attributes.
func
optuna.visualization._hypervolume_history.plot_hypervolume_history(study:Study, reference_point:Sequence[float]) -> 'go.Figure'Plot hypervolume history of all trials in a study.
func
optuna.visualization._intermediate_values.plot_intermediate_values(study:Study) -> 'go.Figure'Plot intermediate values of all trials in a study.
func
optuna.visualization._timeline.plot_timeline(study:Study, n_recent_trials:int | None=None) -> 'go.Figure'Plot the timeline of a study.
func
optuna.visualization.matplotlib._timeline.plot_timeline(study:Study, n_recent_trials:int | None=None) -> 'Axes'Plot the timeline of a study.
この情報について
掲載しているシグネチャは optuna/optuna の公開ソースコードを
Python の ast モジュールで静的解析し、引数名・デフォルト値・
型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。
詳しくは仕組みの解説をご覧ください。