API reference

The public ncrf API provides a convenience function as well as composable data, estimator, solver, model, and fit objects.

High-level interface

fit_ncrf(meg, stim, lead_field, noise[, ...])

One shot function for cortical TRF localization.

Fitting pipeline

RegressionData(meg, stim, design[, samples, ...])

Dataset for NCRF fitting: M/EEG segments, their predictors, and the design.

NCRFEstimator([lead_field, ...])

Estimator for neuro-current response functions (NCRFs).

fit_model(data, solver[, verbose])

Fit one fixed solver configuration on whitened data.

CrossValidation([n_splits, n_workers])

Configuration for selecting among solver candidates.

CVResult(solver, scores)

Cross-validation scores for one solver candidate.

crossvalidate(data, candidates, cv)

Perform cross-validation over a set of solver candidates.

Models and fits

NCRF(forward, theta, design)

Fitted NCRF model that can be applied to compatible datasets.

NCRFFit(model, *, solver, solver_fit, ...)

Report produced by NCRFEstimator.fit().

NCRFExecutionContext([timestamp, duration, ...])

Context in which an NCRF was fitted.

Solvers

Solver()

Configuration contract for an algorithm that estimates NCRF weights.

SolverFit(theta)

Fitted state from one solver execution.

ChampLasso([mu, n_iter, n_iterc, n_iterf, ...])

Alternating FASTA/Champagne solver for NCRF estimation.

ChampLassoFit(theta, history, gamma, sigma_b)

Fitted state produced by ChampLasso.

Metrics

explained_variance(observed, predicted)

Mean sensor-by-segment explained variance in whitened sensor space.

l2_error(observed, predicted)

Mean unweighted squared prediction error in whitened sensor space.

Model components

ForwardModel(lead_field, noise_covariance, ...)

Forward model and noise covariance with derived whitened quantities.

TRFDesign(basis, tstart, tstep, tstop, ...)

Stimulus and basis metadata defining the coefficient space.