pactools.DARSklearn¶
-
class
pactools.
DARSklearn
(fs, max_ordar, ordar=1, ordriv=0, normalize=False, ortho=True, center=True, iter_gain=10, eps_gain=0.0001, progress_bar=False, use_driver_phase=False, warn_gain_estimation_failure=False)[source]¶ Different interface to DAR models, to use in scikit-learn’s GridSearchCV
- Parameters
- fsfloat
Sampling frequency
- max_ordarint >= 0
Maximum ordar over a potential cross-validation scheme. The log-likelihood does not use the first max_ordar points in its computation, to fairly compare different ordar over cross-validation.
- ordarint >= 0
Order of the autoregressive model (p)
- ordrivint >= 0
Order of the taylor expansion for sigdriv (m)
- normalizeboolean
If True, the basis vectors are normalized to unit energy.
- orthoboolean
If True, the basis vectors are orthogonalized.
- centerboolean
If True, we subtract the mean in sigin
- iter_gainint >=0
Maximum number of iteration in gain estimation
- eps_gainfloat >= 0
Threshold to stop iterations in gain estimation
- use_driver_phaseboolean
If True, we divide the driver by its instantaneous amplitude.
Examples
>>> from sklearn.model_selection import GridSearchCV >>> from pactools.grid_search import DARSklearn >>> model = DARSklearn(fs=fs) >>> param_grid = {'ordar': [10, 20, 30], 'ordriv': [0, 1, 2]} >>> gscv = GridSearchCV(model, param_grid=param_grid) >>> X = MultipleArray(sigin, sigdriv, sigdriv_imag) >>> gscv.fit(X) >>> print(gscv.cv_results_)
-
__init__
(self, fs, max_ordar, ordar=1, ordriv=0, normalize=False, ortho=True, center=True, iter_gain=10, eps_gain=0.0001, progress_bar=False, use_driver_phase=False, warn_gain_estimation_failure=False)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(self, fs, max_ordar[, ordar, …])Initialize self.
copy
(self)Creates a (deep) copy of a model
degrees_of_freedom
(self)Number of parameters of the fitted model
fit
(self, X[, y])Fit the DAR model
fit_transform
(self, X[, y])Fit the model and transform sigin into the residuals
get_criterion
(self, criterion[, train])Get the criterion (logL, AIC, BIC) of the fitted model
get_params
(self[, deep])Get parameters for this estimator.
get_title
(self[, name, criterion])Get the name and orders of the model
likelihood_ratio
(self, ar0)Computation of the likelihood ratio test
plot
(self[, title, frange, mode, vmin, …])Plot the PSD as a function of the driver
plot_lines
(self[, title, frange, mode, ax, …])Plot the PSD as a function of the driver
score
(self, X[, y])Difference in log-likelihood of this model and a model AR(0)
set_params
(self, \*\*params)Set the parameters of this estimator.
transform
(self, X[, y])Transform sigin into the residuals unexplained by the fitted model
Attributes
aic
Akaike information criterion (AIC) of the model
bic
Bayesian information criterion (BIC) of the model
logl
Log likelihood of the model
ordar_
AR order of the model, different from self.ordar if a model selection has been performed
tmax
Scaling of self.logl, self.aic, and self.bic