Remove constant labels from prediction
This commit is contained in:
@@ -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
|
||||
|
@@ -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')
|
||||
|
||||
|
Reference in New Issue
Block a user