|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectstatistics.Sample
public class Sample
A more sophisticated way of storing a Sample. Includes label and data, provides some utility functions.
Field Summary | |
---|---|
int |
c
correct label |
double[] |
x
data vector |
int |
y
classified label |
Constructor Summary | |
---|---|
Sample(int c,
double[] x)
Generate a new sample with the correct label c |
|
Sample(int c,
int dim)
Generate a new (empty) sample |
|
Sample(Sample s)
|
Method Summary | |
---|---|
static Sample |
meanSubstract(java.util.List<Sample> data)
Subtract the mean value from all samples |
static java.util.ArrayList<Sample> |
reduceToClass(java.util.ArrayList<Sample> data,
int id)
Remove all data from a list which is not of label id |
static java.util.ArrayList<Sample> |
removeClass(java.util.ArrayList<Sample> data,
int id)
Remove samples of a certain class from the data set |
java.lang.String |
toString()
Return a String representation |
static java.util.ArrayList<Sample> |
unlabeledArrayListFromArray(double[][] data)
Create an ArrayList of Samples from a double array; one sample per row |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int c
public double[] x
public int y
Constructor Detail |
---|
public Sample(int c, double[] x)
c
- correct labelx
- datapublic Sample(int c, int dim)
c
- correct labeldim
- feature dimensionpublic Sample(Sample s)
Method Detail |
---|
public static Sample meanSubstract(java.util.List<Sample> data)
data
-
public static java.util.ArrayList<Sample> reduceToClass(java.util.ArrayList<Sample> data, int id)
data
- data setid
- target class
public static java.util.ArrayList<Sample> removeClass(java.util.ArrayList<Sample> data, int id)
data
- data setid
- target class
public java.lang.String toString()
toString
in class java.lang.Object
public static java.util.ArrayList<Sample> unlabeledArrayListFromArray(double[][] data)
data
- rows will be samples
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |