Skip to content

statistics.models

Bases: object

Method kept for consistency with the scikit-learn API. But in this case, will simply call the transform method since no actual model gets fitted here.

Needs to contain only 7 columns representing the GAD-7 items. Should be in the form of a DataFrame with shape (n_samples, 7).

X : Input features (n_samples, 7) with only the 7 GAD-7 items as columns and subject as rows.

y : Target variable. Not used in this model. Keeps the API consistent.

pd.DataFrame : Transformed features.

Transform the input features to assign the label based on the GAD-7 scoring.

Needs to contain only 7 columns representing the GAD-7 items. Should be in the form of a DataFrame with shape (n_samples, 7).

Final labels will be either:

  • Not anxious
  • Mild
  • Moderate
  • Severe

X : Input features.

pd.DataFrame : Transformed features.

Bases: object

Method kept for consistency with the scikit-learn API. But in this case, will simply call the transform method since no actual model gets fitted here.

Needs to contain only 9 columns representing the ordered PHQ-9 items. Should be in the form of a DataFrame with shape (n_samples, 9).

X : Input features (n_samples, 9) with only the 9 PHQ-9 items as columns and subject as rows.

y : Target variable. Not used in this model. Keeps the API consistent.

pd.DataFrame : Transformed features.

Transform the input features to assign the label based on the fuzzy weighting of the PHQ-9 items. Needs to contain only 9 columns representing the ordered PHQ-9 items. Should be in the form of a DataFrame with shape (n_samples, 9).

Final labels will be either:

  • Not depressed
  • Mild
  • Moderate
  • Mod-Severe
  • Severe

X : Input features.

pd.DataFrame : Transformed features.

class Penalty(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Section titled “class Penalty(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)”

Bases: StrEnum, Enum

class ScoringMethod(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Section titled “class ScoringMethod(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)”

Bases: StrEnum, Enum

adjusted_mutual_info_score = ‘adjusted_mutual_info_score’

Section titled “adjusted_mutual_info_score = ‘adjusted_mutual_info_score’”

adjusted_rand_score = ‘adjusted_rand_score’

Section titled “adjusted_rand_score = ‘adjusted_rand_score’”

average_precision = ‘average_precision’

Section titled “average_precision = ‘average_precision’”

balanced_accuracy = ‘balanced_accuracy’

Section titled “balanced_accuracy = ‘balanced_accuracy’”

completeness_score = ‘completeness_score’

Section titled “completeness_score = ‘completeness_score’”

d2_absolute_error_score = ‘d2_absolute_error_score’

Section titled “d2_absolute_error_score = ‘d2_absolute_error_score’”

explained_variance = ‘explained_variance’

Section titled “explained_variance = ‘explained_variance’”

fowlkes_mallows_score = ‘fowlkes_mallows_score’

Section titled “fowlkes_mallows_score = ‘fowlkes_mallows_score’”

homogeneity_score = ‘homogeneity_score’

Section titled “homogeneity_score = ‘homogeneity_score’”

mutual_info_score = ‘mutual_info_score’

Section titled “mutual_info_score = ‘mutual_info_score’”

neg_mean_absolute_error = ‘neg_mean_absolute_error’

Section titled “neg_mean_absolute_error = ‘neg_mean_absolute_error’”

neg_mean_absolute_percentage_error = ‘neg_mean_absolute_percentage_error’

Section titled “neg_mean_absolute_percentage_error = ‘neg_mean_absolute_percentage_error’”

neg_mean_gamma_deviance = ‘neg_mean_gamma_deviance’

Section titled “neg_mean_gamma_deviance = ‘neg_mean_gamma_deviance’”

neg_mean_poisson_deviance = ‘neg_mean_poisson_deviance’

Section titled “neg_mean_poisson_deviance = ‘neg_mean_poisson_deviance’”

neg_mean_squared_error = ‘neg_mean_squared_error’

Section titled “neg_mean_squared_error = ‘neg_mean_squared_error’”

neg_mean_squared_log_error = ‘neg_mean_squared_log_error’

Section titled “neg_mean_squared_log_error = ‘neg_mean_squared_log_error’”

neg_median_absolute_error = ‘neg_median_absolute_error’

Section titled “neg_median_absolute_error = ‘neg_median_absolute_error’”

neg_root_mean_squared_error = ‘neg_root_mean_squared_error’

Section titled “neg_root_mean_squared_error = ‘neg_root_mean_squared_error’”

normalized_mutual_info_score = ‘normalized_mutual_info_score’

Section titled “normalized_mutual_info_score = ‘normalized_mutual_info_score’”

roc_auc_ovo_weighted = ‘roc_auc_ovo_weighted’

Section titled “roc_auc_ovo_weighted = ‘roc_auc_ovo_weighted’”

roc_auc_ovr_weighted = ‘roc_auc_ovr_weighted’

Section titled “roc_auc_ovr_weighted = ‘roc_auc_ovr_weighted’”

class Solver(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Section titled “class Solver(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)”

Bases: StrEnum, Enum

permutation_testing(estimator, X, Y, binary=False, nb_permutations=1000, scoring=‘r2’, splits=10, processes=1, verbose=False)

Section titled “permutation_testing(estimator, X, Y, binary=False, nb_permutations=1000, scoring=‘r2’, splits=10, processes=1, verbose=False)”

Function to perform permutation testing on a model.

estimator : Model to use.

X : Dataframe containing the predictor variables.

Y : Dataframe containing the dependent variables.

binary : If the dependent variable is binary. Defaults to False.

nb_permutations : Number of iterations to perform. Defaults to 1000.

scoring : Scoring method to use. Defaults to ‘r2’.

splits : Number of fold to use in cross-validation. Defaults to 10.

processes : Number of cpus to use during processing. Defaults to 1.

verbose : Verbose mode. Defaults to False.

mod : Model.

score : Score for the model.

coef : Coefficients for the model.

perm_score : Scores for the permutation testing.

score_pvalue : P-value for the model.

perm_coef : Coefficients for the permutation testing.

coef_pvalue : P-value for the coefficients.

plsr_cv(X, Y, nb_comp, max_iter=1000, splits=10, processes=1, verbose=False)

Section titled “plsr_cv(X, Y, nb_comp, max_iter=1000, splits=10, processes=1, verbose=False)”

Function to perform a PLSR model with cross-validation between a set of predictor and dependent variables.

X : Dataframe containing the predictor variables.

Y : Dataframe containing the dependent variables.

nb_comp : Number of components to use.

max_iter : Maximum number of iterations. Defaults to 1000.

splits : Number of fold to use in cross-validation. Defaults to 10.

processes : Number of cpus to use during processing. Defaults to 1.

verbose : Verbose mode. Defaults to False.

plsr : PLSR model.

mse : List of mean squared errors.

score_c : R2 score for the model.

score_cv : R2 score for the cross-validation.

rscore : Square root of the R2 score.

mse_c : Mean squared error for the model.

mse_cv : Mean squared error for the cross-validation.