dotrules: Create a dictionary of trusted rules

Description Usage Arguments Value Examples

View source: R/dotrules.R

Description

The model fit a dictonary of rules based on the frequency by outcomes in the training sample in order to predict classes. The predictors are concatenated to create rules based on the training sample. Only the most frequent outocome is selected for each rule. The rules are then joined to the testing sample to predict the results. If there is no match, the closest rules is created by removing the last predictor, until the prediction is complete. The entropy of the rules is calculated based on the frequencies of every similar rules.

Usage

1
dotrules(data, x, y, sampsize = 0.1, sample = NULL, ...)

Arguments

data

data frame

x

vector of variable names of predictors

y

name of the response variable

sampsize

percentage, between 0 and 1, of samples to draw from data to differentiate between testing and training samples

sample

vector of train/test. If provided sampsize is ignored

...

others arguments

Value

The function will return a dotrules object which is a list of input data, rules, and accuracy metrics

Examples

1
2
3
4
5
6
7
8
data('lulc_data')

x <- c('maxlike_1985','DFU_85','maxlike_1991','DFU_91','maxlike_2000','DFU_00',
      'F00_3by3_W','F00_3by3_R','F00_3by3_B','F00_3by3_A','F00_3by3_U')
y <- 'maxlike_2015'

set.seed(999)
lulc_model <- dotrules(lulc_data,x,y, sampsize =.1)

romain-louvet/DotRules documentation built on May 27, 2019, 1:47 p.m.