jcolibri.test.test13.similarity
Class AverageMultipleTextValues

java.lang.Object
  extended by jcolibri.test.test13.similarity.AverageMultipleTextValues
All Implemented Interfaces:
LocalSimilarityFunction

public class AverageMultipleTextValues
extends java.lang.Object
implements LocalSimilarityFunction

This function converts the text value of an attribute into several numeric values and calculates its average. Then it computes the interval difference between query and case.

Example:

Query attribute: 2.0, 4.0 -> Average = 3.0

Case attribute: 5.0, 9.0, 4.0 -> Average = 6.0

If interval param is 9.0 computed similarity equals: 0.33


Constructor Summary
AverageMultipleTextValues(double interval)
          Creates a new instance of MaxString
 
Method Summary
 double compute(java.lang.Object caseObject, java.lang.Object queryObject)
          Computes the similarity between two objects
 boolean isApplicable(java.lang.Object o1, java.lang.Object o2)
          Applicable to String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AverageMultipleTextValues

public AverageMultipleTextValues(double interval)
Creates a new instance of MaxString

Method Detail

compute

public double compute(java.lang.Object caseObject,
                      java.lang.Object queryObject)
               throws NoApplicableSimilarityFunctionException
Description copied from interface: LocalSimilarityFunction
Computes the similarity between two objects

Specified by:
compute in interface LocalSimilarityFunction
Parameters:
caseObject - object of the case
queryObject - object of the query
Returns:
a value between [0..1]
Throws:
NoApplicableSimilarityFunctionException

isApplicable

public boolean isApplicable(java.lang.Object o1,
                            java.lang.Object o2)
Applicable to String

Specified by:
isApplicable in interface LocalSimilarityFunction

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