gemmr.sample_analysis.analyzers.analyze_dataset¶
-
gemmr.sample_analysis.analyzers.analyze_dataset(estr, X, Y, Xorig=None, Yorig=None, x_align_ref=None, y_align_ref=None, addons=(), **kwargs)¶ Analyze a given dataset with a given estimator
Fits an estimator to a given dataset, stores association strengths, weights and loadings and optionally runs additional analyses with fitted estimator.
Parameters: - estr (sklearn-style estimator) – for performing CCA or PLS. Must have method
fitand (after fitting) attributesassocs_,x_rotations_,y_rotations_,x_scores_,y_scores_ - X (np.ndarray (n_samples, n_features)) – dataset X
- Y (np.ndarray (n_samples, n_features)) – dataset Y
- Xorig (
Noneor np.ndarray (n_samples, n_orig_features)) – ifNoneset toX. Allows to provide an alternative set of X features for calculating loadings. I.e. an implicit assumption is that the rows inXandXorigcorrespond to the same samples (subjects). - Yorig (
Noneor np.ndarray (n_samples, n_orig_features)) – ifNoneset toY. Allows to provide an alternative set of Y features for calculating loadings. I.e. an implicit assumption is that the rows inYandYorigcorrespond to the same samples (subjects). - x_align_ref ((n_features,)) – after fitting, the sign of X weights is chosen such that the
cosine-distance between fitted X weights and
x_align_refis positive - y_align_ref ((n_features,)) – after fitting, the sign of Y weights is chosen such that the
cosine-distance between fitted Y weights and
y_align_refis positive - addons (list-like of add-on functions) –
After fitting the estimator and saving association strengths, weights and loadings in
resultsadditional analyses can be performed with these functions. They are called in the given order, and must have the signatureaddana_fun(estr, X, Y, Xorig, Yorig, x_align_ref, y_align_ref, results, **kwargs)
and are expected to save their respective outcome features
results. Various such functions are provided in modulesample_analysis_addons - kwargs (dict) – forwarded to additional analysis functions
Returns: results – containing data variables for outcome features generated by analyses
Return type: xr.Dataset
- estr (sklearn-style estimator) – for performing CCA or PLS. Must have method