All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class jsvm.SvmTest

java.lang.Object
    |
    +----jsvm.SvmTest

public class SvmTest
extends Object
Test routines for the Svm class.

Version:
$Id$
Author:
Heloise Hse (hwawen@eecs.berkeley.edu)

Constructor Index

 o SvmTest()

Method Index

 o buildTwice(String, String)
  1. Loads a training data file
  2. Builds models based on the data
  3. Loads another training data file
  4. Builds models based on the new set of data
Result: Exception will be thrown because after building the first set of models, the data structure must be cleared before building another set of models.
 o buildTwiceCorrect(String, String, String, String)
  1. Loads a training data file
  2. Builds models
  3. Writes models to file
  4. Removes data structure
  5. Loads another training data file
  6. Builds models
  7. Writes models to file
Result: Successfully writes the two sets of models to files m1 and m2.
 o classifyFromFile(String, String, String)
  1. Loads a model file
  2. Classifies a data file
  3. Writes predictions to a file
 o classifyOneExample(String)
  1. Loads a training data file
  2. Builds models
  3. Generates an example
  4. Classifies the example
  5. Prints confidence values to standard out
Result: Successfully classifies the example and prints out a list of distribution values.
 o classifyWithoutModels()
  1. Generates an example
  2. Classifies the example
  3. Prints a list of confidence values
Result: Exception thrown because models do not exist.
 o loadAndBuild(String, String)
Loads a training data file, builds models, and writes models to a file.
 o loadBuildClassify(String, String)
  1. Loads a training data file
  2. Builds models
  3. Loads a test data file
  4. Classifies
 o loadModelAndClassify(String)
  1. Loads a model file
  2. Creates an example
  3. Classifies the example
Result: prints out the distribution values as the result of classifying the example.
 o loadTwoModelFiles(String, String)
  1. Loads model file
  2. Loads another model file
Result: Exception thrown because if models already exist, the program cannot load another model file.
 o main(String[])
 o multiLoadAndBuild(String, String, String, String, String, String)
Creates 3 Svm instances, loads training data into each, build models, and writes models out to files.
 o multiLoadBuildClassify(String, String, String, String)
Creates 3 Svm instances, loads training data into each, build models, and classifies the test examples.
 o multiSvm()
Creates 2 Svm instances and sets the verbosity level.
 o testLoadTrainingData(String)
Reads and parses a training data file.

Constructors

 o SvmTest
public SvmTest()

Methods

 o testLoadTrainingData
public void testLoadTrainingData(String fname)
Reads and parses a training data file. Prints the data structure to standard out.

Parameters:
fname - The name of the training data file.
 o loadAndBuild
public void loadAndBuild(String in,
                         String out) throws IOException, SvmException
Loads a training data file, builds models, and writes models to a file.

Parameters:
in - The name of the training data file.
out - The name of the output model file.
 o buildTwice
public void buildTwice(String f1,
                       String f2) throws IOException, SvmException
  1. Loads a training data file
  2. Builds models based on the data
  3. Loads another training data file
  4. Builds models based on the new set of data
Result: Exception will be thrown because after building the first set of models, the data structure must be cleared before building another set of models.

Parameters:
f1 - The name of the first training data file.
f2 - The name of the second training data file.
 o buildTwiceCorrect
public void buildTwiceCorrect(String f1,
                              String f2,
                              String m1,
                              String m2) throws IOException, SvmException
  1. Loads a training data file
  2. Builds models
  3. Writes models to file
  4. Removes data structure
  5. Loads another training data file
  6. Builds models
  7. Writes models to file
Result: Successfully writes the two sets of models to files m1 and m2.

Parameters:
f1 - The first training data file name.
f2 - The second training data file name.
m1 - The name of the first model file to write out to.
m2 - The name of the second model file to write out to.
 o classifyOneExample
public void classifyOneExample(String fname) throws IOException, SvmException
  1. Loads a training data file
  2. Builds models
  3. Generates an example
  4. Classifies the example
  5. Prints confidence values to standard out
Result: Successfully classifies the example and prints out a list of distribution values.

Parameters:
fname - The name of the training data file.
 o classifyWithoutModels
public void classifyWithoutModels() throws SvmException
  1. Generates an example
  2. Classifies the example
  3. Prints a list of confidence values
Result: Exception thrown because models do not exist.

 o loadTwoModelFiles
public void loadTwoModelFiles(String m1,
                              String m2) throws SvmException, IOException
  1. Loads model file
  2. Loads another model file
Result: Exception thrown because if models already exist, the program cannot load another model file. The existing models must be removed first before the next sets can be loaded.

Parameters:
m1 - The name of the first model file.
m2 - The name of the second model file.
 o classifyFromFile
public void classifyFromFile(String datFile,
                             String modelFile,
                             String predFile) throws SvmException, IOException
  1. Loads a model file
  2. Classifies a data file
  3. Writes predictions to a file

Parameters:
datFile - The name of the test data file.
modelFile - The name of the input model file.
predFile - The name of the output prediction file.
 o loadModelAndClassify
public void loadModelAndClassify(String fname) throws SvmException, IOException
  1. Loads a model file
  2. Creates an example
  3. Classifies the example
Result: prints out the distribution values as the result of classifying the example.

Parameters:
fname - The name of the input model file.
 o multiSvm
public void multiSvm()
Creates 2 Svm instances and sets the verbosity level. Result: Each Svm instance should receive different ID number. svm1 has verbosity level of 3, and svm2 has verbosity level of 1.

 o multiLoadAndBuild
public void multiLoadAndBuild(String in,
                              String out,
                              String in2,
                              String out2,
                              String in3,
                              String out3) throws IOException, SvmException
Creates 3 Svm instances, loads training data into each, build models, and writes models out to files.

Parameters:
in - The name of the training data file for the first Svm.
out - The name of the output model file for the first Svm.
in2 - The name of the training data file for the second Svm.
out2 - The name of the output model file for the second Svm.
in3 - The name of the training data file for the third Svm.
out3 - The name of the output model file for the third Svm.
 o multiLoadBuildClassify
public void multiLoadBuildClassify(String in,
                                   String in2,
                                   String in3,
                                   String testfile) throws IOException, SvmException
Creates 3 Svm instances, loads training data into each, build models, and classifies the test examples.

Parameters:
in - The name of the training data file for the first Svm.
in2 - The name of the training data file for the second Svm.
in3 - The name of the training data file for the third Svm.
testfile - The name of the test data file.
 o loadBuildClassify
public void loadBuildClassify(String in,
                              String testfile) throws IOException, SvmException
  1. Loads a training data file
  2. Builds models
  3. Loads a test data file
  4. Classifies

Parameters:
in - The name of the training data file.
test - The name of the test data file.
 o main
public static void main(String[] argv)

All Packages  Class Hierarchy  This Package  Previous  Next  Index