diff --git a/runtime/databricks/automl_runtime/forecast/__init__.py b/runtime/databricks/automl_runtime/forecast/__init__.py index a18ec45..363ea60 100644 --- a/runtime/databricks/automl_runtime/forecast/__init__.py +++ b/runtime/databricks/automl_runtime/forecast/__init__.py @@ -77,7 +77,7 @@ } } -QUATERLY_OFFSET_ALIAS = [ +QUARTERLY_OFFSET_ALIAS = [ 'Q', 'QS', 'BQ', 'BQS' ] diff --git a/runtime/databricks/automl_runtime/forecast/pmdarima/training.py b/runtime/databricks/automl_runtime/forecast/pmdarima/training.py index 7cb1b35..604b7c1 100644 --- a/runtime/databricks/automl_runtime/forecast/pmdarima/training.py +++ b/runtime/databricks/automl_runtime/forecast/pmdarima/training.py @@ -50,7 +50,7 @@ def __init__(self, horizon: int, frequency_unit: str, metric: str, seasonal_peri :param frequency_quantity: The number of frequency units in the frequency. Default is 1. it is the starting point of cutoffs for cross validation. For tuning job, it is the cutoff between train and validate split. - For training job, it is the cutoff bewteen validate and test split. + For training job, it is the cutoff between validate and test split. """ self._horizon = horizon self._frequency_unit = OFFSET_ALIAS_MAP[frequency_unit] diff --git a/runtime/databricks/automl_runtime/forecast/prophet/forecast.py b/runtime/databricks/automl_runtime/forecast/prophet/forecast.py index 28c4a5e..c9ddbfb 100644 --- a/runtime/databricks/automl_runtime/forecast/prophet/forecast.py +++ b/runtime/databricks/automl_runtime/forecast/prophet/forecast.py @@ -117,7 +117,7 @@ def __init__(self, horizon: int, frequency_unit: str, metric: str, interval_widt :param split_cutoff: Optional cutoff specified by user. If provided, it is the starting point of cutoffs for cross validation. For tuning job, it is the cutoff between train and validate split. - For training job, it is the cutoff bewteen validate and test split. + For training job, it is the cutoff between validate and test split. :param prophet_kwargs: Optional keyword arguments for Prophet model. For information about the parameters see: `The Prophet source code `_. diff --git a/runtime/databricks/automl_runtime/forecast/prophet/model.py b/runtime/databricks/automl_runtime/forecast/prophet/model.py index 77b510a..089b5df 100644 --- a/runtime/databricks/automl_runtime/forecast/prophet/model.py +++ b/runtime/databricks/automl_runtime/forecast/prophet/model.py @@ -27,7 +27,7 @@ from databricks.automl_runtime.forecast import OFFSET_ALIAS_MAP, DATE_OFFSET_KEYWORD_MAP from databricks.automl_runtime.forecast.model import ForecastModel, mlflow_forecast_log_model from databricks.automl_runtime import version -from databricks.automl_runtime.forecast.utils import is_quaterly_alias, make_future_dataframe, apply_preprocess_func +from databricks.automl_runtime.forecast.utils import is_quarterly_alias, make_future_dataframe, apply_preprocess_func PROPHET_ADDITIONAL_PIP_DEPS = [ @@ -71,7 +71,7 @@ def __init__(self, self._frequency_unit = frequency_unit self._frequency_quantity = frequency_quantity self._time_col = time_col - self._is_quaterly = is_quaterly_alias(frequency_unit) + self._is_quarterly = is_quarterly_alias(frequency_unit) self._split_col = split_col self._preprocess_func = preprocess_func super().__init__() diff --git a/runtime/databricks/automl_runtime/forecast/utils.py b/runtime/databricks/automl_runtime/forecast/utils.py index e16fd4f..004eab6 100644 --- a/runtime/databricks/automl_runtime/forecast/utils.py +++ b/runtime/databricks/automl_runtime/forecast/utils.py @@ -16,7 +16,7 @@ import logging from typing import Dict, List, Optional, Tuple, Union from databricks.automl_runtime.forecast import DATE_OFFSET_KEYWORD_MAP,\ - QUATERLY_OFFSET_ALIAS, NON_DAILY_OFFSET_ALIAS, OFFSET_ALIAS_MAP, PERIOD_ALIAS_MAP + QUARTERLY_OFFSET_ALIAS, NON_DAILY_OFFSET_ALIAS, OFFSET_ALIAS_MAP, PERIOD_ALIAS_MAP import pandas as pd @@ -155,7 +155,7 @@ def generate_cutoffs(df: pd.DataFrame, horizon: int, frequency_unit: str, """ period = max(0.5 * horizon, 1) # avoid empty cutoff buckets - # avoid non-integer months, quaters ands years. + # avoid non-integer months, quarters ands years. if frequency_unit in NON_DAILY_OFFSET_ALIAS: period = int(period) period_dateoffset = pd.DateOffset(**DATE_OFFSET_KEYWORD_MAP[frequency_unit])*frequency_quantity*period @@ -208,7 +208,7 @@ def generate_custom_cutoffs(df: pd.DataFrame, horizon: int, frequency_unit: str, :param split_cutoff: the user-specified cutoff, as the starting point of cutoffs. :param frequency_quantity: frequency quantity of the time series. For tuning job, it is the cutoff between train and validate split. - For training job, it is the cutoff bewteen validate and test split. + For training job, it is the cutoff between validate and test split. :return: list of pd.Timestamp cutoffs for cross-validation. """ # TODO: [ML-43528] expose period as input. @@ -216,7 +216,7 @@ def generate_custom_cutoffs(df: pd.DataFrame, horizon: int, frequency_unit: str, period_dateoffset = pd.DateOffset(**DATE_OFFSET_KEYWORD_MAP[frequency_unit])*period*frequency_quantity horizon_dateoffset = pd.DateOffset(**DATE_OFFSET_KEYWORD_MAP[frequency_unit])*horizon*frequency_quantity - # First cutoff is the cutoff bewteen splits + # First cutoff is the cutoff between splits cutoff = split_cutoff result = [] max_cutoff = max(df["ds"]) @@ -230,8 +230,8 @@ def generate_custom_cutoffs(df: pd.DataFrame, horizon: int, frequency_unit: str, cutoff += period_dateoffset return result -def is_quaterly_alias(freq: str): - return freq in QUATERLY_OFFSET_ALIAS +def is_quarterly_alias(freq: str): + return freq in QUARTERLY_OFFSET_ALIAS def is_frequency_consistency( start_time: pd.Timestamp, diff --git a/runtime/tests/automl_runtime/forecast/prophet/model_test.py b/runtime/tests/automl_runtime/forecast/prophet/model_test.py index 0ff68cc..4422eaa 100644 --- a/runtime/tests/automl_runtime/forecast/prophet/model_test.py +++ b/runtime/tests/automl_runtime/forecast/prophet/model_test.py @@ -143,7 +143,7 @@ def preprocess_func(df): def test_make_future_dataframe(self): for feq_unit in OFFSET_ALIAS_MAP: - # Temporally disable the year, month and quater since we + # Temporally disable the year, month and quarter since we # don't have full support yet. if OFFSET_ALIAS_MAP[feq_unit] in ['YS', 'MS', 'QS']: continue diff --git a/runtime/tests/automl_runtime/forecast/utils_test.py b/runtime/tests/automl_runtime/forecast/utils_test.py index d2ab309..51de171 100644 --- a/runtime/tests/automl_runtime/forecast/utils_test.py +++ b/runtime/tests/automl_runtime/forecast/utils_test.py @@ -71,7 +71,7 @@ def test_truncate(self): validation_horizon = get_validation_horizon(df, 17, "YS") self.assertEqual(validation_horizon, 2) - # for dataframe with 12 quaters of data, maximum horizon is 3 quaters. + # for dataframe with 12 quarters of data, maximum horizon is 3 quarters. df = pd.DataFrame(pd.date_range(start="2012-01-14", periods=13, freq=pd.DateOffset(months=3)), columns=["ds"]) validation_horizon = get_validation_horizon(df, 17, "QS") self.assertEqual(validation_horizon, 3) @@ -197,7 +197,7 @@ def test_generate_cutoffs_success_monthly(self): cutoffs = generate_cutoffs(df, horizon=2, frequency_unit="MS", num_folds=3, seasonal_period=1) self.assertEqual([pd.Timestamp('2021-08-12 00:00:00'), pd.Timestamp('2021-9-12 00:00:00'), pd.Timestamp('2021-10-12 00:00:00')], cutoffs) - def test_generate_cutoffs_success_quaterly(self): + def test_generate_cutoffs_success_quarterly(self): df = pd.DataFrame( pd.date_range(start="2020-07-12", periods=9, freq=pd.DateOffset(months=3)), columns=["ds"] ).rename_axis("y").reset_index() @@ -277,14 +277,14 @@ def test_generate_custom_cutoffs_success_monthly(self): cutoffs = generate_custom_cutoffs(df, horizon=7, frequency_unit="MS", split_cutoff=pd.Timestamp('2021-03-12 00:00:00')) self.assertEqual([pd.Timestamp('2021-03-12 00:00:00'), pd.Timestamp('2021-04-12 00:00:00'), pd.Timestamp('2021-05-12 00:00:00')], cutoffs) - def test_generate_custom_cutoffs_success_quaterly(self): + def test_generate_custom_cutoffs_success_quarterly(self): df = pd.DataFrame( pd.date_range(start="2020-07-12", periods=9, freq=pd.DateOffset(months=3)), columns=["ds"] ).rename_axis("y").reset_index() cutoffs = generate_custom_cutoffs(df, horizon=7, frequency_unit="QS", split_cutoff=pd.Timestamp('2020-07-12 00:00:00')) self.assertEqual([pd.Timestamp('2020-07-12 00:00:00'), pd.Timestamp('2020-10-12 00:00:00')], cutoffs) - def test_generate_custom_cutoffs_success_quaterly_end(self): + def test_generate_custom_cutoffs_success_quarterly_end(self): df = pd.DataFrame( pd.date_range(start="2020-03-31", periods=3, freq=pd.DateOffset(months=3)), columns=["ds"] ).rename_axis("y").reset_index()