Last active
December 6, 2019 21:01
-
-
Save AlexTitovWork/1c9fa0c1d0938a0d3bf1f3551269b23c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DebitCreditWekaClassifier() { | |
/* | |
* Class for running an arbitrary classifier on data that has been passed through an arbitrary filter. | |
*/ | |
classifier = new FilteredClassifier(); | |
/** | |
* Class for building and using a multinomial Naive Bayes classifier. For more information see, | |
* Andrew Mccallum, Kamal Nigam: A Comparison of Event Models for Naive Bayes Text Classification. | |
* https://weka.sourceforge.io/doc.dev/weka/classifiers/bayes/NaiveBayesMultinomial.html | |
*/ | |
classifier.setClassifier(new NaiveBayesMultinomial()); | |
/** | |
* Declare text attribute to hold the message | |
*/ | |
Attribute attributeText = new Attribute("text", (List<String>) null); | |
/** | |
* Define the etalons or labels attribute and its values | |
*/ | |
ArrayList<String> classAttributeValues = new ArrayList<>(); | |
classAttributeValues.add("debit"); | |
classAttributeValues.add("credit"); | |
Attribute classAttribute = new Attribute("label", classAttributeValues); | |
/** | |
* Built the feature vector "wekaAttributes" | |
*/ | |
wekaAttributes = new ArrayList<>(); | |
wekaAttributes.add(classAttribute); | |
wekaAttributes.add(attributeText); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment