Time Segmentation
Segments time series into different components according to statistical tests over the series. Helpful for understanding changes in regimes.
Tutorials
are the best documentation — Time Segmentation Tutorial
Overview
The Time Segmentation Module is a powerful tool for analyzing financial time series data. It offers four main functionalities:
Change Point Detection
Regime Change Analysis
Comprehensive Regime Analysis (PCA-based)
Each functionality can be used for data analysis or visualization, allowing users to gain deep insights into their financial data.
Getting Started
To use the Time Segmentation Module, first import the necessary library and authenticate:
import sovai as sov
sov.token_auth(token="your_token_here")
df_accounting = sov.data("accounting/weekly").select_stocks("mega")
1. Change Point Detection
Identify significant changes in your time series data.
Data Analysis
df_change = df_accounting.change_point(method='data', feature="book_equity_value")
df_change.tail(10) # View the last 10 rows
df_change.attrs['stats'] # View additional statistics

Visualization
df_accounting.change_point(method='plot')

2. Regime Change Analysis
Detect regime changes for a specific stock and feature.
Data Analysis
rc_result = df_accounting.regime_change(method="data", ticker="AAPL", feature="total_revenue")
rc_result.tail(10) # View the last 10 rows
rc_result.attrs['stats'] # View additional statistics

Visualization
df_accounting.regime_change(method="plot", ticker="AAPL", feature="total_revenue")

3. Comprehensive Regime Analysis (PCA-based)
Perform a PCA-based regime change analysis on multiple features for a specific stock.
Data Analysis
pca_rc_result = df_accounting.pca_regime_change(method="data", ticker="AAPL")
pca_rc_result.tail() # View the last rows
pca_rc_result.attrs['stats'] # View additional statistics

Visualization
df_accounting.pca_regime_change(method="plot", ticker="AAPL")

Tips for Users
Always check the
.attrs['stats']
of the result for additional insights and metadata.Use the 'plot' method for quick visual analysis and the 'data' method for detailed numerical results.
Experiment with different features and tickers to gain comprehensive insights into your financial data.
Last updated
Was this helpful?