predict.dgpage_projector: Predict method for a 'dgpage_projector' object

View source: R/dpage.R

predict.dgpage_projectorR Documentation

Predict method for a dgpage_projector object

Description

Extends the discriminant methods with a method="1nn" option that uses Rnanoflann for 1-nearest-neighbor classification in the projected space.

Usage

## S3 method for class 'dgpage_projector'
predict(
  object,
  new_data,
  method = c("1nn", "lda", "euclid"),
  type = c("class", "prob"),
  k = 1,
  ...
)

Arguments

object

A dgpage_projector object.

new_data

A numeric matrix (m x d).

method

One of c("1nn","lda","euclid"). Default "1nn".

type

If method="1nn", we only return "class". If method %in% c("lda","euclid"), we can do "class" or "prob".

k

Number of neighbors if using method="1nn". Default 1 (which is actually 1NN).

...

Not used (or pass method="lda" / type="prob").

Details

Otherwise, if method is "lda" or "euclid", we fall back to the standard predict.discriminant_projector method for linear discriminant or Euclidean nearest-mean classification in subspace.

Value

If method="1nn", a factor vector of length m. If method is "lda" or "euclid" and type="class", a factor of length m. If method="lda" or "euclid" and type="prob", an m x nclass matrix of posterior-like values.

See Also

predict.discriminant_projector


bbuchsbaum/discursive documentation built on April 14, 2025, 4:57 p.m.