es.ucm.fdi.gaia.jcolibri.method.reuse.classification.SimilarityWeightedVotingMethod Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jCOLIBRI Show documentation
Show all versions of jCOLIBRI Show documentation
jCOLIBRI is a java framework for the development of Case-Based Reasoning systems.
package es.ucm.fdi.gaia.jcolibri.method.reuse.classification;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import es.ucm.fdi.gaia.jcolibri.extensions.classification.ClassificationSolution;
import es.ucm.fdi.gaia.jcolibri.method.retrieve.RetrievalResult;
/**
* Provides the ability to classify a query by predicting its
* solution from supplied cases. Classification is done by
* similarity weighted voting, where each vote is based on
* the similarity of the case to the query. The class with the
* highest overall value is the predicted class.
*
* @author Derek Bridge
* @author Lisa Cummins
* 16/05/07
*/
public class SimilarityWeightedVotingMethod extends AbstractKNNClassificationMethod
{
/**
* Predicts the class that has the highest value vote
* among the k most similar cases, where votes are based on
* similarity to the query.
* If several classes receive the same highest vote, the class that
* has the lowest hash code is taken as the prediction.
* @param cases
* an ordered list of cases along with similarity scores.
* @return Returns the predicted solution.
*/
@Override
public ClassificationSolution getPredictedSolution(Collection cases)
{
Map