ts_parameters_data_check ===================================================== .. py:module:: evalml.data_checks.ts_parameters_data_check .. autoapi-nested-parse:: Data check that checks whether the time series parameters are compatible with the data size. Module Contents --------------- Classes Summary ~~~~~~~~~~~~~~~ .. autoapisummary:: evalml.data_checks.ts_parameters_data_check.TimeSeriesParametersDataCheck Contents ~~~~~~~~~~~~~~~~~~~ .. py:class:: TimeSeriesParametersDataCheck(problem_configuration, n_splits) Checks whether the time series parameters are compatible with data splitting. If `gap + max_delay + forecast_horizon > X.shape[0] // (n_splits + 1)` then the feature engineering window is larger than the smallest split. This will cause the pipeline to create features from data that does not exist, which will cause errors. :param problem_configuration: Dict containing problem_configuration parameters. :type problem_configuration: dict :param n_splits: Number of time series splits. :type n_splits: int **Methods** .. autoapisummary:: :nosignatures: evalml.data_checks.ts_parameters_data_check.TimeSeriesParametersDataCheck.name evalml.data_checks.ts_parameters_data_check.TimeSeriesParametersDataCheck.validate .. py:method:: name(cls) Return a name describing the data check. .. py:method:: validate(self, X, y=None) Check if the time series parameters are compatible with data splitting. :param X: Features. :type X: pd.DataFrame, np.ndarray :param y: Ignored. Defaults to None. :type y: pd.Series, np.ndarray :returns: dict with a DataCheckError if parameters are too big for the split sizes. :rtype: dict .. rubric:: Examples >>> import pandas as pd The time series parameters have to be compatible with the data passed. If the window size (gap + max_delay + forecast_horizon) is greater than or equal to the split size, then an error will be raised. >>> X = pd.DataFrame({ ... "dates": pd.date_range("1/1/21", periods=100), ... "first": [i for i in range(100)], ... }) >>> y = pd.Series([i for i in range(100)]) ... >>> problem_config = {"gap": 7, "max_delay": 2, "forecast_horizon": 12, "time_index": "dates"} >>> ts_parameters_check = TimeSeriesParametersDataCheck(problem_configuration=problem_config, n_splits=7) >>> assert ts_parameters_check.validate(X, y) == [ ... { ... "message": "Since the data has 100 observations, n_splits=7, and a forecast horizon of 12, the smallest " ... "split would have 16 observations. Since 21 (gap + max_delay + forecast_horizon)" ... " >= 16, then at least one of the splits would be empty by the time it reaches " ... "the pipeline. Please use a smaller number of splits, reduce one or more these " ... "parameters, or collect more data.", ... "data_check_name": "TimeSeriesParametersDataCheck", ... "level": "error", ... "code": "TIMESERIES_PARAMETERS_NOT_COMPATIBLE_WITH_SPLIT", ... "details": { ... "columns": None, ... "rows": None, ... "max_window_size": 21, ... "min_split_size": 16, ... "n_obs": 100, ... "n_splits": 7 ... }, ... "action_options": [] ... } ... ]