# TS Decomposition

`Tutorials` are the best documentation — [<mark style="color:blue;">`Time Series Decomposition Tutorial`</mark>](https://colab.research.google.com/github/sovai-research/sovai-public/blob/main/notebooks/computational/Decomposition%20Notebook.ipynb)

### Decomposition Techniques

The module primarily uses the Multiple Seasonal-Trend decomposition using LOESS method, which allows for:

* Trend extraction
* Multiple seasonal component extraction (e.g., weekly, monthly, quarterly)
* Remainder (residual) calculation

### Reactive Trend Analysis

This feature categorizes the trend in real-time as:

* Increasing
* Decreasing
* Sideways

### Usage Examples

```python
import sovai as sov

# Authenticate and load data
sov.token_auth(token="your_token_here")

df_accounting = sov.data("accounting/weekly").select_stocks("mega")
```

### Time Decomposition and Statistrics

<figure><img src="/files/99JF6q1FAG6bajkZa2lC" alt=""><figcaption></figcaption></figure>

```python
# Perform time decomposition
df_time = df_accounting.time_decomposition(method="data", ticker="AAPL", feature="total_revenue")
# Access overall statistics
```

```
print(df_time.attrs["stats"])
```

####

### Interactive Dashboard

```python
# Generate decomposition plot
df_accounting.time_decomposition(method="plot", ticker="AAPL", feature="total_revenue")
```

<figure><img src="/files/HosyL1RTP0iMPr3cThGR" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sov.ai/time-series/institutional-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
