org.wikipedia.miner.comparison
Class ConnectionSnippetWeighter

java.lang.Object
  extended by org.wikipedia.miner.comparison.ConnectionSnippetWeighter

public class ConnectionSnippetWeighter
extends java.lang.Object


Constructor Summary
ConnectionSnippetWeighter(Wikipedia wikipedia, ArticleComparer cmp)
           
 
Method Summary
 void buildClassifier(Classifier classifier)
           
 void buildDefaultClassifier()
           
 double getWeight(ConnectionSnippet snippet)
           
 void loadClassifier(java.io.File file)
          Loads the classifier from file
 void loadTrainingData(java.io.File file)
          Loads training data from the given file.
 void saveClassifier(java.io.File file)
          Serializes the classifer and saves it to the given file.
 void saveTrainingData(java.io.File file)
          Saves the training data generated by train() to the given file.
 SpearmanCorrelation test(java.util.Vector<ConnectionSnippet> weightedSnippets)
           
 void train(java.util.Vector<ConnectionSnippet> weightedSnippets)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionSnippetWeighter

public ConnectionSnippetWeighter(Wikipedia wikipedia,
                                 ArticleComparer cmp)
                          throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getWeight

public double getWeight(ConnectionSnippet snippet)
                 throws java.lang.Exception
Throws:
java.lang.Exception

train

public void train(java.util.Vector<ConnectionSnippet> weightedSnippets)
           throws java.lang.Exception
Throws:
java.lang.Exception

test

public SpearmanCorrelation test(java.util.Vector<ConnectionSnippet> weightedSnippets)
                         throws java.lang.Exception
Throws:
java.lang.Exception

saveTrainingData

public void saveTrainingData(java.io.File file)
                      throws java.io.IOException,
                             java.lang.Exception
Saves the training data generated by train() to the given file. The data is saved in WEKA's arff format.

Parameters:
file - the file to save the training data to
Throws:
java.io.IOException - if the file cannot be written to
java.lang.Exception

loadTrainingData

public void loadTrainingData(java.io.File file)
                      throws java.io.IOException,
                             java.lang.Exception
Loads training data from the given file. The file must be a valid WEKA arff file.

Parameters:
file - the file to save the training data to
Throws:
java.io.IOException - if the file cannot be read.
java.lang.Exception - if the file does not contain valid training data.

saveClassifier

public void saveClassifier(java.io.File file)
                    throws java.io.IOException
Serializes the classifer and saves it to the given file.

Parameters:
file - the file to save the classifier to
Throws:
java.io.IOException - if the file cannot be read

loadClassifier

public void loadClassifier(java.io.File file)
                    throws java.lang.Exception
Loads the classifier from file

Parameters:
file -
Throws:
java.lang.Exception

buildClassifier

public void buildClassifier(Classifier classifier)
                     throws java.lang.Exception
Parameters:
classifier -
Throws:
java.lang.Exception

buildDefaultClassifier

public void buildDefaultClassifier()
                            throws java.lang.Exception
Parameters:
classifier -
Throws:
java.lang.Exception