forked from bbuchsbaum/rMVPA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_searchlight.Rd
66 lines (54 loc) · 2.25 KB
/
run_searchlight.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/allgeneric.R, R/searchlight.R
\name{run_searchlight}
\alias{run_searchlight}
\alias{run_searchlight.mvpa_model}
\title{run_searchlight}
\usage{
run_searchlight(model_spec, radius, method, niter, ...)
\method{run_searchlight}{mvpa_model}(
model_spec,
radius = 8,
method = c("randomized", "standard"),
niter = 4,
combiner = NULL,
permute = FALSE,
...
)
}
\arguments{
\item{model_spec}{a \code{mvpa_model} instance.}
\item{radius}{the searchlight radus in millimeters.}
\item{method}{the type of searchlight (randomized or standard)}
\item{niter}{the number of searchlight iterations (used only for 'randomized' method)}
\item{...}{extra args}
\item{combiner}{a function that combines results into an appropriate output.}
}
\value{
a named list of \code{NeuroVol} objects, where each element contains a performance metric (e.g. AUC) at every voxel location.
}
\description{
execute a searchlight analysis
}
\examples{
dataset <- gen_sample_dataset(c(4,4,4), 100, blocks=3)
cval <- blocked_cross_validation(dataset$design$block_var)
model <- load_model("sda_notune")
mspec <- mvpa_model(model, dataset$dataset, design=dataset$design, model_type="classification", crossval=cval)
res <- run_searchlight(mspec,radius=8, method="standard")
# a custom "combiner" can be used to post-process the output of the searchlight classifier for special cases.
# in the example below the supplied "combining function" extracts the predicted probability of the correct class
# for every voxel and every trial and then stores them in a data.frame.
\dontrun{
custom_combiner <- function(mspec, good, bad) {
good \%>\% pmap(function(result, id,...) {
data.frame(trial=1:length(result$observed), id=id, prob=prob_observed(result))
}) \%>\% bind_rows()
}
res2 <- run_searchlight(mspec,radius=8, method="standard", combiner=custom_combiner)
}
}
\references{
Bjornsdotter, M., Rylander, K., & Wessberg, J. (2011). A Monte Carlo method for locally multivariate brain mapping. Neuroimage, 56(2), 508-516.
Kriegeskorte, N., Goebel, R., & Bandettini, P. (2006). Information-based functional brain mapping. Proceedings of the National academy of Sciences of the United States of America, 103(10), 3863-3868.
}