0
votes

I was trying the rulefit implemenatation in caret using the pre() function for a classification task. I used the below command to train the model

fit = pre(output~.,data=train)

I presume that the fit object created is a model, which has 'rules and original features' as its predictors and can be used in predicting on test data.

I am not clear on how to use this model to predict the output on the test data.

I tried the predict command predict(fit,test_data) to predict on test_data, the result that get is numeric vector, which has values ranging from .9 to 1.9

It would be helpful if someone can guide me on this.I would like if the fit object created is a model, and if yes how to use that to predict on testdata

Regards, JJ

2

2 Answers

1
votes

If output is a binary factor, you should specify family = binomial in the call to function pre(). Otherwise, a gaussian response distribution will be assumed by default (as is the case with most supervised learning methods in R). Make sure output is coded as a binary factor in train. See also ?pre.

The predicted values returned are on the scale of the linear predictor, by default, so they can take values from -Inf to Inf. To obtain predicted probabilities, you need to specify type = "response", or type = "class" for predicted class. See also ?predict.pre.

A short tutorial on package pre can be found here: https://github.com/marjoleinF/pre

0
votes

From the reference manual of pre package:

use predict.pre(pre_obj, newdata)