teehr.DeterministicMetrics#

class teehr.DeterministicMetrics[source]#

Bases: object

Define and customize determinisitic metrics.

Notes

Deterministic metrics compare two timeseries, typically primary (“observed”) vs. secondary (“modeled”) values. Available metrics include:

  • AnnualPeakRelativeBias

  • KlingGuptaEfficiency

  • KlingGuptaEfficiencyMod1

  • KlingGuptaEfficiencyMod2

  • MaxValueDelta

  • MaxValueTimeDelta

  • MeanError

  • MeanAbsoluteError

  • MeanAbsoluteRelativeError

  • MeanSquareError

  • MultiplicativeBias

  • PearsonCorrelation

  • NashSutcliffeEfficiency

  • NormalizedNashSutcliffeEfficiency

  • RelativeBias

  • RootMeanSquareError

  • Rsquared

  • SpearmanCorrelation

  • RootMeanStandardDeviationRatio

Methods

class AnnualPeakRelativeBias(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'annual_peak_flow_bias', func: ~typing.Callable = <function annual_peak_relative_bias>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value', 'value_time'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Annual Peak Relative Bias', 'optimal_value': None, 'short_name': 'annual_peak_relative_bias', 'value_range': None})#

Bases: DeterministicBasemodel

Annual Peak Relative Bias.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “annual_peak_relative_bias”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.annual_peak_relative_bias().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”, “value_time”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class KlingGuptaEfficiency(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'kling_gupta_efficiency', func: ~typing.Callable = <function kling_gupta_efficiency>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Kling-Gupta Efficiency - original', 'optimal_value': 1.0, 'short_name': 'KGE', 'value_range': [0.0, 1.0]})#

Bases: DeterministicBasemodel

Kling-Gupta Efficiency.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “kling_gupta_efficiency”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.kling_gupta_efficiency().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class KlingGuptaEfficiencyMod1(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'kling_gupta_efficiency_mod1', func: ~typing.Callable = <function kling_gupta_efficiency_mod1>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Kling-Gupta Efficiency - modified 1 (2012)', 'optimal_value': 1.0, 'short_name': 'KGE_mod1', 'value_range': [0.0, 1.0]})#

Bases: DeterministicBasemodel

Kling-Gupta Efficiency - modified 1 (2012).

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “kling_gupta_efficiency_mod1”.

  • func (Callable) – The function to apply to the data, by default kling_gupta_efficiency_mod1().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class KlingGuptaEfficiencyMod2(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'kling_gupta_efficiency_mod2', func: ~typing.Callable = <function kling_gupta_efficiency_mod2>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Kling-Gupta Efficiency - modified 2 (2021)', 'optimal_value': 1.0, 'short_name': 'KGE_mod2', 'value_range': [0.0, 1.0]})#

Bases: DeterministicBasemodel

Kling-Gupta Efficiency - modified 2 (2021).

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “kling_gupta_efficiency_mod2”.

  • func (Callable) – The function to apply to the data, by default kling_gupta_efficiency_mod2().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class MaxValueDelta(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'max_value_delta', func: ~typing.Callable = <function max_value_delta>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Max Value Delta', 'optimal_value': None, 'short_name': 'max_value_delta', 'value_range': None})#

Bases: DeterministicBasemodel

Max Value Delta.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “max_value_delta”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.max_value_delta().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class MaxValueTimeDelta(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'max_value_time_delta', func: ~typing.Callable = <function max_value_timedelta>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value', 'value_time'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Max Value Time Delta', 'optimal_value': None, 'short_name': 'max_value_time_delta', 'units': 'seconds', 'value_range': None})#

Bases: DeterministicBasemodel

Max Value Time Delta.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “max_value_timedelta”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.max_value_timedelta().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”, “value_time”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class MeanAbsoluteError(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'mean_absolute_error', func: ~typing.Callable = <function mean_absolute_error>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Mean Absolute Error', 'optimal_value': 0.0, 'short_name': 'MAE', 'value_range': None})#

Bases: DeterministicBasemodel

Mean Absolute Error.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “mean_absolute_error”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.mean_absolute_error().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class MeanAbsoluteRelativeError(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'mean_absolute_relative_error', func: ~typing.Callable = <function mean_absolute_relative_error>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Mean Absolute Relative Error', 'optimal_value': 0.0, 'short_name': 'RelMAE', 'value_range': None})#

Bases: DeterministicBasemodel

Relative Mean Absolute Error.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “mean_absolute_relative_error”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.mean_absolute_relative_error().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class MeanError(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'mean_error', func: ~typing.Callable = <function mean_error>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Mean Error', 'optimal_value': 0.0, 'short_name': 'ME', 'value_range': None})#

Bases: DeterministicBasemodel

Mean Error.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “mean_error”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.mean_error.()

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class MeanSquareError(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'mean_square_error', func: ~typing.Callable = <function mean_squared_error>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Mean Square Error', 'optimal_value': 0.0, 'short_name': 'MSE', 'value_range': None})#

Bases: DeterministicBasemodel

Mean Square Error.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “mean_squared_error”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.mean_squared_error().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class MultiplicativeBias(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'multiplicative_bias', func: ~typing.Callable = <function multiplicative_bias>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Multiplicative Bias', 'optimal_value': 1.0, 'short_name': 'MultBias', 'value_range': None})#

Bases: DeterministicBasemodel

Multiplicative Bias.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “multiplicative_bias”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.multiplicative_bias.()

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class NashSutcliffeEfficiency(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'nash_sutcliffe_efficiency', func: ~typing.Callable = <function nash_sutcliffe_efficiency>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Nash-Sutcliffe Efficiency', 'optimal_value': 1.0, 'short_name': 'NSE', 'value_range': [None, 1.0]})#

Bases: DeterministicBasemodel

Nash-Sutcliffe Efficiency.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “nash_sutcliffe_efficiency”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.nash_sutcliffe_efficiency().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class NormalizedNashSutcliffeEfficiency(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'nash_sutcliffe_efficiency_normalized', func: ~typing.Callable = <function nash_sutcliffe_efficiency_normalized>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Normalized Nash-Sutcliffe Efficiency', 'optimal_value': 1.0, 'short_name': 'NNSE', 'value_range': [0.0, 1.0]})#

Bases: DeterministicBasemodel

Normalized Nash-Sutcliffe Efficiency.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “nash_sutcliffe_efficiency_normalized”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.nash_sutcliffe_efficiency_normalized().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class PearsonCorrelation(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'pearson_correlation', func: ~typing.Callable = <function pearson_correlation>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Pearson Correlation', 'optimal_value': 1.0, 'short_name': 'r', 'value_range': [-1.0, 1.0]})#

Bases: DeterministicBasemodel

Pearson Correlation.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “pearson_correlation”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.pearson_correlation().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RelativeBias(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'relative_bias', func: ~typing.Callable = <function relative_bias>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Relative Bias', 'optimal_value': 0.0, 'short_name': 'RelBias', 'value_range': None})#

Bases: DeterministicBasemodel

Relative Bias.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “relative_bias”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.relative_bias().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RootMeanSquareError(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'root_mean_square_error', func: ~typing.Callable = <function root_mean_squared_error>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Root Mean Square Error', 'optimal_value': 0.0, 'short_name': 'RMSE', 'value_range': None})#

Bases: DeterministicBasemodel

Root Mean Squared Error.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “root_mean_square_error”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.root_mean_square_error().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RootMeanStandardDeviationRatio(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'root_mean_standard_deviation_ratio', func: ~typing.Callable = <function root_mean_standard_deviation_ratio>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Root Mean Standard Deviation Ratio', 'optimal_value': 0.0, 'short_name': 'root_mean_standard_deviation_ratio', 'value_range': [0.0, None]})#

Bases: DeterministicBasemodel

Root Mean Standard Deviation Ratio.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “root_mean_standard_deviation_ratio”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.root_mean_standard_deviation_ratio().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class Rsquared(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'r_squared', func: ~typing.Callable = <function r_squared>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Coefficient of Determination', 'optimal_value': 1.0, 'short_name': 'r2', 'value_range': [0.0, 1.0]})#

Bases: DeterministicBasemodel

Coefficient of Determination.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “r_squared”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.r_squared().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class SpearmanCorrelation(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = 'float', unpack_results: bool = False, unpack_function: ~typing.Callable = <function unpack_sdf_dict_columns>, bootstrap: ~teehr.models.metrics.basemodels.BootstrapBasemodel = None, transform: ~teehr.models.metrics.basemodels.TransformEnum = None, output_field_name: str = 'spearman_correlation', func: ~typing.Callable = <function spearman_correlation>, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value'], attrs: ~typing.Dict = {'category': MetricCategories.Deterministic, 'display_name': 'Spearman Rank Correlation Coefficient', 'optimal_value': 1.0, 'short_name': 'spearman_correlation', 'value_range': [-1.0, 1.0]})#

Bases: DeterministicBasemodel

Spearman Rank Correlation Coefficient.

Parameters:
  • bootstrap (DeterministicBasemodel) – The bootstrap model, by default None.

  • transform (TransformEnum) – The transformation to apply to the data, by default None.

  • output_field_name (str) – The output field name, by default “spearman_correlation”.

  • func (Callable) – The function to apply to the data, by default deterministic_funcs.spearman_correlation().

  • input_field_names (Union[str, StrEnum, List[Union[str, StrEnum]]]) – The input field names, by default [“primary_value”, “secondary_value”].

  • attrs (Dict) – The static attributes for the metric.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].