jBNC Toolbox

jbnc
Class CrossVal

java.lang.Object
  extended byjbnc.Classifier
      extended byjbnc.CrossVal

public class CrossVal
extends Classifier

Cross validation classifier tester. Assumes that cross validation files are already generated an attempts to read them using given file stem. The file name format is: "stem-repetition-fold". For instance for stem "monk" the file names could be "monk-0-0.*", "monk-0-1.*", etc.

 USAGE: CrossVal {options}

 where:
  -a {algor_name} Algorithm choices: "naive", "TAN", "FAN", "STAN", "STAND".
  -c {class_name} Name of the class variable. The default value is 'class'.
  -d              Print debugging information.
  -f {file_stem}  Load test data in C4.5 format (.names + .test),
                   file_stem-?-?.names - file with specification of attributes,
                   file_stem-?-?.data  - file with train cases.
                   file_stem-?-?.test  - file with test cases.
  -n {file_name}  Save constructed naive-Bayes networks to file_name-?-?.bif.
                  File is saved in BIF 0.15 format.
  -q {q_measure}  Select quality mesure. This relevant for the inducers that
                  perform selection of network candidates, like FAN or STAN.
                  Diffrent measure have drasticaly diffrent computational
                  complexity.
                  Quality measures choices:
                   LC     - local criterion: log p(c_l|D) [local]
                   SB     - standard Bayesian measure with penalty for size
                            [global].
                   HGS    - Heckerman-Geiger-Chickering measure [global].
                   LOO    - leave-one-out cross validation [local].
                   CV10   - ten fold cross validation.[local].
                   CV1010 - ten fold cross validation averaged ten times
                            [local].
  -s              Number of smoothing priors to test. Has to be an integer
                  greater or equal zero.
  -t              Print execution time.

 EXAMPLE: CrossVal -a TAN -tf monk1
 EXAMPLE: CrossVal -dta FAN -q LOO -f monk1

Since:
June 1, 1999
Author:
Jarek Sacha

Field Summary
 
Fields inherited from class jbnc.Classifier
algorithmName, className, classNameDefault, databaseURL, debugMode, fileNameStem, measureName, namesFileName, nbAlphas, netFileName, tableName, testFileName, trainFileName, usageMsg, useTimer
 
Constructor Summary
CrossVal()
           
 
Method Summary
protected  DatasetInt loadDataset(java.lang.String namesFile, java.lang.String dataFile)
          Dataset loading wrapper.
static void main(java.lang.String[] args)
          Main function.
protected  void run()
          Create and test a classifier.
protected  void run(java.lang.String[] args)
           
protected  BNCTester.Result test(BayesianNetworks.BayesNet net, DatasetInt testSet, boolean report)
          Bayesian network classifier testing wrapper.
protected  BayesianNetworks.BayesNet train(BayesianInducer inducer, FrequencyCalc fc, boolean usePriors, double alphaK)
          Bayesian network classifier training wrapper.
 
Methods inherited from class jbnc.Classifier
processCommandLine, setUsageMsg
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrossVal

public CrossVal()
Method Detail

run

protected void run(java.lang.String[] args)
Overrides:
run in class Classifier

main

public static void main(java.lang.String[] args)
Main function.

Parameters:
args - The command line arguments

train

protected BayesianNetworks.BayesNet train(BayesianInducer inducer,
                                          FrequencyCalc fc,
                                          boolean usePriors,
                                          double alphaK)
                                   throws java.lang.Exception
Bayesian network classifier training wrapper.

Parameters:
inducer - algorithm used for classifier learning.
fc - Description of Parameter
usePriors - Description of Parameter
alphaK - Description of Parameter
Returns:
constructed Bayesian classifier network.
Throws:
java.lang.Exception - Description of Exception

test

protected BNCTester.Result test(BayesianNetworks.BayesNet net,
                                DatasetInt testSet,
                                boolean report)
                         throws java.lang.Exception
Bayesian network classifier testing wrapper.

Parameters:
net - Bayesian network classifier.
testSet - test data.
report - wether to report results on the screen.
Returns:
object containg results of testing.
Throws:
java.lang.Exception - Description of Exception

run

protected void run()
Description copied from class: Classifier
Create and test a classifier.

Overrides:
run in class Classifier

loadDataset

protected DatasetInt loadDataset(java.lang.String namesFile,
                                 java.lang.String dataFile)
                          throws java.lang.Exception
Dataset loading wrapper.

Overrides:
loadDataset in class Classifier
Parameters:
namesFile - Description of Parameter
dataFile - Description of Parameter
Returns:
Description of the Returned Value
Throws:
java.lang.Exception - Description of Exception

SourceForge.net Logo