models
¶counter () |
|
atleast_2d (arr) |
|
check_response_dimensionality (train, test[, …]) |
Make sure matrices are 2D arrays before running models |
clean_results_dict (results) |
Make sure we return arrays, and ndim is at least 2D |
crossval_stem_wmvnp ((features_train, …[, …]) |
Cross-validation procedure for spatio-temporal encoding models with MVN priors. |
cvridge (Xtrain, Ytrain[, Xtest, Ytest, …]) |
Cross-validation procedure for tikhonov regularized regression. |
dual2primal_weights (kernel_weights, …[, …]) |
Recover the feature weights from the kernel weights for any one or all feature spaces. |
dual2primal_weights_banded (kernel_weights, …) |
WIP. |
estimate_simple_stem_wmvnp (features_train, …) |
Estimate model with given hyper-parameters |
estimate_stem_wmvnp ((features_train, …[, …]) |
|
featurespace_dual2primal (kernel_weights, …) |
|
find_optimum_mvn (response_cvmean, …) |
|
generalized_tikhonov (X, Y, Li[, ridge]) |
Implementation fo tikhonov regression using the standard transform (cf. |
hyperopt_crossval_stem_wmvnp (features_train, …) |
Use hyperopt to cross-validate all hyper-parameters parameters. |
hyperopt_estimate_stem_wmvnp (features_train, …) |
|
hyperopt_trials2cvperf (Trials) |
|
kernel_banded_temporal_prior (kernel, …) |
|
kernel_cvridge (Ktrain, Ytrain[, Ktest, …]) |
|
kernel_spatiotemporal_prior (Xtrain, …[, …]) |
Compute the kernel matrix of a model with a spatio-temporal prior |
loo_ols (xtrain_samples, ytrain_samples[, rcond]) |
Leave-one out OLS Return the mean weight across head-out folds |
nan_to_num (\*args, \*\*kwargs) |
|
ols (X, Y[, rcond]) |
Perform OLS fit, return weight estimates |
olspred (X, Y[, Xtest]) |
Fit OLS, return predictions Yhat |
should_solve_dual (X, kernel) |
Answer whether we should solve the regression problem in the dual (kernel) space. |
simple_generalized_tikhonov (X, Y, L[, ridge]) |
Direct implementation of generalized tikhonov regression |
simple_ridge_dual (X, Y[, ridge]) |
Return weights for linear kernel ridge regression |
simple_ridge_primal (X, Y[, ridge]) |
Return weights for ridge regression |
solve_l2 (Xtrain, Ytrain[, Xtest, Ytest, …]) |
Solve L2 regularized regression problem |
solve_l2_dual (Ktrain, Ytrain[, Ktest, …]) |
Solve the dual (kernel) L2 regression problem for each L2 parameter. |
solve_l2_primal (Xtrain, Ytrain[, Xtest, …]) |
Solve the (primal) L2 regression problem for each L2 parameter. |
voxelwise_weights2preds (kernel_weights, …) |
feature_prior : one per voxel! temporal_prior : one for all voxels |
zscore (\*args, \*\*kwargs) |
tikreg.models.
check_response_dimensionality
(train, test, allow_test_none=True)¶Make sure matrices are 2D arrays before running models
tikreg.models.
clean_results_dict
(results)¶Make sure we return arrays, and ndim is at least 2D
crossval_stem_wmvnp(features_train, responses_train, ridges=array([ 1. , 2.15443469, 4.64158883, 10. ,
21.5443469 , 46.41588834, 100. , 215.443469 ,
464.15888336, 1000. ]), temporal_prior=None, feature_priors=None, population_mean=False, folds=(1, 5), method='SVD', verbosity=1, chunklen=True, kernel_features=False, normalize_kernel=False, normalize_hyparams=False, metric='correlation', zscore_ytrain=False, zscore_yval=False, weights=False, predictions=False)
Cross-validation procedure for spatio-temporal encoding models with MVN priors.
tikreg.models.
cvridge
(Xtrain, Ytrain, Xtest=None, Ytest=None, ridges=[0.0], Li=None, kernel_name='linear', kernel_params=None, folds='cv', nfolds=5, blocklen=5, trainpct=0.8, verbose=True, EPS=1e-10, withinset_test=False, performance=False, predictions=False, weights=False, kernel_weights=False, metric='correlation')¶Cross-validation procedure for tikhonov regularized regression.
Parameters: |
|
---|---|
Returns: |
|
tikreg.models.
dual2primal_weights
(kernel_weights, features_train, feature_priors, feature_hyparams, temporal_prior, temporal_hhparam=1.0)¶Recover the feature weights from the kernel weights for any one or all feature spaces.
Parameters: |
|
---|---|
Returns: |
|
tikreg.models.
dual2primal_weights_banded
(kernel_weights, feature_space_train, population_feature_prior, temporal_prior, delays_mean=False, verbose=True)¶WIP. WILL CHANGE. USE AT OWN RISK.
tikreg.models.
estimate_simple_stem_wmvnp
(features_train, responses_train, features_test=None, responses_test=None, feature_priors=None, feature_hyparams=None, temporal_prior=None, temporal_hhparam=1.0, ridge_scale=1.0, weights=False, performance=False, predictions=False, kernel_features=False, method='SVD', verbosity=2, metric='correlation')¶Estimate model with given hyper-parameters
Parameters: |
|
---|---|
Returns: |
|
estimate_stem_wmvnp(features_train, responses_train, features_test=None, responses_test=None, ridges=array([ 1. , 2.15443469, 4.64158883, 10. ,
21.5443469 , 46.41588834, 100. , 215.443469 ,
464.15888336, 1000. ]), normalize_hyparams=False, normalize_kernel=False, temporal_prior=None, feature_priors=None, weights=False, predictions=False, performance=False, folds=(1, 5), method='SVD', verbosity=1, cvresults=None, population_optimal=False, keep_cvfolds=True, chunklen=True, metric='correlation')
tikreg.models.
featurespace_dual2primal
(kernel_weights, feature_space, feature_prior, feature_hyparam, temporal_prior, temporal_hhparam=1.0)¶tikreg.models.
find_optimum_mvn
(response_cvmean, temporal_hhparams, spatial_hyparams, ridge_hyparams)¶tikreg.models.
generalized_tikhonov
(X, Y, Li, ridge=10.0)¶Implementation fo tikhonov regression using the standard transform (cf. Hansen, 1998).
tikreg.models.
hyperopt_crossval_stem_wmvnp
(features_train, responses_train, features_test=None, responses_test=None, temporal_prior=None, feature_priors=None, spatial_sampler=True, temporal_sampler=False, ridge_sampler=False, population_optimal=False, folds=(1, 5), method='SVD', ntrials=100, verbosity=1, dumpcrossval=False, normalize_hyparams=False, normalize_kernel=False, weights=False, predictions=False, performance=True, metric='correlation', zscore_ytrain=True, zscore_yval=True, search_algorithm='tpe', trials=None, **kwargs)¶Use hyperopt
to cross-validate all hyper-parameters parameters.
Search the hyper-parameter space to find the population optimum using a cross-validation procedure.
Parameters: |
|
---|---|
Returns: |
|
tikreg.models.
hyperopt_estimate_stem_wmvnp
(features_train, responses_train, cvmean, hyparams, features_test=None, responses_test=None, temporal_prior=None, feature_priors=None, spatial_sampler=True, temporal_sampler=False, ridge_sampler=False, population_optimal=False, method='SVD', verbosity=1, normalize_hyparams=False, normalize_kernel=False, weights=False, predictions=False, performance=True, kernel_features=False, metric='correlation', **kwargs)¶tikreg.models.
kernel_banded_temporal_prior
(kernel, temporal_prior, spatial_prior, delays)¶tikreg.models.
kernel_cvridge
(Ktrain, Ytrain, Ktest=None, Ytest=None, ridges=[0.0], folds='cv', nfolds=5, blocklen=5, trainpct=0.8, performance=False, predictions=False, weights=False, metric='correlation', verbose=True, EPS=1e-10)¶tikreg.models.
kernel_spatiotemporal_prior
(Xtrain, temporal_prior, spatial_prior, Xtest=None, delays=None)¶Compute the kernel matrix of a model with a spatio-temporal prior
temporal_prior (d, d): d = len(delays)
tikreg.models.
loo_ols
(xtrain_samples, ytrain_samples, rcond=1e-08)¶Leave-one out OLS Return the mean weight across head-out folds
Parameters: |
|
---|
tikreg.models.
should_solve_dual
(X, kernel)¶Answer whether we should solve the regression problem in the dual (kernel) space.
tikreg.models.
simple_generalized_tikhonov
(X, Y, L, ridge=10.0)¶Direct implementation of generalized tikhonov regression
tikreg.models.
simple_ridge_dual
(X, Y, ridge=10.0)¶Return weights for linear kernel ridge regression
tikreg.models.
simple_ridge_primal
(X, Y, ridge=10.0)¶Return weights for ridge regression
tikreg.models.
solve_l2
(Xtrain, Ytrain, Xtest=None, Ytest=None, ridge=0.0, verbose=False, kernel_name='linear', kernel_param=None, kernel_weights=False, **kwargs)¶Solve L2 regularized regression problem
tikreg.models.
solve_l2_dual
(Ktrain, Ytrain, Ktest=None, Ytest=None, ridges=[0.0], method='SVD', EPS=1e-10, verbose=False, performance=False, predictions=False, weights=False, metric='correlation')¶Solve the dual (kernel) L2 regression problem for each L2 parameter.
tikreg.models.
solve_l2_primal
(Xtrain, Ytrain, Xtest=None, Ytest=None, ridges=[0], method='SVD', zscore_ytrain=False, zscore_ytest=False, EPS=1e-10, verbose=False, performance=False, predictions=False, weights=False, metric='correlation')¶Solve the (primal) L2 regression problem for each L2 parameter.