Skip to content

Commit

Permalink
fix: _adjust_min_data_points
Browse files Browse the repository at this point in the history
  • Loading branch information
softwareentrepreneer committed Apr 28, 2024
1 parent 04887b0 commit cf28507
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pfund/models/model_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
TalibFunction,
Any,
]

from pfund.models.model_meta import MetaModel
from pfund.products.product_base import BaseProduct
from pfund.utils.utils import short_path, get_engine_class, load_yaml_file, convert_ts_to_dt
Expand Down Expand Up @@ -124,7 +125,6 @@ def __getattr__(self, attr):
def df(self):
return self._data_tool.df

@property
def get_data_tool(self):
return self._data_tool

Expand Down Expand Up @@ -342,8 +342,8 @@ def add_consumer_datas_if_no_data(self) -> list[BaseData]:
# IMPROVE: current issue is in next(), when the df has multiple products and resolutions,
# don't know how to determine the exact minimum amount of data points for predict()
def _adjust_min_data_points(self):
num_products = len(self._data_tool.get_df_products())
num_resolutions = len(self._data_tool.get_df_resolutions())
num_products = len(self._data_tool.get_index_values(self.df, 'product'))
num_resolutions = len(self._data_tool.get_index_values(self.df, 'resolution'))
assert num_products and num_resolutions, f"{num_products=} and/or {num_resolutions=} are invalid, please check your dataframe"
adj_min_data_points = self.min_data_points * num_products * num_resolutions
adj_max_data_points = self.max_data_points * num_products * num_resolutions
Expand Down

0 comments on commit cf28507

Please sign in to comment.