viewpoint_regression: Conduct viewpoint regression

Description Usage Arguments Details Value

View source: R/4-viewpoint-regression.R

Description

Fits a viewpoint regression model. The following routines must be run first:

  1. compute_viewpoints

  2. compute_ppm_analyses

  3. compute_model_matrix

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
viewpoint_regression(
  parent_dir,
  max_iter = 500,
  perm_int = TRUE,
  perm_int_seed = 1,
  perm_int_reps = 5,
  allow_negative_weights = FALSE,
  viewpoint_dir = file.path(parent_dir, "0-viewpoints"),
  model_matrix_dir = file.path(parent_dir, "2-model-matrix"),
  output_dir = file.path(parent_dir, "3-viewpoint-regression")
)

Arguments

parent_dir

(Character scalar) The parent directory for the output files, shared with functions such as compute_viewpoints and compute_ppm_analyses. Ignored if all other directory arguments are manually specified.

max_iter

(Integer scalar) Maximum number of iterations for the optimisation routine.

perm_int

(Logical scalar) Whether to compute permutation-based feature importances.

perm_int_seed

(Integer scalar) Random seed for the permutation-based feature importances.

perm_int_reps

(Integer scalar) Number of replicates for the permutation-based feature importances (the final estimates are averages over these replicates).

allow_negative_weights

(Logical scalar) Whether negative weights should be allowed for discrete features (FALSE by default).

viewpoint_dir

(Character scalar) The directory for the already-generated output files from compute_viewpoints. The default should be correct if the user used the default dir argument in compute_viewpoints.

model_matrix_dir

(Character scalar) The directory for the already-generated output files from compute_model_matrix. The default should be correct if the user used the default dir argument in compute_model_matrix.

output_dir

(Character scalar) The output directory for the new results. Will be created if it doesn't exist already.

Details

The optimisation method is "BFGS" if allow_negative_weights is TRUE and "L-BFGS-B" otherwise (see optim).

Value

The primary output is a viewpoint regression model object written to disk in the dir directory. This object contains the fitted viewpoint regression weights and feature importance analyses. Various plots may be constructed from this object:


pmcharrison/hvr documentation built on April 14, 2020, 2:47 a.m.