DummyModelResult
modelskill.DummyModelResult
dataclass
Source code in modelskill/model/dummy.py
strategy
class-attribute
instance-attribute
Dummy model result that always returns the same value.
Similar in spirit to https://scikit-learn.org/stable/modules/generated/sklearn.dummy.DummyRegressor.html
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
float
|
The value to return if strategy is 'constant', by default None |
required |
name |
str
|
The name of the model result, by default 'dummy' |
required |
strategy |
str
|
The strategy to use, 'mean' uses the mean of the observation, 'constant' uses the value given in data, by default 'constant' |
required |
Examples:
>>> import pandas as pd
>>> import modelskill as ms
>>> obs = ms.PointObservation(pd.DataFrame([0.0, 1.0], index=pd.date_range("2000", freq="H", periods=2)), name="foo")
>>> mr = ms.DummyModelResult(strategy='mean')
>>> pmr = mr.extract(obs)
>>> pmr.to_dataframe()
dummy
time
2000-01-01 00:00:00 0.5
2000-01-01 01:00:00 0.5