-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTrainingExample.java
More file actions
executable file
·56 lines (47 loc) · 1.3 KB
/
TrainingExample.java
File metadata and controls
executable file
·56 lines (47 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package bric.LogisticRegression;
/**
* A <code>TrainingExample</code> is used to tune the hypothesis of a
* <code>LogisticeRegression</code>. Each object consists of inputs
* for each feature and the correct classification.
* Note: The classifications must be consecutive starting from 0;
* @author BrianCarlsen
*/
public class TrainingExample {
//INSTANCE FIELDS
private double[] input;
private int answer;
//CONSTRUCTOR
public TrainingExample(double[] i, int a) {
input = i;
answer = a;
}
public double[] getInput() {
return input;
}
public void setInput(double[] i) {
input = i;
}
public int getAnswer() {
return answer;
}
public void show() {
System.out.print("Answer: " + answer + "\t");
for (double d : input)
System.out.print(d + ", ");
System.out.println();
}
@Override
public String toString() {
String s = "Answer: " + answer + "\t";
for (double d : input)
s += (d + ", ");
s = s.substring(0, s.length() - 2);
return s;
}
public static void main(String...args) {
}
}