Naive Bayes is a simple technique for constructing classifiers: models that assign class labels to problem instances, represented as vectors of feature values, where the class labels are drawn from some finite set. It is not a single algorithm for training such classifiers, but a family of algorithms based on a common principle: all naive Bayes classifiers assume that the value of a particular feature is independent of the value of any other feature, given the class variable. For example, a fruit may be considered to be an apple if it is red, round, and about 10 cm in diameter. A naive Bayes classifier considers each of these features to contribute independently to the probability that this fruit is an apple, regardless of any possible correlations between the color, roundness, and diameter features.
Requirements:
==========
2 Jar Files
--> weka-3.7.3.jar
2 Datasets
How to Implement:
==============
ClevelandHeartDiseaseTrainingDataset.arff contains lot of patients Health Records. It has 5 attributes and 1 class attribute.
1) sex: patient sex (1 = male, 0 = female),
2) cp: chest pain type (1 = typical angina, 2 = atypical angina, 3 = non-anginal pain, 4 = asymptomatic),
3) slope: the slope of the peak exercise ST segment (1 = upsloping, 2 = flat, 3 = downsloping)
4) ca: number of major vessels (0-3) colored by flourosopy
5) thal: (3 = normal, 6 = fixed defect, 7 = reversable defect)
6) class: (0 = no heart disease, 1 = presence of heart disease)
This Classification Algorithm classify this training dataset. After Classification, it generate some classification rules. Followed by, this algorithm load ClevelandHeartDiseaseTestingDataset.arff. This testing dataset contains 5 attributes with one class attribute. This class attribute contains (?) question mark. Because we predict each testing record is possible to presence of heart disease or not. Then this classification algorithm predicts each records class attribute value based on classification rules (It is generated after Training Process).
How to Run this Code in Command Prompt:
===================================
>set classpath=%classpath%;weka-3.7.1-beta.jar;
>set classpath=%classpath%;weka-3.7.3.jar;
>javac NaiveBayesClassification.java
>java NaiveBayesClassification
Output: NaiveBayesOutput.txt
No comments:
Post a Comment