Skip to contents

Model setup

Define a FINN model and how each demographic process is represented.

finn()
Forest Informed Neural Network
createProcess()
Define a demographic process for FINN
createHybrid()
Define a hybrid (deep-neural-network) demographic process for FINN
CohortMat()
Cohort Matrix Class

Fitting and prediction

Calibrate every component jointly, end-to-end, then simulate.

fit()
Fit FINN
predict(<finn_class>)
Predict from a FINN model
simulateForest()
Simulate
FINN.seed()
Set Seed for Reproducibility in R and Torch

Processes

The built-in mechanistic demographic functions and allometries.

growth()
Calculate growth
mortality()
Mortality
regeneration()
Calculate the regeneration of forest patches based on the input parameters
competition()
Compute the fraction of available light (light) for each cohort based on the given parameters
height()
Calculate the height of a tree based on its diameter at breast height and an allometry parameter
BA_stand()
Calculate the Basal Area of a Stand
BA_stem()
Calculate the basal area of a tree given the diameter at breast height (dbh)
dbh2ba()
Convert DBH to basal area

Data preparation

Turn a raw tree list and environment table into FINN’s inputs.

makeObsData()
Create observation data from trees
resolveSiteIDs()
Resolve site, patch, and year indices for FINN inputs
makeInitCohorts()
Make initial cohorts for FINN
climateDF2array()
Convert a climate data frame to a FINN environment array
obsDF2arrays()
Convert observation data frame to arrays
array2obsDF()
Transform Arrays to Observation Data Table
pred2DF()
Convert Prediction Arrays to Data Frames
extract_env()
Extract Environmental Data for a Process

Environmental scaling

FINN standardises environmental predictors internally (env_autoscale = TRUE); these expose the stored constants.

apply_env_scaling()
Apply stored z-standardization to environmental predictors
compute_env_scaling()
Learn z-standardization for environmental predictors

Interpretation (xAI)

Read back what a fitted - or hybrid - model actually learned.

ALE()
Accumulated local effect plots
plot(<FINNale>)
Plot ALE curves of a FINN model
summary(<finn_class>)
Summarise a fitted FINN model
conditionalEffects()
Conditional effects of a FINN model
averageConditionalEffects()
Average conditional effects of a FINN model
feature_importance()
Permutation feature importance for FINN demographic rates

Low-level utilities

Building blocks used internally and exported for advanced use.

aggregate_results_old()
Aggregate function
binomial_from_bernoulli()
Draw binomial counts from per-trial Bernoulli probabilities
binomial_from_gamma()
Sample from binomial with gradient
groupby_mean()
group by mean
index_species()
Index species
np_runif()
Generate random numbers from a uniform distribution
rweibull_cohorts()
Generate Cohorts Using Weibull Distribution
sample_poisson_relaxed()
Sample poisson relaxed