Learn R Programming

labelrank (version 0.1)

nb_rank: Predicting label rankings based on the naive Bayes ranking model

Description

This function predicts the rankings given prior and conditional probabilities obtained from model_nbr

Usage

nb_rank(x, y, new.x, n = 1)

Arguments

x
is n x p matrix of n observations and p training attributes and can have continuous or nominal values.
y
is n x j matrix of label rankings
new.x
is a vector of new attributes
n
is a parameter of 'memory'; that is, how fast past gets forgotten. (see details of time_weights).

Value

a numeric vector of ranking

Details

This function predicts a ranking for test.x attributes. It initially builds a model for naive Bayes algorithm that calculates priors and conditional label ranking probabilities and then use them to predict rankings. The attributes can be nominal or continuous data.

Examples

Run this code
train.x <- lr.nom[1:16,]
test.x <- lr.nom[17,]
predrank <- nb_rank(train.x,y,test.x,n=1)

Run the code above in your browser using DataLab