Remove constant labels from prediction

This commit is contained in:
th0rntwig
2022-10-06 19:26:33 +02:00
parent edb942f662
commit a9d5e04a43
4 changed files with 26 additions and 0 deletions

View File

@@ -460,6 +460,18 @@ class FreqaiDataKitchen:
return df
def check_pred_labels(self, df_predictions: DataFrame) -> None:
"""
Check that prediction feature labels match training feature labels.
:params:
:df_predictions: incoming predictions
"""
train_labels = self.data_dictionary["train_features"].columns
pred_labels = df_predictions.columns
if len(train_labels.difference(pred_labels)) != 0:
self.data_dictionary["prediction_features"] = df_predictions[train_labels]
return
def principal_component_analysis(self) -> None:
"""
Performs Principal Component Analysis on the data for dimensionality reduction

View File

@@ -492,6 +492,8 @@ class IFreqaiModel(ABC):
# ensure user is feeding the correct indicators to the model
self.check_if_feature_list_matches_strategy(dk)
dk.check_pred_labels(dk.data_dictionary['prediction_features'])
if ft_params.get('inlier_metric_window', 0):
dk.compute_inlier_metric(set_='predict')