n_features | R Documentation |
Calculate the number of non-zero features used in a Maxent model.
n_features(lambdas)
lambdas |
A |
An vector with one element for each element of lambdas
.
# Below we use the dismo::maxent example to fit a Maxent model:
if (require(dismo) && require(rJava) &&
file.exists(system.file('java/maxent.jar', package='dismo'))) {
fnames <- list.files(system.file('ex', package='dismo'), '\\.grd$',
full.names=TRUE )
predictors <- stack(fnames)
occurrence <- system.file('ex/bradypus.csv', package='dismo')
occ <- read.table(occurrence, header=TRUE, sep=',')[,-1]
me <- maxent(predictors, occ, args=c('hinge=false', 'threshold=false'),
path=file.path(tempdir(), 'ex1'))
n_features(me)
# comparing multiple models
me2 <- maxent(predictors, occ, args=c('betamultiplier=3'),
path=file.path(tempdir(), 'ex2'))
n_features(list(me, me2))
# or use lambdas files
ff <- file.path(tempdir(), c('ex1', 'ex2'), 'species.lambdas')
ff
n_features(ff)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.