predictPair: Predict which of a pair of rows has a higher criterion.

View source: R/row_pair_apply.R

predictPairR Documentation

Predict which of a pair of rows has a higher criterion.

Description

Given two rows and a fitted heuristic, returns the heuristic's prediction of whether the criterion of the first row will be greater than that of the 2nd row.

Usage

predictPair(row1, row2, object)

Arguments

row1

The first row of data. The cues object$cols_to_fit will be passed to the heuristic.

row2

The second row of data. The cues object$cols_to_fit will be passed to the heuristic.

object

The fitted heuristic, e.g. a fitted ttbModel or logRegModel. (More technically, it's any object that implements predictPairInternal.)

Value

A number in the set -1, 0, 1, where 1 means row1 is predicted to have a greater criterion, -1 means row2 is greater, and 0 is a guess or tie.

See Also

rowPairApply to get predictions for all row pairs of a matrix or data.frame.

Examples

##Fit column (5,4) to column (1,0), having validity 1.0, and column (0,1),
## validity 0.
train_matrix <- cbind(y=c(5,4), x1=c(1,0), x2=c(0,1))
singlecue <- singleCueModel(train_matrix, 1, c(2,3))
predictPair(oneRow(train_matrix, 1), oneRow(train_matrix, 2), singlecue)


jeanimal/heuristica documentation built on Feb. 3, 2024, 9:56 p.m.