reweights_test: Weights for Test dtm

View source: R/reweights_test.R

reweights_testR Documentation

Weights for Test dtm

Description

The aims of this function is to provide to a test Document-Term Matrix which will be used for test/predict the original weights computed for the training matrix.

Usage

reweights_test(target, original, normalize = TRUE, ..., fun = idf,
  original_weights = NULL, force = FALSE)

Arguments

target

A DocumentTermMatrix to weigtht

original

The original DocumentTermMatrix with the simple term-frequencies weights

normalize

(lgl) if TRUE (default) the weights are normalized wrt documents, i.e. row_sum equals 1 for every row.

...

Other parameters to called functions (e.g. fun)

fun

The function used to compute the original weigths. By default idf. (Suggestion is to not change this option!). It has to admit as first argument the orignial DocumentTermMatrix.

original_weights

optional numerical vector of weights to be used directly for the rewaighting of target

force

(lgl) if TRUE (default is FALSE) the function works also for simple_triplet_matrix which are not DocumentTermMatrix

Value

an object of class DocumentTermMatrix and simple_triplet_matrix (in the order).


UBESP-DCTV/costumer documentation built on Feb. 1, 2023, 4:52 a.m.