public abstract class NearestNeighborsSimilarity<ID,Features> extends AbstractSimilarityModel<ID,Features,Double>
IDistanceFunction.| Modifier and Type | Field and Description |
|---|---|
protected IAttributeSelection<Features> |
attributeSelection |
protected int |
kNN |
protected NearestNeighborsSearch<Features> |
nearestNeighborsSearch |
resultbuilt, logger, p_model, p_stats, parameters, ps, stats| Constructor and Description |
|---|
NearestNeighborsSimilarity(IDistanceFunction<Features> distanceFunction,
int knn) |
getPairwise, getResult, learn, setResultgetAttributeSelection, getStats, isBuilt, predict, setAttributeSelection, setStatsprotected NearestNeighborsSearch<Features> nearestNeighborsSearch
protected IAttributeSelection<Features> attributeSelection
protected int kNN
public NearestNeighborsSimilarity(IDistanceFunction<Features> distanceFunction, int knn)
public void buildInitialize()
throws net.idea.modbcum.i.exceptions.AmbitException
buildInitialize in class AbstractSimilarityModel<ID,Features,Double>net.idea.modbcum.i.exceptions.AmbitExceptionpublic Double learn(ID id, Features features, Double observed, Double predicted) throws net.idea.modbcum.i.exceptions.AmbitException, UnsupportedOperationException
net.idea.modbcum.i.exceptions.AmbitExceptionUnsupportedOperationExceptionprotected Object classifyQuery(Features query, List<DistanceComparable<Features>> neighbors) throws Exception
Exceptionprotected double calculateAverageDistance(Features query, List<DistanceComparable<Features>> neighbors) throws Exception
query - neighbors - Exceptionpublic Double predict(ID id, Features features, Double observed, Double predicted, IModelStatistics<Double> stats) throws net.idea.modbcum.i.exceptions.AmbitException
net.idea.modbcum.i.exceptions.AmbitExceptionpublic double getPairwise(Features features1, Features features2) throws net.idea.modbcum.i.exceptions.AmbitException
getPairwise in class AbstractSimilarityModel<ID,Features,Double>net.idea.modbcum.i.exceptions.AmbitExceptionpublic void close()
public void setParameter(Object parameter, Object value)
setParameter in interface IModelDefinition<ID,Features,Double>setParameter in class AbstractModel<ID,Features,Double>public Object getParameter(Object parameter)
getParameter in interface IModelDefinition<ID,Features,Double>getParameter in class AbstractModel<ID,Features,Double>public NearestNeighborsSearch<Features> getNearestNeighborsSearch()
public void setNearestNeighborsSearch(NearestNeighborsSearch<Features> nnSearch)
public int getKNN()
public void setKNN(int knn)
Copyright © 2004–2020 Ideaconsult Ltd.. All rights reserved.