Fix feature list match for pca

This commit is contained in:
Emre 2022-09-30 15:22:05 -07:00
parent d462f40299
commit cdc01a0781
No known key found for this signature in database
GPG Key ID: 0EAD2EE11B666ABA
2 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import copy
import logging
import re
import shutil
from datetime import datetime, timezone
from math import cos, sin
@ -881,6 +882,10 @@ class FreqaiDataKitchen:
"""
column_names = dataframe.columns
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:
raise OperationalException("Could not find any features!")

View File

@ -434,6 +434,10 @@ class IFreqaiModel(ABC):
feature_list = dk.data["training_features_list_raw"]
else:
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:
raise OperationalException(
"Trying to access pretrained model with `identifier` "