predictKnn: Predict using a K-nearest neighbor (KNN) classifier

View source: R/Classify.R

predictKnnR Documentation

Predict using a K-nearest neighbor (KNN) classifier

Description

predictKnn uses a KNN classifier to generate predictions.

Usage

predictKnn(
  cohorts,
  covariates,
  indexFolder,
  k = 1000,
  weighted = TRUE,
  threads = 1
)

Arguments

cohorts

An Andromeda table containing the cohorts with predefined columns (see below).

covariates

An Andromeda table containing the covariates with predefined columns (see below).

indexFolder

Path to a local folder where the KNN classifier index can be stored.

k

The number of nearest neighbors to use to predict the outcome.

weighted

Should the prediction be weighted by the (inverse of the ) distance metric?

threads

Number of parallel threads to used for the computation.

Details

These columns are expected in the covariates object:

⁠rowId⁠ (integer) Row ID is used to link multiple covariates (x) to a single outcome (y)
⁠covariateId⁠ (integer) A numeric identifier of a covariate
⁠covariateValue⁠ (real) The value of the specified covariate

This column is expected in the covariates object:

⁠rowId⁠ (integer) Row ID is used to link multiple covariates (x) to a single outcome (y)

Value

A data.frame with two columns:

⁠rowId⁠ (integer) Row ID is used to link multiple covariates (x) to a single outcome (y)
⁠prediction⁠ (real) A number between 0 and 1 representing the probability of the outcome

OHDSI/BigKnn documentation built on March 21, 2023, 8:35 a.m.