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 |
result
built, logger, p_model, p_stats, parameters, ps, stats
Constructor and Description |
---|
NearestNeighborsSimilarity(IDistanceFunction<Features> distanceFunction,
int knn) |
getPairwise, getResult, learn, setResult
getAttributeSelection, getStats, isBuilt, predict, setAttributeSelection, setStats
protected 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.AmbitException
public Double learn(ID id, Features features, Double observed, Double predicted) throws net.idea.modbcum.i.exceptions.AmbitException, UnsupportedOperationException
net.idea.modbcum.i.exceptions.AmbitException
UnsupportedOperationException
protected Object classifyQuery(Features query, List<DistanceComparable<Features>> neighbors) throws Exception
Exception
protected double calculateAverageDistance(Features query, List<DistanceComparable<Features>> neighbors) throws Exception
query
- neighbors
- Exception
public 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.AmbitException
public 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.AmbitException
public 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.