Pairwise

API reference for sovai.extensions.pairwise

Module: sovai.extensions.pairwise

Functions

estimate_rank()

def estimate_rank(tensor_data, explained_var_threshold = 0.95)

Estimate rank for each mode based on explained variance.

Parameters

Parameter
Type
Description

tensor_data

explained_var_threshold

Default: 0.95


relative_distance_calc()

def relative_distance_calc(
    df_factors,
    orient = 'cross-sectional',
    on = 'date',
    distance = 'cosine',
    metric = 'pearson',
    calculations = ['mean'],
)

Calculates the relative distance matrix based on the initial distance calculation and then computes the bar S matrix.

Parameters

Parameter
Type
Description

df_factors

DataFrame containing the data.

orient

Orientation for the initial distance calculation.

on

The level to group on ('ticker' or 'date').

distance

The distance metric to use ('cosine', 'euclidean', etc.).

metric

The metric to use for time-series distance calculation.

calculations

List of calculations to perform in distance_cross.

Returns

: DataFrame representing the normalized bar S matrix.


Last updated