Skip to content

Commit

Permalink
some small corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
drnoa committed Jan 25, 2017
1 parent 9c5e39b commit 8fd0c00
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/bayesbudgetclassification/Classification.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
public class Classification {

/*
* In the main class we create a bayes classifier and calculate the
* In the main class we create a Bayes classifier and calculate the
* probability for all budget positions
*/
public static void main(String[] args) {

// get feature vector definition
Instances featureVector = createFeatureVector();
// get the trainingsdata
Instances trainingsSet = buildTrainingsSet();
Instances trainingsSet = loadTrainingsSet();

System.out.println("*The Trainingsset we use looks like this:*");
System.out.println(trainingsSet);
Expand All @@ -49,15 +49,15 @@ public static void main(String[] args) {
naivebayes.buildClassifier(trainingsSet);
/*
* get the probability for each class this gives us the probability
* for each budgetposition
* for each budget position
*/
double[] probability = naivebayes.distributionForInstance(testData.firstInstance());

System.out.println("\n*the bayes classification calculates the following results*");

/*
* now we store all the probabilities in a hashmap togehter with the
* relatet budgetpositions
* now we store all the probabilities in a hashmap together with the
* related budget positions
*/
HashMap<Double, String> budgetmap = new LinkedHashMap<Double, String>();
ArrayList<String> budgetPositions = getBudgetPositions();
Expand All @@ -74,7 +74,7 @@ public static void main(String[] args) {

int budgetpositionindex = budgetPositions.indexOf(budgetmap.get(maxValueInMap));

// finaly we add the testet data and the budegetposition back to our
// finally we add the tested data and the budget position back to our
// trainingsset
learnNewTrainingData(budgetpositionindex);

Expand All @@ -84,9 +84,9 @@ public static void main(String[] args) {
}

/*
* In this class we create a
* In this class we load the trainingsdata from the .arff file
*/
private static Instances buildTrainingsSet() {
private static Instances loadTrainingsSet() {

/*
* Load the trainingset. In the example this are all the already
Expand All @@ -113,7 +113,7 @@ private static void learnNewTrainingData(int learnedclass) throws Exception {
* file.
*/
Instances testdata = defineTestdata(createFeatureVector());
Instances trainingsSet = buildTrainingsSet();
Instances trainingsSet = loadTrainingsSet();
Instance newdataset = testdata.get(0);

double[] instanceValue1 = newdataset.toDoubleArray();
Expand All @@ -139,7 +139,7 @@ private static void learnNewTrainingData(int learnedclass) throws Exception {
}

/*
* defines the Testdataset. This is the payment we like to check an classify
* defines the testdataset. This is the payment we like to check an classify
*/
private static Instances defineTestdata(Instances testData) {

Expand Down Expand Up @@ -205,7 +205,7 @@ private static Instances createFeatureVector() {
}

/*
* defines the possible budet positions
* defines the possible budget positions
*/
private static ArrayList<String> getBudgetPositions() {

Expand Down

0 comments on commit 8fd0c00

Please # to comment.