|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.udo.cs.mySVM.Examples.ExampleSet
public class ExampleSet
Implementation of a sparse example set which can be used for learning. This data structure is also used as SVM model.
Nested Class Summary | |
---|---|
static class |
ExampleSet.MeanVariance
This class holds information aboud the means and variances of an attribute. |
Field Summary | |
---|---|
private double[] |
alphas
The SVM alpha values. |
double[][] |
atts
The known attribute values for each example. |
private double |
b
The hyperplane offset. |
private int |
dim
The dimension of the example set. |
java.lang.String[] |
ids
The ids of all examples. |
int[][] |
index
The corresponding indices for the known attribute values for each example. |
private java.util.Map<java.lang.Integer,ExampleSet.MeanVariance> |
meanVarianceMap
This map stores the mean-variance informations about all attributes (att index --> mean-variance). |
private int |
train_size
The number of examples. |
private Example |
x
This example will be once constructed and delivered with the asked values. |
private double[] |
ys
The labels of the examples if known. -1 and +1 for classification or the real value for regression tasks. |
Constructor Summary | |
---|---|
ExampleSet(ExampleSet exampleSet,
Attribute labelAttribute,
boolean scale)
|
|
ExampleSet(ExampleSet exampleSet,
Attribute labelAttribute,
java.util.Map<java.lang.Integer,ExampleSet.MeanVariance> meanVariances)
Creates a fresh example set of the given size from the Yale example reader. |
|
ExampleSet(int size,
double b)
Creates an empty example set of the given size. |
|
ExampleSet(java.io.ObjectInputStream in)
Reads an example set from the given input stream. |
Method Summary | |
---|---|
void |
clearAlphas()
|
int |
count_examples()
Counts the training examples. |
int |
count_pos_examples()
Counts the positive training examples |
private static java.util.Map<java.lang.Integer,ExampleSet.MeanVariance> |
createMeanVariances(ExampleSet exampleSet)
|
double |
get_alpha(int pos)
Gets an alpha-value. |
double[] |
get_alphas()
Gets the alpha array. |
double |
get_b()
get b |
int |
get_dim()
Gets the dimension of the examples |
Example |
get_example(int pos)
Gets an example. |
double |
get_y(int pos)
Gets an y-value. |
double[] |
get_ys()
Gets the y array |
java.lang.String |
getId(int index)
|
java.util.Map<java.lang.Integer,ExampleSet.MeanVariance> |
getMeanVariances()
|
int |
getNumberOfSupportVectors()
|
void |
set_alpha(int pos,
double alpha)
sets an alpha value. |
void |
set_b(double new_b)
set b |
void |
set_y(int pos,
double y)
Sets the label value for the specified example. |
void |
swap(int pos1,
int pos2)
swap two training examples |
java.lang.String |
toString()
|
java.lang.String |
toString(boolean onlySV)
|
java.lang.String |
toString(int numberOfExamples,
boolean onlySV)
|
void |
writeSupportVectors(java.io.ObjectOutputStream out)
Writes the example set into the given output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private int dim
private int train_size
public double[][] atts
public int[][] index
public java.lang.String[] ids
private double[] alphas
private double[] ys
private double b
private Example x
private java.util.Map<java.lang.Integer,ExampleSet.MeanVariance> meanVarianceMap
Constructor Detail |
---|
public ExampleSet(int size, double b)
public ExampleSet(ExampleSet exampleSet, Attribute labelAttribute, boolean scale)
public ExampleSet(ExampleSet exampleSet, Attribute labelAttribute, java.util.Map<java.lang.Integer,ExampleSet.MeanVariance> meanVariances)
public ExampleSet(java.io.ObjectInputStream in) throws java.io.IOException
java.io.IOException
Method Detail |
---|
private static java.util.Map<java.lang.Integer,ExampleSet.MeanVariance> createMeanVariances(ExampleSet exampleSet)
public java.util.Map<java.lang.Integer,ExampleSet.MeanVariance> getMeanVariances()
public int getNumberOfSupportVectors()
public void writeSupportVectors(java.io.ObjectOutputStream out) throws java.io.IOException
java.io.IOException
public int count_examples()
public int count_pos_examples()
public int get_dim()
public Example get_example(int pos)
pos
- Number of example
public double get_y(int pos)
pos
- Number of example
public void set_y(int pos, double y)
public double[] get_ys()
public double get_alpha(int pos)
pos
- Number of example
public double[] get_alphas()
public void swap(int pos1, int pos2)
pos1
- pos2
- public double get_b()
public void set_b(double new_b)
new_b
- public void set_alpha(int pos, double alpha)
pos
- Number of examplealpha
- New valuepublic void clearAlphas()
public java.lang.String getId(int index)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(boolean onlySV)
public java.lang.String toString(int numberOfExamples, boolean onlySV)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |