Fix feature list match for pca
This commit is contained in:
parent
d462f40299
commit
cdc01a0781
@ -1,5 +1,6 @@
|
|||||||
import copy
|
import copy
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from math import cos, sin
|
from math import cos, sin
|
||||||
@ -881,6 +882,10 @@ class FreqaiDataKitchen:
|
|||||||
"""
|
"""
|
||||||
column_names = dataframe.columns
|
column_names = dataframe.columns
|
||||||
features = [c for c in column_names if "%" in c]
|
features = [c for c in column_names if "%" in c]
|
||||||
|
pca_features = [c for c in column_names if re.search(r"^PC\d+$", c)]
|
||||||
|
if not features and pca_features:
|
||||||
|
features = pca_features
|
||||||
|
|
||||||
if not features:
|
if not features:
|
||||||
raise OperationalException("Could not find any features!")
|
raise OperationalException("Could not find any features!")
|
||||||
|
|
||||||
|
@ -434,6 +434,10 @@ class IFreqaiModel(ABC):
|
|||||||
feature_list = dk.data["training_features_list_raw"]
|
feature_list = dk.data["training_features_list_raw"]
|
||||||
else:
|
else:
|
||||||
feature_list = dk.data['training_features_list']
|
feature_list = dk.data['training_features_list']
|
||||||
|
|
||||||
|
if self.ft_params.get('principal_component_analysis', False):
|
||||||
|
feature_list = dk.data['training_features_list']
|
||||||
|
|
||||||
if dk.training_features_list != feature_list:
|
if dk.training_features_list != feature_list:
|
||||||
raise OperationalException(
|
raise OperationalException(
|
||||||
"Trying to access pretrained model with `identifier` "
|
"Trying to access pretrained model with `identifier` "
|
||||||
|
Loading…
Reference in New Issue
Block a user