Learn R Programming

lfl (version 1.0)

pbld: Perform a Perception-based Logical Deduction (PbLD) with given rule-base on given dataset

Description

Take a set of rules (a rule-base) and perform a Perception-based Logical Deduction (PbLD) on each row of a given fsets object.

Usage

pbld(x,
     rules,
     partition,
     values,
     type=c('global', 'local'),
     parallel=FALSE)

Arguments

x
Input to the inference. It should be an object of class fsets (e.g. created by using the fcut or lcut
rules
A rule-base (a.k.a. linguistic description) either in the form of the farules object or as a list of character vectors where each element is a fuzzy set name (a predicate) and thus each such
partition
A fsets object with columns corresponding to consequent predicates in rules. These membership degrees must correspond to values.
values
Crisp values that correspond to rows of memberhsip degrees in the partition matrix. Function assumes that the values are sorted in the ascending order.
type
The type of inference to use. It can be either "local" or "global" (default).
parallel
Whether the processing should be run in parallel or not. Parallelization is implemented using the foreach package. The parallel environment must be set properly in advance, e.g. with

Value

  • A vector of inferred defuzzified values. The number of resulting values corresponds to the number of rows of the x argument.

Details

Perform a Perception-based Logical Deduction (PbLD) with given rule-base rules on each row of input x. Columns of x are truth values of predicates that appear in the antecedent part of rules, partition together with values determine the shape of predicates in consequents: each element in values corresponds to a row of membership degrees in partition.

References

V. Novak, A comprehensive theory of trichotomous evaluative linguistic expressions, Fuzzy Sets and Systems 159 (22) (2008) 2939--2969.

See Also

lcut, searchrules, slices, fire, aggregate, defuzz

Examples

Run this code
# --- TRAINING PART ---
# split data into training and testing set
testing <- CO2[1:5, ]
training <- CO2[-1 * 1:5, ]

# custom context of the RHS variable
uptakeContext <- c(7, 28.3, 46)

# convert training data into fuzzy sets
d <- lcut3(training, context=list(uptake=uptakeContext))

# search for rules
r <- searchrules(d, lhs=1:38, rhs=39:58)

# --- TESTING PART ---
# convert testing data info fuzzy sets
x <- lcut3(testing, context=list(uptake=uptakeContext))

# prepare values and partition
v <- slices(uptakeContext[1], uptakeContext[3], 1000)
p <- lcut3(v, name='uptake', context=uptakeContext)

# do the inference
pbld(x, r, p, v)

Run the code above in your browser using DataLab