public class ObjectSignatureSQFD extends ObjectFloatVector
LocalAbstractObject.DataEqualObject, LocalAbstractObject.TextStreamFactory<T extends LocalAbstractObject>, LocalAbstractObject.TrivialDistanceFunction
Modifier and Type | Field and Description |
---|---|
static float |
defaultAlpha
parameter of the Gaussian distance/similarity conversion
|
static float[] |
defaultWeights
Vector of weights to be used for weighted L2 (distance between centroids)
|
protected int |
nClusters
Number of clusters.
|
protected int |
nDim
Dimensionality of the clusters
|
protected float |
precomputedAlpha
Alpha for which the distance was partially precomputed.
|
protected float |
precomputedDist
Partially precomputed distance function (FS1)
|
protected float[] |
precomputedWeights
Weights for which the distance was partially precomputed.
|
data
counterDistanceComputations, counterLowerBoundDistanceComputations, counterPrecomputedDistanceSavings, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, trivialDistanceFunction, UNKNOWN_DISTANCE
Modifier | Constructor and Description |
---|---|
protected |
ObjectSignatureSQFD(BinaryInput input,
BinarySerializator serializator) |
|
ObjectSignatureSQFD(java.io.BufferedReader stream) |
|
ObjectSignatureSQFD(java.io.BufferedReader stream,
boolean precomputeSelfDistance) |
|
ObjectSignatureSQFD(int nClusters,
int nDim,
float[] data) |
|
ObjectSignatureSQFD(java.lang.String locatorURI,
int nClusters,
int nDim,
float[] data) |
Modifier and Type | Method and Description |
---|---|
int |
binarySerialize(BinaryOutput output,
BinarySerializator serializator)
Binary-serialize this object into the
output . |
protected static float |
computePartialResult(ObjectSignatureSQFD obj1,
ObjectSignatureSQFD obj2,
float[] weights,
float alpha)
Pre-compute partial distance between two signatures using the matrix based on centroid distances.
|
float |
getAlpha() |
int |
getBinarySize(BinarySerializator serializator)
Returns the exact size of the binary-serialized version of this object in bytes.
|
int |
getClusterCount() |
int |
getClusterDimension() |
protected float |
getDistanceImpl(LocalAbstractObject obj,
float distThreshold)
The actual implementation of the metric function (see
LocalAbstractObject.getDistance(messif.objects.LocalAbstractObject) for full explanation). |
float |
getMaxDistance()
Returns a maximal possible distance for this class.
|
protected float |
getOrPrecomputeSelfDistance(float[] weights,
float alpha)
Either retrieve stored precomputed self-distance or compute it and store (fog given alpha).
|
float |
getPrecomputedAlpha() |
float |
getPrecomputedDist() |
float[] |
getPrecomputedWeights() |
protected float |
getSumOfWeights() |
protected float[] |
getWeights() |
float[] |
getWeightsClone() |
protected float |
precomputeSelfDistance()
Compute and store self-distance (for default alpha and weights).
|
protected float |
precomputeSelfDistance(float[] weights,
float alpha)
Compute and store self-distance (fog given alpha).
|
void |
setPrecomputedAlpha(float precomputedAlpha) |
void |
setPrecomputedDist(float precomputedDist) |
void |
setPrecomputedWeights(float[] precomputedWeights) |
protected void |
writeData(java.io.OutputStream stream)
Store this object's data to a text stream.
|
cloneRandomlyModify, convertFloatVector, dataEquals, dataHashCode, getDimensionality, getMinMaxForEveryCoord, getMinMaxOverCoords, getMinMaxOverCoords, getSize, getVectorData, getVectorDataDimension, getVectorDataItem, getVectorDataItemFloat, parseFloatVector, randomData, toString, translateToUnitCube, translateToUnitCube, writeFloatVector
clearSurplusData, clone, clone, create, create, createMetaDistancesHolder, excludeUsingPrecompDist, getDistance, getDistance, getDistance, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceLowerBound, getDistanceLowerBoundImpl, getDistanceStorePrecomputed, getDistanceStorePrecomputed, getDistanceStorePrecomputed, getDistanceUpperBound, getDistanceUpperBoundImpl, getFieldsForNames, getNormDistance, getPrecomputedDistance, getPrecomputedDistance, getRandomChar, getRandomNormal, chainDestroy, chainFilter, includeUsingPrecompDist, isDistanceCompatible, parseObjectComment, peekNextChar, readAttributesFromStream, readObjectComments, readObjectCommentsWithoutData, unchainFilter, write, write, writeAttributesToStream, writeObjectComment
clone, getLocatorURI, getNoDataObject, getObjectKey, getObjectKey, getObjectLocatorURI, setObjectKey
public static final float[] defaultWeights
public static final float defaultAlpha
protected float precomputedDist
protected float precomputedAlpha
protected float[] precomputedWeights
protected final int nClusters
protected final int nDim
public ObjectSignatureSQFD(int nClusters, int nDim, float[] data)
public ObjectSignatureSQFD(java.lang.String locatorURI, int nClusters, int nDim, float[] data)
public ObjectSignatureSQFD(java.io.BufferedReader stream) throws java.io.EOFException, java.io.IOException, java.lang.NumberFormatException
java.io.EOFException
java.io.IOException
java.lang.NumberFormatException
public ObjectSignatureSQFD(java.io.BufferedReader stream, boolean precomputeSelfDistance) throws java.io.EOFException, java.io.IOException, java.lang.NumberFormatException
java.io.EOFException
java.io.IOException
java.lang.NumberFormatException
protected ObjectSignatureSQFD(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
java.io.IOException
protected void writeData(java.io.OutputStream stream) throws java.io.IOException
LocalAbstractObject
writeData
in class ObjectFloatVector
stream
- the stream to store this object tojava.io.IOException
- if there was an error while writing to streamprotected final float precomputeSelfDistance()
protected final float precomputeSelfDistance(float[] weights, float alpha)
weights
- vector of weights to be used for weighted L2 (distance between centroids)alpha
- parameter of the Gaussian distance/similarity conversionpublic int getClusterCount()
public int getClusterDimension()
public float getPrecomputedAlpha()
public void setPrecomputedAlpha(float precomputedAlpha)
public float getPrecomputedDist()
public void setPrecomputedDist(float precomputedDist)
public float[] getPrecomputedWeights()
public void setPrecomputedWeights(float[] precomputedWeights)
protected float getSumOfWeights()
public float getAlpha()
protected float[] getWeights()
public float[] getWeightsClone()
public float getMaxDistance()
LocalAbstractObject
LocalAbstractObject.MAX_DISTANCE
.getMaxDistance
in class LocalAbstractObject
protected float getDistanceImpl(LocalAbstractObject obj, float distThreshold)
LocalAbstractObject
LocalAbstractObject.getDistance(messif.objects.LocalAbstractObject)
for full explanation).
The implementation should not increment distanceComputations statistics.getDistanceImpl
in class LocalAbstractObject
obj
- the object to compute distance todistThreshold
- the threshold value on the distanceprotected float getOrPrecomputeSelfDistance(float[] weights, float alpha)
weights
- vector of weights to be used for weighted L2 (distance between centroids)alpha
- parameter of the Gaussian distance/similarity conversionprotected static float computePartialResult(ObjectSignatureSQFD obj1, ObjectSignatureSQFD obj2, float[] weights, float alpha)
obj1
- first signature objectobj2
- second signature objectweights
- vector of weights to be used for weighted L2 (distance between centroids)alpha
- parameter of the Gaussian distance/similarity conversionpublic int binarySerialize(BinaryOutput output, BinarySerializator serializator) throws java.io.IOException
LocalAbstractObject
output
.binarySerialize
in interface BinarySerializable
binarySerialize
in class ObjectFloatVector
output
- the output that this object is binary-serialized intoserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error during serializationpublic int getBinarySize(BinarySerializator serializator)
LocalAbstractObject
getBinarySize
in interface BinarySerializable
getBinarySize
in class ObjectFloatVector
serializator
- the serializator used to write objects