Bankruptcy Plots

API reference for sovai.plots.bankruptcy.bankruptcy_plots

Module: sovai.plots.bankruptcy.bankruptcy_plots

Functions

plot_ticker_probabilities()

def plot_ticker_probabilities(
    df,
    tickers,
    probability_column = 'probability',
    moving_average = None,
    same_plot = True,
    lookback_period = None,
    dark_mode = False,
)

Plots a specified probability column and optionally its moving average over time for specified tickers on the same or separate plots using Plotly Express. Allows for an optional lookback period selection and dark mode.

Parameters

Parameter
Type
Description

df

Pandas DataFrame containing the data with MultiIndex (ticker, date).

tickers

List of tickers to plot.

probability_column

The probability column to plot, defaults to 'probability'.

moving_average

The window size for the moving average, None for no moving average.

same_plot

Boolean to indicate if all tickers should be plotted on the same plot.

lookback_period

Number of days in the past to include in the plot, None for all history.

dark_mode

Boolean to enable dark mode for the plot.


plot_pca_clusters()

Plot a scatter plot of PCA clusters using Plotly with a lag slider to adjust the date.

Parameters

Parameter
Type
Description

df

DataFrame containing PCA components and target.

target

Name of the target column that indicates health status.

max_lag

The maximum number of months to lag.

max_date

The maximum date available in the dataset.


Last updated