fairlens.metrics.r2_mcfadden#

r2_mcfadden(sr_a, sr_b)[source]#

Metric used for categorical-numerical continuous. It trains two multinomial logistic regression models on the data, one using the numerical series as the feature and the other only using the intercept term as the input. The categorical column is used for the target labels. It then calculates the null and the model likelihoods based on them, which are used to compute the pseudo-R2 McFadden score, which is used as a correlation coefficient.

Parameters
  • sr_a (pd.Series) – The categorical series to analyze, representing target labels.

  • sr_b (pd.Series) – The numerical series to analyze.

Returns

Value of the pseudo-R2 McFadden score.

Return type

float