predict.supervised_model: Predict using a Previously Trained Model

predict.supervised_modelR Documentation

Predict using a Previously Trained Model

Description

Predict values based on a previously trained model.

Usage

ft_predict(
  model,
  newdata,
  k = 1L,
  threshold = 0,
  rval = c("sparse", "dense", "slam"),
  ...
)

Arguments

model

an object inheriting from 'fasttext'.

newdata

a character vector giving the new data.

k

an integer giving the number of labels to be returned.

threshold

a double withing [0, 1] giving lower bound on the probabilities. Predictions with probabilities below this lower bound are not returned. The default is 0 which means all predictions are returned.

rval

a character string controlling the return value, allowed values are "sparse", "dense" and "slam". The default is sparse, here the values are returned as a data.frame in a format similar to a simple triplet matrix (sometimes refereed to as the coordinate format). If rval is set to "dense", a matrix of the probabilities is returned. Similarly if rval is set to "slam", a matrix in the simple triplet sparse format from the slam package is returned.

...

currently not used.

Value

NULL if a 'result_file' is given otherwise if 'prob' is true a data.frame with the predicted labels and the corresponding probabilities, if 'prob' is false a character vector with the predicted labels.

Examples

## Not run: 
ft_predict(model, newdata)

## End(Not run)

fastTextR documentation built on June 22, 2024, 7:16 p.m.