com.rapidminer.operator.learner.functions.kernel.jmysvm.examples
Class SVMExamples

java.lang.Object
  extended by com.rapidminer.operator.learner.functions.kernel.jmysvm.examples.SVMExamples
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
SVCExampleSet

public class SVMExamples
extends java.lang.Object
implements java.io.Serializable

Implementation of a sparse example set which can be used for learning. This data structure is also used as SVM model.

Author:
Stefan Rueping, Ingo Mierswa
See Also:
Serialized Form

Nested Class Summary
static class SVMExamples.MeanVariance
          This class holds information aboud the means and variances of an attribute.
 
Field Summary
 double[][] atts
          The known attribute values for each example.
 java.lang.String[] ids
          The ids of all examples.
 int[][] index
          The corresponding indices for the known attribute values for each example.
 
Constructor Summary
SVMExamples(ExampleSet exampleSet, Attribute labelAttribute, boolean scale)
           
SVMExamples(ExampleSet exampleSet, Attribute labelAttribute, java.util.Map<java.lang.Integer,SVMExamples.MeanVariance> meanVariances)
          Creates a fresh example set of the given size from the RapidMiner example reader.
SVMExamples(int size, double b)
          Creates an empty example set of the given size.
SVMExamples(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
 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
 SVMExample get_example(int pos)
          Gets an example.
 double get_y(int pos)
          Gets an y-value.
 double[] get_ys()
          Gets the y array
 double getB()
           
 java.lang.String getId(int index)
           
 java.util.Map<java.lang.Integer,SVMExamples.MeanVariance> getMeanVariances()
           
 int getNumberOfSupportVectors()
           
 int getTrain_size()
           
 double[] getYs()
           
 void set_alpha(int pos, double alpha)
          sets an alpha value.
 void set_b(double new_b)
          set b
 void set_dim(int d)
           
 void set_y(int pos, double y)
          Sets the label value for the specified example.
 void setB(double b)
           
 void setMeanVarianceMap(java.util.Map<java.lang.Integer,SVMExamples.MeanVariance> meanVarianceMap)
           
 void setTrain_size(int train_size)
           
 void setYs(double[] ys)
           
 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

atts

public double[][] atts
The known attribute values for each example.


index

public int[][] index
The corresponding indices for the known attribute values for each example.


ids

public java.lang.String[] ids
The ids of all examples.

Constructor Detail

SVMExamples

public SVMExamples(int size,
                   double b)
Creates an empty example set of the given size.


SVMExamples

public SVMExamples(ExampleSet exampleSet,
                   Attribute labelAttribute,
                   boolean scale)

SVMExamples

public SVMExamples(ExampleSet exampleSet,
                   Attribute labelAttribute,
                   java.util.Map<java.lang.Integer,SVMExamples.MeanVariance> meanVariances)
Creates a fresh example set of the given size from the RapidMiner example reader. The alpha values and b are zero, the label will be set if it is known.


SVMExamples

public SVMExamples(java.io.ObjectInputStream in)
            throws java.io.IOException
Reads an example set from the given input stream.

Throws:
java.io.IOException
Method Detail

getMeanVariances

public java.util.Map<java.lang.Integer,SVMExamples.MeanVariance> getMeanVariances()

getNumberOfSupportVectors

public int getNumberOfSupportVectors()

writeSupportVectors

public void writeSupportVectors(java.io.ObjectOutputStream out)
                         throws java.io.IOException
Writes the example set into the given output stream.

Throws:
java.io.IOException

count_examples

public int count_examples()
Counts the training examples.

Returns:
Number of examples

count_pos_examples

public int count_pos_examples()
Counts the positive training examples

Returns:
Number of positive examples

get_dim

public int get_dim()
Gets the dimension of the examples

Returns:
dim

set_dim

public void set_dim(int d)

get_example

public SVMExample get_example(int pos)
Gets an example.

Parameters:
pos - Number of example
Returns:
Array of example attributes in their default order

get_y

public double get_y(int pos)
Gets an y-value.

Parameters:
pos - Number of example
Returns:
y

set_y

public void set_y(int pos,
                  double y)
Sets the label value for the specified example.


get_ys

public double[] get_ys()
Gets the y array

Returns:
y

get_alpha

public double get_alpha(int pos)
Gets an alpha-value. Please note that the alpha values are already multiplied by the corresponding y-value.

Parameters:
pos - Number of example
Returns:
alpha

get_alphas

public double[] get_alphas()
Gets the alpha array. Please note that the alpha values are already multiplied by the corresponding y-value.

Returns:
alpha

swap

public void swap(int pos1,
                 int pos2)
swap two training examples

Parameters:
pos1 -
pos2 -

get_b

public double get_b()
get b

Returns:
b

set_b

public void set_b(double new_b)
set b

Parameters:
new_b -

set_alpha

public void set_alpha(int pos,
                      double alpha)
sets an alpha value.

Parameters:
pos - Number of example
alpha - New value

clearAlphas

public void clearAlphas()

setMeanVarianceMap

public void setMeanVarianceMap(java.util.Map<java.lang.Integer,SVMExamples.MeanVariance> meanVarianceMap)

getYs

public double[] getYs()

setYs

public void setYs(double[] ys)

getTrain_size

public int getTrain_size()

setTrain_size

public void setTrain_size(int train_size)

getB

public double getB()

setB

public void setB(double b)

getId

public java.lang.String getId(int index)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(boolean onlySV)

toString

public java.lang.String toString(int numberOfExamples,
                                 boolean onlySV)


Copyright © 2001-2009 by Rapid-I