Title: | Fuzzy Logic Rule Classifier |
---|---|
Description: | FLR algorithm for classification |
Authors: | Constantinos Mavridis and Ioannis N. Athanasiadis |
Maintainer: | Constantinos Mavridis <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0 |
Built: | 2024-11-14 02:42:18 UTC |
Source: | https://github.com/cran/FLR |
Accuracy of the flr classification.
accIs(testData,testDataB)
accIs(testData,testDataB)
testData |
an input data.frame of the test after classification. |
testDataB |
an input data.frame of the original test data. |
return the accuracy of the classification
Dataset with 296 instances if 25 attributes.
data(dataset001)
data(dataset001)
A data frame with 296 instances on the following 25 variables.
state
9 US states.
county
County.
site.id
Site id.
latitude
Latitude.
longitude
Longtitude.
X2009.2011.dv
2009.2011 dv.
X2010.2012.dv
2010.2012 dv.
X2009.2011.design.value..ppm.2.3
2009-2011 design value (ppm)2,3
X2010.2012.design.value..ppm...estimated.
2010-2012 design value (ppm) [estimated].
X2009.2011.design.value.status4
2009-2011 design value status4.
percent.complete.in.20095
percent complete in 20095.
percent.complete.in.20105
percent complete in 20105.
percent.complete.in.20115
percent complete in 20115.
X2009.2011.average.percent.complete
2009-2011 average percent complete.
X..of.days.above.the.naaqs.in.2009
# of days above the naaqs in 2009.
X..of.days.above.the.naaqs.in.2010
# of days above the naaqs in 2010.
X..of.days.above.the.naaqs.in.2011
# of days above the naaqs in 2011.
X..of.days.above.the.naaqs.in.2012
# of days above the naaqs in 2012.
X4th.highest.daily.max.value.in.2009
4th highest daily max value in 2009.
X4th.highest.daily.max.value.in.2010
4th highest daily max value in 2010.
X4th.highest.daily.max.value.in.2011
4th highest daily max value in 2011.
X4th.highest.daily.max.value.in.2012.
4th highest daily max value in 2012.
column_27
Column_27.
column_29
Column_29.
class
Class category.
geocommons.com
geocommons.com
Denormalize fuzzy lattices.
denormDatal(fuzlat,bounds)
denormDatal(fuzlat,bounds)
fuzlat |
a fuzzy lattice containing mix and max value for each instance of the data set at the first columns,from left to right, followed by className and categ. |
bounds |
a 2 comumn matrix containing min and max value for each instance of the dataset. |
return denormalized fuzzy lattice.
Constructs a Fuzzy Lattice from an instance of the dataset.
fuzzyLatticec(dF,dR,bounds)
fuzzyLatticec(dF,dR,bounds)
dF |
an empty list containing just the names for each fuzzy lattice column. |
dR |
an instance of the dataset |
bounds |
a 2 comumn matrix containing min and max value for each instance of the dataset. |
return a fuzzy lattice (min and max value for each attribute, className,categ).
Returns a vector that contains the number of rules created for each class.
indexCalc(learnedCode)
indexCalc(learnedCode)
learnedCode |
a data.frame of fuzzy lattices. Each lattice is a rule created with the trainNow function. |
return a vector that contains the number of rules created for each class.
A matrix containing the distances of the nodes in a graph.
data(mat)
data(mat)
A data frame of 9 rows and 9 columns.
Illinois
number
Indiana
number
Kentucky
number
Michigan
number
North.Carolina
number
Ohio
number
Pennsylvania
number
Tennessee
number
Virginia
number
Normalize Data to be in range of 0~1.
normData(data1) denormData(data1,bounds)
normData(data1) denormData(data1,bounds)
data1 |
an input data.frame where last instance must be the class instance and be named 'class'. |
bounds |
a 2 comumn matrix containing min and max value for each instance of the dataset. |
return normalized or denormalized data.frame.
Alters the dataset in a form that can be used for training and classification.
prepData(data)
prepData(data)
data |
an input data.frame where last instance must be the class instance and be named 'class'. |
return the data.frame without missing class instances and converts nominal attributes into numeric.
Randomly flags instances in order to be used as training(0) or testing(1) data with the ratio depending on variable gg.
sepFlag(gg,data1)
sepFlag(gg,data1)
gg |
percentage of instances to be used as training data for the classification. |
data1 |
an input data.frame where last instance must be the class instance and be named 'class'. |
return original data with a flag column added at the end.
Creates a boundaries of min and max columns for each attribute of a dataset.
set_bounds(data1)
set_bounds(data1)
data1 |
an input data.frame where last instance must be the class instance and be named 'class'. |
return a data.frame of 2 columns (min,max) for each instance of the data(NOT class).
Creates a linear connection between spatial data in order to be used for classification.
spatdt(data,idx,mat,pre_order=0,snd=0) get.cost(zzz,mat) get.cost2(pre_order,mat) get.pos(instz) winner.route(cost)
spatdt(data,idx,mat,pre_order=0,snd=0) get.cost(zzz,mat) get.cost2(pre_order,mat) get.pos(instz) winner.route(cost)
data |
an input data.frame |
idx |
indicates the position of the spatial data attribute. |
mat |
a matrix indicating distances |
pre_order |
predefined order |
snd |
indicates which node will be used as the starting one. The default value 0 means that the best route will be chosen, without taking into consideration which the starting node will be. |
zzz |
a route |
instz |
instance |
cost |
cost of routes |
return a list of 3 objects: a) The modified dataset, b) winner route, c) the total distance of the route.
#Import data data(dataset001) data<-dataset001 data(mat) idx<-1 rhoa<-0.6 param<-"sigmoid" pre_order<-c(1,2,3,4,5,6,7,8,9) #Data preprocess data<-spatdt(data,idx,mat,pre_order)
#Import data data(dataset001) data<-dataset001 data(mat) idx<-1 rhoa<-0.6 param<-"sigmoid" pre_order<-c(1,2,3,4,5,6,7,8,9) #Data preprocess data<-spatdt(data,idx,mat,pre_order)
Creates testing and training samples from the original data.
testD(data2) trainD(data2)
testD(data2) trainD(data2)
data2 |
a data.frame flaged with the sepFlag function. |
return the training and testing samples that will be used for the classification.
Implements classification using FLR on a data.frame.
testNow(testData,learnedCode)
testNow(testData,learnedCode)
testData |
an input data.frame. |
learnedCode |
a data.frame of fuzzy lattices. Each lattice is a rule created with the trainNow function. |
return the testData data.frame after classification.
Creates rules for classification using FLR.
trainNow(trainData,param,rhoa=0.5,l=6,x0=0.5,EPSILON=10^(-6)) join(inpBuf,num) theta(x,x0,param) ufun(x,x0,l,param) valuation(fuzlat,x0,l,param) createNframe(trainData) createNlist(trainData)
trainNow(trainData,param,rhoa=0.5,l=6,x0=0.5,EPSILON=10^(-6)) join(inpBuf,num) theta(x,x0,param) ufun(x,x0,l,param) valuation(fuzlat,x0,l,param) createNframe(trainData) createNlist(trainData)
trainData |
an input data.frame. |
param |
parameter indicating linear positive valuation for 0 and sigmoid positive valuation for 1. The default value is set to 0. |
rhoa |
vigilance parameter in range [0,1]. The default value is set to 0.6. |
l |
parameter of u and theta functions of FLR. The default value is set to 6. |
x0 |
parameter of u and theta functions of FLR. The default value is set to 0.4. |
EPSILON |
parameter EPSILON.The default value is set to 10^(-6). |
inpBuf |
input buffer. |
num |
num |
x |
fuzzy lattice |
fuzlat |
fuzzy lattice |
return a data.frame of the learned code.