marf.Classification.Similarity
Class CosineSimilarityMeasure
java.lang.Object
marf.Storage.StorageManager
marf.Classification.Classification
marf.Classification.Similarity.CosineSimilarityMeasure
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, IClassification, IStorageManager
public class CosineSimilarityMeasure
- extends Classification
Cosine Similarity Measure Classifier.
$Id: CosineSimilarityMeasure.java,v 1.4 2008/02/05 22:13:31 mokhov Exp $
- Since:
- 0.3.0.6
- Version:
- $Revision: 1.4 $
- Author:
- Serguei Mokhov
- See Also:
- Serialized Form
Method Summary |
boolean |
classify(double[] padFeatureVector)
Classify the feature vector based on whatever
similarity() derivatives implement. |
static java.lang.String |
getMARFSourceCodeRevision()
Retrieves class' revision. |
Result |
getResult()
Retrieves the maximum-similarity classification result. |
double |
similarity(double[] padVector1,
double[] padVector2)
Generic distance routine. |
Methods inherited from class marf.Classification.Classification |
classify, clone, dump, getFeatureExtraction, getResultSet, getTrainingSetFilename, loadTrainingSet, restore, setFeatureExtraction, train, train |
Methods inherited from class marf.Storage.StorageManager |
backSynchronizeObject, dumpBinary, dumpCSV, dumpGzipBinary, dumpHTML, dumpSQL, dumpXML, enableDumpOnNotFound, equals, getDefaultExtension, getDefaultExtension, getDumpMode, getFilename, getObjectToSerialize, hashCode, restoreBinary, restoreCSV, restoreGzipBinary, restoreHTML, restoreSQL, restoreXML, setDumpMode, setFilename, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
CosineSimilarityMeasure
public CosineSimilarityMeasure(IFeatureExtraction poFeatureExtraction)
- Distance Constructor.
- Parameters:
poFeatureExtraction
- FeatureExtraction module reference
classify
public final boolean classify(double[] padFeatureVector)
throws ClassificationException
- Classify the feature vector based on whatever
similarity()
derivatives implement.
In 0.3.0.6 the generic pipelined version of this API
classify()
was refactored into the
Classification
.
- Parameters:
padFeatureVector
- vector of features to compare with the stored ones
- Returns:
true
if classification successful whatever that means
- Throws:
ClassificationException
- if sanity checks fail. The checks include
verifying nullness of the mean vector and its length compared to the
feature vector or encapsulation of StorageException when dumping/restoring.- See Also:
similarity(double[], double[])
,
Classification.classify()
similarity
public double similarity(double[] padVector1,
double[] padVector2)
throws ClassificationException
- Generic distance routine. To be overridden.
- Parameters:
padVector1
- first vector for distance calculationpadVector2
- second vector for distance calculation
- Returns:
- distance between the two vectors
- Throws:
ClassificationException
getResult
public Result getResult()
- Retrieves the maximum-similarity classification result.
- Returns:
- Result object
getMARFSourceCodeRevision
public static java.lang.String getMARFSourceCodeRevision()
- Retrieves class' revision.
- Returns:
- revision string