R/cl_max_correlation.R
cl_max_correlation.Rd
An implementation of a maximum correlation coefficient classifier.
cl_max_correlation(
ndr_container_or_object = NULL,
return_decision_values = TRUE
)
The purpose of this argument is to make the constructor of the cl_maximum_correlation classifier work with the pipe (|>) operator. This argument should almost never be directly set by the user to anything other than NULL. If this is set to the default value of NULL, then the constructor will return a cl_max_correlation object. If this is set to an NDT container, then a cl_max_correlation object will be added to the container and the container will be returned. If this argument is set to another NDT object, then both that NDR object as well as a new cl_maximum_correlation object will be added to a new container and the container will be returned.
A Boolean specifying whether the prediction function should return columns that have the decision values. Setting this to FALSE will save memory so can be useful when analyzing very large high temporal resolution data sets. However if this is set to FALSE< metrics won't be able to compute decoding accuracy measures that are based on the decision values; e.g., the rm_main_results object won't be able to calculate normalized rank decision values.
This constructor creates an NDR classifier object with the class
cl_max_correlation
. Like all NDR classifier objects, this classifier will
be used by a cross-validator to learn the relationship between neural
activity and experimental conditions on a training set of data, and then it
will be used to make predictions on a test set of data.
This CL object learns a mean population vector (template) for each class from the training set (by averaging together the all training points within each class). The classifier is tested by calculated Pearson’s correlation coefficient between a test point and the templates learned from the training set, and the class with the highest correlation value is returned as the predicted label. The decision values returned by the classifier are the correlation coefficients between all test points and all templates.
Like all classifiers (CL) objects, this classifier has a private get_predictions() method which learns a model based on training data and then makes predictions on the test data.
Other classifier:
cl_poisson_naive_bayes()
,
cl_svm()
# running a basic decoding analysis using the cl_max_correlation
data_file <- system.file(file.path("extdata", "ZD_150bins_50sampled.Rda"),
package = "NeuroDecodeR")
ds <- ds_basic(data_file, "stimulus_ID", 18)
#> Automatically selecting sites_IDs_to_use. Since num_cv_splits = 18 and num_label_repeats_per_cv_split = 1, all sites that have 18 repetitions have been selected. This yields 132 sites that will be used for decoding (out of 132 total).
fps <- list(fp_zscore())
cl <- cl_max_correlation()
cv <- cv_standard(datasource = ds,
classifier = cl,
feature_preprocessors = fps,
num_resample_runs = 2) # better to use more resample runs (default is 50)
#> Warning: The result_metrics argument is NULL in the cv_standard constructor. Setting the result_metrics to default values of rm_main_results and rm_confusion_matrix.
# \donttest{
DECODING_RESULTS <- run_decoding(cv)
#>
|
| | 0%
|
|=================================== | 50%
|
|======================================================================| 100%
# }