jcolibri.test.test16
Class SpamFilterApp

java.lang.Object
  extended by jcolibri.test.test16.SpamFilterApp
All Implemented Interfaces:
StandardCBRApplication

public class SpamFilterApp
extends java.lang.Object
implements StandardCBRApplication

Spam filter application. It is configured through the set() methods. The cycle method() runs the application and stores the evaluation results in the evaluation report object. After running all cycles, some statistics may be read using the get() methods.
The corpus used by this application must be a zip file with several textual files (one per email). The filename must start by ham or spam depending on the class.

Version:
1.0
Author:
Juan A. Recio-Garcia

Constructor Summary
SpamFilterApp(java.lang.String corpusZipFile)
          Creates a spam filter application that uses the corpus indicated by the parameter.
 
Method Summary
 void configure()
          Configures the application: case base, connectors, etc.
 void cycle(CBRQuery query)
          Executes a CBR cycle with the given query.
 double getFalseNegatives()
          Returns the false negatives.
 double getFalsePositives()
          Returns the false positives.
 KNNClassificationConfig getKNNConfig()
          Returns the KNN configuration
 double getTrueNegatives()
          Returns the true negatives
 double getTruePositives()
          Returns the true positives
 void postCycle()
          Runs the code to shutdown the application.
 CBRCaseBase preCycle()
          Runs the precyle where typically cases are read and organized into a case base.
 void setClasifMethod(KNNClassificationMethod clasifMethod)
          Sets the classification method.
 void setK(int k)
          Sets the k
 void setSimilFunc(LocalSimilarityFunction similFunc)
          Sets the similarity function
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpamFilterApp

public SpamFilterApp(java.lang.String corpusZipFile)
Creates a spam filter application that uses the corpus indicated by the parameter.

Method Detail

configure

public void configure()
               throws ExecutionException
Description copied from interface: StandardCBRApplication
Configures the application: case base, connectors, etc.

Specified by:
configure in interface StandardCBRApplication
Throws:
ExecutionException

preCycle

public CBRCaseBase preCycle()
                     throws ExecutionException
Description copied from interface: StandardCBRApplication
Runs the precyle where typically cases are read and organized into a case base.

Specified by:
preCycle in interface StandardCBRApplication
Returns:
The created case base with the cases in the storage.
Throws:
ExecutionException

cycle

public void cycle(CBRQuery query)
           throws ExecutionException
Description copied from interface: StandardCBRApplication
Executes a CBR cycle with the given query.

Specified by:
cycle in interface StandardCBRApplication
Throws:
ExecutionException

postCycle

public void postCycle()
               throws ExecutionException
Description copied from interface: StandardCBRApplication
Runs the code to shutdown the application. Typically it closes the connector.

Specified by:
postCycle in interface StandardCBRApplication
Throws:
ExecutionException

getKNNConfig

public KNNClassificationConfig getKNNConfig()
Returns the KNN configuration


setK

public void setK(int k)
Sets the k

Parameters:
k - The k to set.

setSimilFunc

public void setSimilFunc(LocalSimilarityFunction similFunc)
Sets the similarity function

Parameters:
similFunc - The similFunc to set.

setClasifMethod

public void setClasifMethod(KNNClassificationMethod clasifMethod)
Sets the classification method.

Parameters:
clasifMethod - The clasifMethod to set.

getFalseNegatives

public double getFalseNegatives()
Returns the false negatives.


getFalsePositives

public double getFalsePositives()
Returns the false positives.


getTruePositives

public double getTruePositives()
Returns the true positives


getTrueNegatives

public double getTrueNegatives()
Returns the true negatives


GAIA - Group for Artificial Intelligence Applications
http://gaia.fdi.ucm.es