Title: | Fuzzy and Non-Fuzzy Classifiers |
Version: | 0.1.6 |
Description: | It provides classifiers which can be used for discrete variables and for continuous variables based on the Naive Bayes and Fuzzy Naive Bayes hypothesis. Those methods were developed by researchers belong to the 'Laboratory of Technologies for Virtual Teaching and Statistics (LabTEVE)' and 'Laboratory of Applied Statistics to Image Processing and Geoprocessing (LEAPIG)' at 'Federal University of Paraiba, Brazil'. They considered some statistical distributions and their papers were published in the scientific literature, as for instance, the Gaussian classifier using fuzzy parameters, proposed by 'Moraes, Ferreira and Machado' (2021) <doi:10.1007/s40815-020-00936-4>. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.2.3 |
Imports: | caTools, doParallel, e1071, EnvStats, foreach, MASS, mvtnorm, parallel, purrr, Rdpack, rootSolve, stats, trapezoid |
RdMacros: | Rdpack |
Depends: | R (≥ 2.10) |
Suggests: | testthat (≥ 3.0.0), knitr, rmarkdown, maxLik, dplyr |
VignetteBuilder: | knitr |
Config/testthat/edition: | 3 |
URL: | https://github.com/leapigufpb/FuzzyClass |
BugReports: | https://github.com/leapigufpb/FuzzyClass/issues |
Language: | en-US |
NeedsCompilation: | no |
Packaged: | 2024-02-14 14:05:53 UTC; j0d4 |
Author: | Jodavid Ferreira |
Maintainer: | Jodavid Ferreira <jodavid@protonmail.com> |
Repository: | CRAN |
Date/Publication: | 2024-02-14 17:50:02 UTC |
FuzzyClass: Fuzzy and Non-Fuzzy Classifiers
Description
It provides classifiers which can be used for discrete variables and for continuous variables based on the Naive Bayes and Fuzzy Naive Bayes hypothesis. Those methods were developed by researchers belong to the 'Laboratory of Technologies for Virtual Teaching and Statistics (LabTEVE)' and 'Laboratory of Applied Statistics to Image Processing and Geoprocessing (LEAPIG)' at 'Federal University of Paraiba, Brazil'. They considered some statistical distributions and their papers were published in the scientific literature, as for instance, the Gaussian classifier using fuzzy parameters, proposed by 'Moraes, Ferreira and Machado' (2021) doi:10.1007/s40815-020-00936-4.
Author(s)
Maintainer: Jodavid Ferreira jodavid@protonmail.com (ORCID)
Other contributors:
Ronei Moraes ronei@de.ufpb.br (ORCID) [contributor]
Arthur Ricardo arthur.ricardo17@gmail.com [contributor]
See Also
Useful links:
Report bugs at https://github.com/leapigufpb/FuzzyClass/issues
Double Weighted Fuzzy Gamma Naive Bayes
Description
DWFuzzyGammaNaiveBayes
Double Weighted Fuzzy Gamma Naive Bayes
Usage
DWFuzzyGammaNaiveBayes(train, cl, cores = 2, fuzzy = TRUE, wdelta, weta)
Arguments
train |
matrix or data frame of training set cases. |
cl |
factor of true classifications of training set |
cores |
how many cores of the computer do you want to use to use for prediction (default = 2) |
fuzzy |
boolean variable to use the membership function |
wdelta |
vector weight each class |
weta |
vector weight each feature |
Value
A vector of classifications
References
Moraes RM, Soares EAMG, Machado LS (2020). “A double weighted fuzzy gamma naive bayes classifier.” Journal of Intelligent & Fuzzy Systems, 38(1), 577–588.
Examples
set.seed(1) # determining a seed
data(GamWeightData)
# Splitting into Training and Testing
split <- caTools::sample.split(t(GamWeightData[, 1]), SplitRatio = 0.7)
Train <- subset(GamWeightData, split == "TRUE")
Test <- subset(GamWeightData, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -4]
fit_NBT <- DWFuzzyGammaNaiveBayes(
train = Train[, -4],
cl = Train[, 4], cores = 2,
wdelta = c(2.002/6,1.998/6,2.000/6),
weta = c(3/10,2/10, 5/10)
)
pred_NBT <- predict(fit_NBT, test)
head(pred_NBT)
head(Test[, 4])
Fuzzy Exponential Naive Bayes Classifier with Fuzzy parameters
Description
ExpNBFuzzyParam
Fuzzy Exponential Naive Bayes Classifier with Fuzzy parameters
Usage
ExpNBFuzzyParam(train, cl, alphacut = 1e-04, metd = 2, cores = 2)
Arguments
train |
matrix or data frame of training set cases |
cl |
factor of true classifications of training set |
alphacut |
value of the alpha-cut parameter, this value is between 0 and 1. |
metd |
Method of transforming the triangle into scalar, It is the type of data entry for the test sample, use metd 1 if you want to use the Yager technique, metd 2 if you want to use the Q technique of the uniformity test (article: Directional Statistics and Shape analysis), and metd 3 if you want to use the Thorani technique |
cores |
how many cores of the computer do you want to use to use for prediction (default = 2) |
Value
A vector of classifications
References
Rodrigues AK, Batista TV, Moraes RM, Machado LS (2016). “A new exponential naive bayes classifier with fuzzy parameters.” In 2016 IEEE International Conference on Fuzzy Systems (FUZZ-IEEE), 1188–1194. IEEE.
Examples
set.seed(1) # determining a seed
data(VirtualRealityData)
# Splitting into Training and Testing
split <- caTools::sample.split(t(VirtualRealityData[, 1]), SplitRatio = 0.7)
Train <- subset(VirtualRealityData, split == "TRUE")
Test <- subset(VirtualRealityData, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -4]
fit_FENB <- ExpNBFuzzyParam(
train = Train[, -4],
cl = Train[, 4], metd = 1, cores = 2
)
pred_FENB <- predict(fit_FENB, test)
head(pred_FENB)
head(Test[, 4])
Fuzzy Bayes Rule
Description
FuzzyBayesRule
Fuzzy Bayes Rule
Usage
FuzzyBayesRule(train, cl, cores = 2, fuzzy = TRUE)
Arguments
train |
matrix or data frame of training set cases. |
cl |
factor of true classifications of training set |
cores |
how many cores of the computer do you want to use to use for prediction (default = 2) |
fuzzy |
boolean variable to use the membership function |
Value
A vector of classifications
References
Moraes R, Machado L (2008). “Fuzzy Bayes Rule for On-Line Training Assessment in Virtual Reality Simulators.” Multiple-Valued Logic and Soft Computing, 14, 325-338.
Examples
set.seed(1) # determining a seed
data(iris)
# Splitting into Training and Testing
split <- caTools::sample.split(t(iris[, 1]), SplitRatio = 0.7)
Train <- subset(iris, split == "TRUE")
Test <- subset(iris, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -5]
fit_NBT <- FuzzyBayesRule(
train = Train[, -5],
cl = Train[, 5], cores = 2
)
pred_NBT <- predict(fit_NBT, test)
head(pred_NBT)
head(Test[, 5])
Fuzzy Beta Naive Bayes
Description
FuzzyBetaNaiveBayes
Fuzzy Beta Naive Bayes
Usage
FuzzyBetaNaiveBayes(train, cl, cores = 2, fuzzy = TRUE)
Arguments
train |
matrix or data frame of training set cases. |
cl |
factor of true classifications of training set |
cores |
how many cores of the computer do you want to use to use for prediction (default = 2) |
fuzzy |
boolean variable to use the membership function |
Value
A vector of classifications
References
Moraes RM, Rodrigues AKG, Soares EAMG, Machado LS (2020). “A new fuzzy beta naive Bayes classifier.” In Developments of Artificial Intelligence Technologies in Computation and Robotics: Proceedings of the 14th International FLINS Conference (FLINS 2020), 437–445. World Scientific.
Examples
set.seed(1) # determining a seed
data(iris)
# Splitting into Training and Testing
split <- caTools::sample.split(t(iris[, 1]), SplitRatio = 0.7)
Train <- subset(iris, split == "TRUE")
Test <- subset(iris, split == "FALSE")
#----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -5]
fit_NBT <- FuzzyBetaNaiveBayes(
train = Train[, -5],
cl = Train[, 5], cores = 2
)
pred_NBT <- predict(fit_NBT, test)
head(pred_NBT)
head(Test[, 5])
Fuzzy Binomial Naive Bayes
Description
FuzzyBinomialNaiveBayes
Fuzzy Binomial Naive Bayes
Usage
FuzzyBinomialNaiveBayes(train, cl, cores = 2, fuzzy = TRUE)
Arguments
train |
matrix or data frame of training set cases. |
cl |
factor of true classifications of training set |
cores |
how many cores of the computer do you want to use to use for prediction (default = 2) |
fuzzy |
boolean variable to use the membership function |
Value
A vector of classifications
References
Moraes RM, Machado LS (2016). “A Fuzzy Binomial Naive Bayes classifier for epidemiological data.” In 2016 IEEE International Conference on Fuzzy Systems (FUZZ-IEEE), 745–750. IEEE.
Examples
set.seed(1) # determining a seed
class1 <- data.frame(vari1 = rbinom(100,size = 10, prob = 0.2),
vari2 = rbinom(100,size = 10, prob = 0.2),
vari3 = rbinom(100,size = 10, prob = 0.2), class = 1)
class2 <- data.frame(vari1 = rbinom(100,size = 10, prob = 0.5),
vari2 = rbinom(100,size = 10, prob = 0.5),
vari3 = rbinom(100,size = 10, prob = 0.5), class = 2)
class3 <- data.frame(vari1 = rbinom(100,size = 10, prob = 0.8),
vari2 = rbinom(100,size = 10, prob = 0.8),
vari3 = rbinom(100,size = 10, prob = 0.8), class = 3)
data <- rbind(class1,class2,class3)
# Splitting into Training and Testing
split <- caTools::sample.split(t(data[, 1]), SplitRatio = 0.7)
Train <- subset(data, split == "TRUE")
Test <- subset(data, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -4]
fit_NBT <- FuzzyBinomialNaiveBayes(
train = Train[, -4],
cl = Train[, 4], cores = 2
)
pred_NBT <- predict(fit_NBT, test)
head(pred_NBT)
head(Test[, 4])
Fuzzy Exponential Naive Bayes
Description
FuzzyExponentialNaiveBayes
Fuzzy Exponential Naive Bayes
Usage
FuzzyExponentialNaiveBayes(train, cl, cores = 2, fuzzy = TRUE)
Arguments
train |
matrix or data frame of training set cases. |
cl |
factor of true classifications of training set |
cores |
how many cores of the computer do you want to use to use for prediction (default = 2) |
fuzzy |
boolean variable to use the membership function |
Value
A vector of classifications
References
Moraes RM, Machado LS (2016). “A fuzzy exponential naive bayes classifier.” In Uncertainty Modelling in Knowledge Engineering and Decision Making: Proceedings of the 12th International FLINS Conference, 207–212. World Scientific.
Examples
set.seed(1) # determining a seed
data(iris)
# Splitting into Training and Testing
split <- caTools::sample.split(t(iris[, 1]), SplitRatio = 0.7)
Train <- subset(iris, split == "TRUE")
Test <- subset(iris, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -5]
fit_NBT <- FuzzyExponentialNaiveBayes(
train = Train[, -5],
cl = Train[, 5], cores = 2
)
pred_NBT <- predict(fit_NBT, test)
head(pred_NBT)
head(Test[, 5])
Fuzzy Gamma Naive Bayes
Description
FuzzyGammaNaiveBayes
Fuzzy Gamma Naive Bayes
Usage
FuzzyGammaNaiveBayes(train, cl, cores = 2, fuzzy = TRUE)
Arguments
train |
matrix or data frame of training set cases. |
cl |
factor of true classifications of training set |
cores |
how many cores of the computer do you want to use to use for prediction (default = 2) |
fuzzy |
boolean variable to use the membership function |
Value
A vector of classifications
References
Moraes RM, Soares EAMG, Machado LS (2018). “A Fuzzy Gamma Naive Bayes Classifier.” In Data Science and Knowledge Engineering for Sensing Decision Support: Proceedings of the 13th International FLINS Conference (FLINS 2018), 691–699. World Scientific.
Examples
set.seed(1) # determining a seed
data(iris)
# Splitting into Training and Testing
split <- caTools::sample.split(t(iris[, 1]), SplitRatio = 0.7)
Train <- subset(iris, split == "TRUE")
Test <- subset(iris, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -5]
fit_NBT <- FuzzyGammaNaiveBayes(
train = Train[, -5],
cl = Train[, 5], cores = 2
)
pred_NBT <- predict(fit_NBT, test)
head(pred_NBT)
head(Test[, 5])
Fuzzy Gaussian Naive Bayes Classifier Zadeh-based
Description
FuzzyGaussianNaiveBayes
Fuzzy Gaussian Naive Bayes Classifier Zadeh-based
Usage
FuzzyGaussianNaiveBayes(train, cl, cores = 2, fuzzy = TRUE)
Arguments
train |
matrix or data frame of training set cases. |
cl |
factor of true classifications of training set |
cores |
how many cores of the computer do you want to use to use for prediction (default = 2) |
fuzzy |
boolean variable to use the membership function |
Value
A vector of classifications
References
Moraes RM, Machado LS (2012). “Online Assessment in Medical Simulators Based on Virtual Reality Using Fuzzy Gaussian Naive Bayes.” Journal of Multiple-Valued Logic & Soft Computing, 18.
Examples
set.seed(1) # determining a seed
data(iris)
# Splitting into Training and Testing
split <- caTools::sample.split(t(iris[, 1]), SplitRatio = 0.7)
Train <- subset(iris, split == "TRUE")
Test <- subset(iris, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -5]
fit_GNB <- FuzzyGaussianNaiveBayes(
train = Train[, -5],
cl = Train[, 5], cores = 2
)
pred_GNB <- predict(fit_GNB, test)
head(pred_GNB)
head(Test[, 5])
Fuzzy Naive Bayes Geometric Classifier
Description
FuzzyGeoNaiveBayes
Naive Bayes Geometric Classifier
Usage
FuzzyGeoNaiveBayes(train, cl, cores = 2, fuzzy = T)
Arguments
train |
matrix or data frame of training set cases. |
cl |
factor of true classifications of training set |
cores |
how many cores of the computer do you want to use (default = 2) |
fuzzy |
boolean variable to use the membership function |
Value
A vector of classifications
References
Ferreira J, Lopes A, Machado L, Moraes R (2023). “A Novel Fuzzy Geometric Naive Bayes Network for Online Skills Assessment in Training Based on Virtual Reality.” In Proceedings of the 15th International Joint Conference on Computational Intelligence, 395–401.
Examples
set.seed(1) # determining a seed
class1 <- data.frame(vari1 = rgeom(100,prob = 0.2),
vari2 = rgeom(100,prob = 0.2),
vari3 = rgeom(100,prob = 0.2), class = 1)
class2 <- data.frame(vari1 = rgeom(100,prob = 0.5),
vari2 = rgeom(100,prob = 0.5),
vari3 = rgeom(100,prob = 0.5), class = 2)
class3 <- data.frame(vari1 = rgeom(100,prob = 0.9),
vari2 = rgeom(100,prob = 0.9),
vari3 = rgeom(100,prob = 0.9), class = 3)
data <- rbind(class1,class2,class3)
# Splitting into Training and Testing
split <- caTools::sample.split(t(data[, 1]), SplitRatio = 0.7)
Train <- subset(data, split == "TRUE")
Test <- subset(data, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -4]
fit_NBT <- FuzzyGeoNaiveBayes(
train = Train[, -4],
cl = Train[, 4], cores = 2
)
pred_NBT <- predict(fit_NBT, test)
head(pred_NBT)
head(Test[, 4])
Fuzzy Naive Bayes
Description
FuzzyNaiveBayes
Fuzzy Naive Bayes
Usage
FuzzyNaiveBayes(train, cl, fuzzy = TRUE, m = NULL, Pi = NULL)
Arguments
train |
matrix or data frame of training set cases |
cl |
factor of true classifications of training set |
fuzzy |
boolean variable to use the membership function |
m |
is M/N, where M is the number of classes and N is the number of train lines |
Pi |
is 1/M, where M is the number of classes |
Value
A vector of classifications
References
Moraes RM, Machado LS (2009). “Another approach for fuzzy naive bayes applied on online training assessment in virtual reality simulators.” In Proceedings of Safety Health and Environmental World Congress, 62–66.
Examples
# Example Fuzzy with Discrete Features
set.seed(1) # determining a seed
data(HouseVotes84)
# Splitting into Training and Testing
split <- caTools::sample.split(t(HouseVotes84[, 1]), SplitRatio = 0.7)
Train <- subset(HouseVotes84, split == "TRUE")
Test <- subset(HouseVotes84, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -1]
fit_FNB <- FuzzyNaiveBayes(
train = Train[, -1],
cl = Train[, 1]
)
pred_FNB <- predict(fit_FNB, test)
head(pred_FNB)
head(Test[, 1])
# Example Fuzzy with Continuous Features
set.seed(1) # determining a seed
data(iris)
# Splitting into Training and Testing
split <- caTools::sample.split(t(iris[, 1]), SplitRatio = 0.7)
Train <- subset(iris, split == "TRUE")
Test <- subset(iris, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -5]
fit_FNB <- FuzzyNaiveBayes(
train = Train[, -5],
cl = Train[, 5]
)
pred_FNB <- predict(fit_FNB, test)
head(pred_FNB)
head(Test[, 5])
Fuzzy Poisson Naive Bayes
Description
FuzzyPoissonNaiveBayes
Fuzzy Poisson Naive Bayes
Usage
FuzzyPoissonNaiveBayes(train, cl, cores = 2, fuzzy = TRUE)
Arguments
train |
matrix or data frame of training set cases. |
cl |
factor of true classifications of training set |
cores |
how many cores of the computer do you want to use to use for prediction (default = 2) |
fuzzy |
boolean variable to use the membership function |
Value
A vector of classifications
References
Moraes RM, Machado LS (2015). “A fuzzy poisson naive bayes classifier for epidemiological purposes.” In 2015 7th International Joint Conference on Computational Intelligence (IJCCI), volume 2, 193–198. IEEE.
Examples
set.seed(1) # determining a seed
class1 <- data.frame(vari1 = rpois(100,lambda = 2),
vari2 = rpois(100,lambda = 2),
vari3 = rpois(100,lambda = 2), class = 1)
class2 <- data.frame(vari1 = rpois(100,lambda = 1),
vari2 = rpois(100,lambda = 1),
vari3 = rpois(100,lambda = 1), class = 2)
class3 <- data.frame(vari1 = rpois(100,lambda = 5),
vari2 = rpois(100,lambda = 5),
vari3 = rpois(100,lambda = 5), class = 3)
data <- rbind(class1,class2,class3)
# Splitting into Training and Testing
split <- caTools::sample.split(t(data[, 1]), SplitRatio = 0.7)
Train <- subset(data, split == "TRUE")
Test <- subset(data, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -4]
fit_NBT <- FuzzyPoissonNaiveBayes(
train = Train[, -4],
cl = Train[, 4], cores = 2
)
pred_NBT <- predict(fit_NBT, test)
head(pred_NBT)
head(Test[, 4])
Fuzzy Naive Bayes Trapezoidal Classifier
Description
FuzzyTrapezoidalNaiveBayes
Fuzzy Naive Bayes Trapezoidal Classifier
Usage
FuzzyTrapezoidalNaiveBayes(train, cl, cores = 2, fuzzy = T)
Arguments
train |
matrix or data frame of training set cases. |
cl |
factor of true classifications of training set |
cores |
how many cores of the computer do you want to use to use for prediction (default = 2) |
fuzzy |
boolean variable to use the membership function |
Value
A vector of classifications
References
Lopes A, Ferreira J, Machado LS, Moraes RM (2022). “A New Fuzzy Trapezoidal Naive Bayes Network as basis for Assessment in Training based on Virtual Reality.” In The 15th International FLINS Conference on Machine learning, Multi agent and Cyber physical systems (FLINS 2022). Nankai University.
Examples
set.seed(1) # determining a seed
data(iris)
# Splitting into Training and Testing
split <- caTools::sample.split(t(iris[, 1]), SplitRatio = 0.7)
Train <- subset(iris, split == "TRUE")
Test <- subset(iris, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -5]
fit_NBT <- FuzzyTrapezoidalNaiveBayes(
train = Train[, -5],
cl = Train[, 5], cores = 2
)
pred_NBT <- predict(fit_NBT, test)
head(pred_NBT)
head(Test[, 5])
Fuzzy Naive Bayes Triangular Classifier
Description
FuzzyTriangularNaiveBayes
Fuzzy Naive Bayes Triangular Classifier
Usage
FuzzyTriangularNaiveBayes(train, cl, cores = 2, fuzzy = TRUE)
Arguments
train |
matrix or data frame of training set cases. |
cl |
factor of true classifications of training set |
cores |
how many cores of the computer do you want to use to use for prediction (default = 2) |
fuzzy |
boolean variable to use the membership function |
Value
A vector of classifications
References
Moraes RM, Silva ILA, Machado LS (2020). “Online skills assessment in training based on virtual reality using a novel fuzzy triangular naive Bayes network.” In Developments of Artificial Intelligence Technologies in Computation and Robotics: Proceedings of the 14th International FLINS Conference (FLINS 2020), 446–454. World Scientific.
Examples
set.seed(1) # determining a seed
data(iris)
# Splitting into Training and Testing
split <- caTools::sample.split(t(iris[, 1]), SplitRatio = 0.7)
Train <- subset(iris, split == "TRUE")
Test <- subset(iris, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -5]
fit_NBT <- FuzzyTriangularNaiveBayes(
train = Train[, -5],
cl = Train[, 5], cores = 2
)
pred_NBT <- predict(fit_NBT, test)
head(pred_NBT)
head(Test[, 5])
Gamma Weighted Data
Description
A dataset simulated containing training data from a Gamma Distribution
Usage
GamWeightData
Format
A dataset with 600 rows and 4 variables with 1 label.
Fuzzy Gaussian Naive Bayes Classifier with Fuzzy parameters
Description
GauNBFuzzyParam
Fuzzy Gaussian Naive Bayes Classifier with Fuzzy parameters
Usage
GauNBFuzzyParam(train, cl, alphacut = 1e-04, metd = 2, cores = 2)
Arguments
train |
matrix or data frame of training set cases. |
cl |
factor of true classifications of training set |
alphacut |
value of the alpha-cut parameter, this value is between 0 and 1. |
metd |
Method of transforming the triangle into scalar, It is the type of data entry for the test sample, use metd 1 if you want to use the Yager technique, metd 2 if you want to use the Q technique of the uniformity test (article: Directional Statistics and Shape analysis), and metd 3 if you want to use the Thorani technique |
cores |
how many cores of the computer do you want to use to use for prediction (default = 2) |
Value
A vector of classifications
References
Moraes RM, Ferreira JA, Machado LS (2021). “A New Bayesian Network Based on Gaussian Naive Bayes with Fuzzy Parameters for Training Assessment in Virtual Simulators.” International Journal of Fuzzy Systems, 23(3), 849–861.
Examples
set.seed(1) # determining a seed
data(iris)
# Splitting into Training and Testing
split <- caTools::sample.split(t(iris[, 1]), SplitRatio = 0.7)
Train <- subset(iris, split == "TRUE")
Test <- subset(iris, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -5]
fit_FGNB <- GauNBFuzzyParam(
train = Train[, -5],
cl = Train[, 5], metd = 1, cores = 2
)
pred_FGNB <- predict(fit_FGNB, test)
head(pred_FGNB)
head(Test[, 5])
United States Congressional Voting Records 1984
Description
This data set includes votes for each of the U.S. House of Representatives Congressmen on the 16 key votes identified by the CQA. The CQA lists nine different types of votes: voted for, paired for, and announced for (these three simplified to yea), voted against, paired against, and announced against (these three simplified to nay), voted present, voted present to avoid conflict of interest, and did not vote or otherwise make a position known (these three simplified to an unknown disposition).
Usage
data(HouseVotes84)
Format
A data frame with 435 observations on 17 variables:
1 | Class Name: 2 (democrat, republican) |
2 | handicapped-infants: 2 (y,n) |
3 | water-project-cost-sharing: 2 (y,n) |
4 | adoption-of-the-budget-resolution: 2 (y,n) |
5 | physician-fee-freeze: 2 (y,n) |
6 | el-salvador-aid: 2 (y,n) |
7 | religious-groups-in-schools: 2 (y,n) |
8 | anti-satellite-test-ban: 2 (y,n) |
9 | aid-to-nicaraguan-contras: 2 (y,n) |
10 | mx-missile: 2 (y,n) |
11 | immigration: 2 (y,n) |
12 | synfuels-corporation-cutback: 2 (y,n) |
13 | education-spending: 2 (y,n) |
14 | superfund-right-to-sue: 2 (y,n) |
15 | crime: 2 (y,n) |
16 | duty-free-exports: 2 (y,n) |
17 | export-administration-act-south-africa: 2 (y,n) |
Source
Source: Congressional Quarterly Almanac, 98th Congress, 2nd session 1984, Volume XL: Congressional Quarterly Inc., ington, D.C., 1985
Donor: Jeff Schlimmer (Jeffrey.Schlimmer@a.gp.cs.cmu.edu)
These data have been taken from the UCI Repository Of Machine Learning Databases at
and were converted to R format by Friedrich Leisch.
References
Newman, D.J. & Hettich, S. & Blake, C.L. & Merz, C.J. (1998). UCI Repository of machine learning databases [https://archive.ics.uci.edu/datasets]. Irvine, CA: University of California, Department of Information and Computer Science.
Examples
data(HouseVotes84)
summary(HouseVotes84)
Fuzzy Poisson Naive Bayes Classifier with Fuzzy parameters
Description
PoiNBFuzzyParam
Fuzzy Poisson Naive Bayes Classifier with Fuzzy parameters
Usage
PoiNBFuzzyParam(train, cl, alphacut = 1e-04, metd = 2, cores = 2)
Arguments
train |
matrix or data frame of training set cases. |
cl |
factor of true classifications of training set |
alphacut |
value of the alpha-cut parameter, this value is between 0 and 1. |
metd |
Method of transforming the triangle into scalar, It is the type of data entry for the test sample, use metd 1 if you want to use the Yager technique, metd 2 if you want to use the Q technique of the uniformity test (article: Directional Statistics and Shape analysis), and metd 3 if you want to use the Thorani technique |
cores |
how many cores of the computer do you want to use to use for prediction (default = 2) |
Value
A vector of classifications
References
Soares E, Machado L, Moraes R (2016). “Assessment of poisson naive bayes classifier with fuzzy parameters using data from different statistical distributions.” In IV Bazilian Congress on Fuzzy Sistems (CBSF 2016), volume 1, 57–68.
Examples
set.seed(1) # determining a seed
class1 <- data.frame(vari1 = rpois(100,lambda = 2),
vari2 = rpois(100,lambda = 2),
vari3 = rpois(100,lambda = 2), class = 1)
class2 <- data.frame(vari1 = rpois(100,lambda = 1),
vari2 = rpois(100,lambda = 1),
vari3 = rpois(100,lambda = 1), class = 2)
class3 <- data.frame(vari1 = rpois(100,lambda = 5),
vari2 = rpois(100,lambda = 5),
vari3 = rpois(100,lambda = 5), class = 3)
data <- rbind(class1,class2,class3)
# Splitting into Training and Testing
split <- caTools::sample.split(t(data[, 1]), SplitRatio = 0.7)
Train <- subset(data, split == "TRUE")
Test <- subset(data, split == "FALSE")
# ----------------
# matrix or data frame of test set cases.
# A vector will be interpreted as a row vector for a single case.
test <- Test[, -4]
fit_FPoiNB <- PoiNBFuzzyParam(
train = Train[, -4],
cl = Train[, 4], metd = 1, cores = 2
)
pred_FPoiNB <- predict(fit_FPoiNB, test)
head(pred_FPoiNB)
head(Test[, 4])
Fuzzy Rule-based System
Description
FuzzyRuleBasedSystem
Fuzzy Rule-based System
Usage
Set.Universe(minX, maxX)
TriFS(U, a, b, c)
TraFS(U, a, b, c, d)
GauFS(U, m, s)
uniFS(U, FS, FS1, FS2)
compFS(U, FS)
dmFS(x, U, FS)
centroidFS(U, FS)
OR(FRBS, x, y)
AND(FRBS, x, y)
NOT(FRBS, x)
Implication(FRBS, x, U, FS)
Aggregation(FRBS, U, Lst)
plotFS(Universe, FS)
References
Moraes RM, Rodrigues AKG, Soares EAMG, Machado LS (2020). “A new fuzzy beta naive Bayes classifier.” In Developments of Artificial Intelligence Technologies in Computation and Robotics: Proceedings of the 14th International FLINS Conference (FLINS 2020), 437–445. World Scientific.
Examples
## Creating Fuzzy Variables and Fuzzy Partitions
## Example 1 - It is the same of the R-Package 'Sets'
## Creating Fuzzy Variables and Fuzzy Partitions
## Example is the same of the R-Package 'Sets'
## One Domain was used for Evaluation and Tip
## Universe X - evaluation by the consumer in [0,10]
minX = 0
maxX = 25
X <- Set.Universe(minX, maxX)
FRBS = "Mandani"
## Service
service.poor <- GauFS(X, 0.0, 1.5)
#plotFS(X,service.poor)
service.good <- GauFS(X, 5.0, 1.5)
#plotFS(X,service.good)
service.excelent <- GauFS(X, 10, 1.5)
#plotFS(X,service.excelent)
## Food
food.rancid <- TraFS(X, 0, 0, 2, 4)
#plotFS(X,food.rancid)
food.delicious <- TraFS(X, 7, 9, 10, 10)
#plotFS(X,food.delicious)
## Tip
tip.cheap <- TriFS(X, 0, 5, 10)
#plotFS(X,tip.cheap)
tip.average <- TriFS(X, 7.5, 12.5, 17.5)
#plotFS(X,tip.average)
tip.generous <- TriFS(X, 15, 20, 25)
#plotFS(X,tip.generous)
## Set the input
## Evaluation by the consumer (Facts)
service = 3
food = 8
## Rules -- Specify rules and add outputs in a list
## A list is created in order to store the output of each rule
## Out_Rules_Lst <- list()
## 1) IF service is poor OR food is rancid THEN tip is cheap
## antecedent of the rule
## temp <- NOT(FRBS, dmFS(service,X,service.poor))
temp <- OR(FRBS, dmFS(service,X,service.poor), dmFS(food,X,food.rancid))
# consequent of the rule
fr1 <- Implication(FRBS, temp, X, tip.cheap)
plotFS(X,fr1)
## 2) IF service is good THEN tip is average
## temp <- NOT(FRBS, dmFS(service,X,service.good))
temp <- dmFS(service,X,service.good)
fr2 <- Implication(FRBS, temp, X, tip.average)
plotFS(X,fr2)
## Cria lista com as saidas. Precisa de duas para dar certo
Out_Rules_Lst <- list(fr1,fr2)
## 3) IF service is excelent OR food is delicious THEN tip is generous
## temp <- NOT(OR(FRBS, dmFS(service,X,service.excelent), dmFS(food,X,food.delicious)))
temp <- OR(FRBS, dmFS(service,X,service.excelent), dmFS(food,X,food.delicious))
fr3 <- Implication(FRBS, temp, X, tip.generous)
plotFS(X,fr3)
## Cria uma nova lista com a saída. Agora é possível concatenar as listas
lst_aux <- list(fr3)
## Compute the agregation of all previous Rules
## Concatenando as listas
Out_Rules_Lst <- c(Out_Rules_Lst, lst_aux)
## Numero de regras eh o comprimento da lista
length(Out_Rules_Lst)
OutFS <-Aggregation(FRBS, X, Out_Rules_Lst)
plotFS(X,OutFS)
## Compute centroid in order provide final decision
FinalDecision <- centroidFS(X,OutFS)
FinalDecision
Simulated Data
Description
A dataset containing training data from Gammma Distribuition
Usage
SimulatedData
Format
A dataset with 600 rows and 4 variables with 1 label.
Virtual Reality Simulator Data
Description
A dataset containing training data from a virtual reality simulator
Usage
VirtualRealityData
Format
A dataset with 600 rows and 4 variables with 1 label.