Tuner Tuner

class dffml.tuner.tuner.Tuner(config: Optional[Type[dffml.base.BaseConfig]])[source]

Abstract base class which should be derived from and implemented using various tuners.

CONFIG

alias of dffml.tuner.tuner.TunerConfig

CONTEXT

alias of dffml.tuner.tuner.TunerContext

class dffml.tuner.tuner.TunerConfig[source]
no_enforce_immutable()

By default, all properties of a config object are immutable. If you would like to mutate immutable properties, you must explicitly call this method using it as a context manager.

Examples

>>> from dffml import config
>>>
>>> @config
... class MyConfig:
...     C: int
>>>
>>> config = MyConfig(C=2)
>>> with config.no_enforce_immutable():
...     config.C = 1
class dffml.tuner.tuner.TunerContext(parent: dffml.tuner.tuner.Tuner)[source]
abstract async optimize(model: dffml.model.model.ModelContext, feature: dffml.feature.feature.Feature, accuracy_scorer: dffml.accuracy.accuracy.AccuracyContext, train_data: dffml.source.source.SourcesContext, test_data: dffml.source.source.SourcesContext) float[source]

Abstract method to optimize hyperparameters

Parameters
  • model (ModelContext) – The Model which needs to be used.

  • feature (Feature) – The Target feature in the data.

  • accuracy_scorer (AccuracyContext) – The accuracy scorer that needs to be used.

  • train_data (SourcesContext) – The train_data to train models on, with the hyperparameters provided.

  • sources (SourcesContext) – The test_data to score against and optimize hyperparameters.

Returns

The highest score value(optimized score)

Return type

float