DummyModelResult

DummyModelResult(self, name='dummy', data=None, strategy='constant')

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 None
name str The name of the model result, by default ‘dummy’ 'dummy'
strategy str The strategy to use, ‘mean’ uses the mean of the observation, ‘constant’ uses the value given in data, by default ‘constant’ 'constant'

Examples

>>> import pandas as pd
>>> import modelskill as ms
>>> df = pd.DataFrame([0.0, 1.0], index=pd.date_range("2000", freq="H", periods=2))
>>> obs = ms.PointObservation(df, 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