Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[typing] Add typing for user facing functions #1193

Merged
merged 24 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions neuralprophet/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def __post_init__(self):
@dataclass
class Regressor:
reg_lambda: Optional[float]
normalize: str
normalize: Union[str, bool]
mode: str


Expand All @@ -418,7 +418,7 @@ class Event:

@dataclass
class Holidays:
country: str
country: Union[str, List[str]]
lower_window: int
upper_window: int
mode: str = "additive"
Expand Down
13 changes: 10 additions & 3 deletions neuralprophet/df_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,14 @@ def split_considering_timestamp(df, n_lags, n_forecasts, inputs_overbleed, thres
return df_train, df_val


def split_df(df, n_lags, n_forecasts, valid_p=0.2, inputs_overbleed=True, local_split=False):
def split_df(
df: pd.DataFrame,
n_lags: int,
n_forecasts: int,
valid_p: float = 0.2,
inputs_overbleed: bool = True,
local_split: bool = False,
):
"""Splits timeseries df into train and validation sets.

Prevents overbleed of targets. Overbleed of inputs can be configured.
Expand Down Expand Up @@ -1553,7 +1560,7 @@ def join_dfs_after_data_drop(predicted, df, merge=False):
return df_merged.rename_axis("ds").reset_index()


def add_quarter_condition(df):
def add_quarter_condition(df: pd.DataFrame):
"""Adds columns for conditional seasonalities to the df.

Parameters
Expand All @@ -1578,7 +1585,7 @@ def add_quarter_condition(df):
return df


def add_weekday_condition(df):
def add_weekday_condition(df: pd.DataFrame):
"""Adds columns for conditional seasonalities to the df.

Parameters
Expand Down
Loading