Skip to content

Commit

Permalink
added acf, pacf and decomposition plots
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcovdBoom committed Jan 25, 2024
1 parent 7610047 commit 2ae20b4
Show file tree
Hide file tree
Showing 23 changed files with 632 additions and 163 deletions.
18 changes: 8 additions & 10 deletions atom/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
FloatZeroToOneInc, Index, IndexSelector, Int, IntLargerEqualZero,
IntLargerTwo, IntLargerZero, MetricConstructor, ModelsConstructor, NItems,
NJobs, NormalizerStrats, NumericalStrats, Operators, Pandas, Predictor,
PrunerStrats, RowSelector, Scalar, ScalerStrats, Seasonality, Sequence,
Series, TargetSelector, Transformer, VectorizerStarts, Verbose, Warnings,
XSelector, YSelector, sequence_t,
PrunerStrats, RowSelector, Scalar, ScalerStrats, Seasonality,
SeasonalityMode, Sequence, Series, TargetSelector, Transformer,
VectorizerStarts, Verbose, Warnings, XSelector, YSelector, sequence_t,
)
from atom.utils.utils import (
ClassMap, DataConfig, DataContainer, Goal, adjust_verbosity, bk,
Expand Down Expand Up @@ -922,7 +922,7 @@ def shrink(
Whether to convert all features to sparse format. The value
that is compressed is the most frequent value in the column.
columns: int, str, segment, sequence or None, default=None
columns: int, str, segment, sequence, dataframe or None, default=None
[Selection of columns][row-and-column-selection] to shrink. If
None, transform all columns.
Expand Down Expand Up @@ -1201,7 +1201,7 @@ def _add_transformer(
has the `n_jobs` and/or `random_state` parameters, it
adopts atom's values.
columns: int, str, segment, sequence or None, default=None
columns: int, str, segment, sequence, dataframe or None, default=None
Columns in the dataset to transform. If None, transform
all features.
Expand Down Expand Up @@ -1388,7 +1388,7 @@ def add(
instance), and it has the `n_jobs` and/or `random_state`
parameters, it adopts atom's values.
columns: int, str, segment, sequence or None, default=None
columns: int, str, segment, sequence, dataframe or None, default=None
[Selection of columns][row-and-column-selection] to
transform. Only select features or the target column, not
both at the same time (if that happens, the target column
Expand Down Expand Up @@ -1564,7 +1564,7 @@ def decompose(
self,
*,
model: str | Predictor | None = None,
mode: Literal["additive", "multiplicative"] = "additive",
mode: SeasonalityMode = "additive",
**kwargs,
):
"""Detrend and deseasonalize the time series.
Expand All @@ -1584,9 +1584,7 @@ def decompose(
* Use the `columns` parameter to only decompose the target
column, e.g., `atom.decompose(columns=atom.target)`.
* Use the [plot_decomposition][] method to visualize the
trend, seasonality and residuals of the time series. This
can help to determine if the data follows an additive or
multiplicative trend.
trend, seasonality and residuals of the time series.
"""
columns = kwargs.pop("columns", None)
Expand Down
7 changes: 4 additions & 3 deletions atom/data_cleaning.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
Bins, Bool, CategoricalStrats, DataFrame, DiscretizerStrats, Engine,
Estimator, FloatLargerZero, IntLargerEqualZero, IntLargerTwo,
IntLargerZero, NJobs, NormalizerStrats, NumericalStrats, Pandas, Predictor,
PrunerStrats, Scalar, ScalerStrats, Sequence, Series, Transformer, Verbose,
XSelector, YSelector, dataframe_t, sequence_t, series_t,
PrunerStrats, Scalar, ScalerStrats, SeasonalityMode, Sequence, Series,
Transformer, Verbose, XSelector, YSelector, dataframe_t, sequence_t,
series_t,
)
from atom.utils.utils import (
Goal, bk, composed, crash, get_col_order, get_cols, it, lst, merge,
Expand Down Expand Up @@ -1083,7 +1084,7 @@ def __init__(
*,
model: str | Predictor | None = None,
sp: IntLargerZero | None = None,
mode: Literal["additive", "multiplicative"] = "additive",
mode: SeasonalityMode = "additive",
n_jobs: NJobs = 1,
verbose: Verbose = 0,
logger: str | Path | Logger | None = None,
Expand Down
2 changes: 1 addition & 1 deletion atom/plots/basefigure.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def get_elem(
else:
return self.style[element].setdefault(name, next(getattr(self, element)))

def showlegend(self, name: str, legend: Legend | dict | None) -> bool:
def showlegend(self, name: str, legend: Legend | dict[str, Any] | None) -> bool:
"""Get whether the trace should be showed in the legend.
If there's already a trace with the same name, it's not
Expand Down
9 changes: 5 additions & 4 deletions atom/plots/baseplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,14 +408,16 @@ def _draw_line(
child: str or None, default=None
Name of the secondary attribute.
legend: str, dict or None
legend: str, dict or None, default=None
Legend argument provided by the user.
**kwargs
Additional keyword arguments for the trace.
"""
Baseplot._fig.figure.add_scatter(
BasePlot._fig.figure.add_scatter(
name=kwargs.pop("name", child or parent),
mode=kwargs.pop("mode", "lines"),
line=kwargs.pop(
"line", {
"width": self.line_width,
Expand All @@ -435,15 +437,14 @@ def _draw_line(
"hovertemplate",
f"(%{{x}}, %{{y}})<extra>{parent}{f' - {child}' if child else ''}</extra>",
),
name=kwargs.pop("name", child or parent),
legendgroup=kwargs.pop("legendgroup", parent),
legendgrouptitle=kwargs.pop(
"legendgrouptitle",
{"text": parent, "font_size": self.label_fontsize} if child else None,
),
showlegend=kwargs.pop(
"showlegend",
BasePlot._fig.showlegend(f"{parent}-{child}", legend)
BasePlot._fig.showlegend(f"{parent}-{child}" if child else parent, legend)
),
**kwargs,
)
Expand Down
Loading

0 comments on commit 2ae20b4

Please sign in to comment.