anomaly_scores.weighted_rmse_score
- class WeightedRMSEScore(feature_weights=None, **kwargs)[source]
Bases:
RMSEScoreCalculate the RMSE of given reconstruction errors manipulated with specified weights.
- feature_weights
Weight definition for input features.
- Type:
Dict[str, float]
- Weights can be chosen from [0, infinity). Defaults to None.
Configuration example:
train: anomaly_score: name: weighted_rmse params: feature_weights: feature_1: 2.0 feature_2: 0.5 feature_3: 1.0 # If a feature should not be weighted it can also be omitted.
- apply_weights_to_squared_residuals(x)[source]
Applies specified weights to squared std-scaled x, if x is a pandas DataFrame and the features acutally occur in x’s columns.
x (pd.DataFrame): DataFrame of reconstruction errors.
- Return type:
DataFrame- Returns:
pd.DataFrame weighted version of x.
- fit(x, y=None)[source]
Calculate standard deviation and mean on weighted training data
- Parameters:
x (
DataFrame) – DataFrame with differences between prediction and actual sensor valuesy (
Optional[Series]) – not used, labels indicating whether sample is normal (True) or anomalous (False).variable_name_features (Dict[str, List[str]]) – Mapping of input feature names that change during preprocessing. Example: Angle features might be transformed into [feature_name_sin, feature_name_cos. Defaults to an empty dictionary.
- Return type: