public class MetaObjectArrayWeightedSum extends MetaObjectArray
MetaObjectArray
that implements the distance
as a weighted sum of the encapsulated objects.
Note that the weights are set to 1 by default. Normally, this method is overloaded in a subclass to provide more appropriate weights.
LocalAbstractObject.DataEqualObject, LocalAbstractObject.TextStreamFactory<T extends LocalAbstractObject>, LocalAbstractObject.TrivialDistanceFunction
objects
counterDistanceComputations, counterLowerBoundDistanceComputations, counterPrecomputedDistanceSavings, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, trivialDistanceFunction, UNKNOWN_DISTANCE
Modifier | Constructor and Description |
---|---|
|
MetaObjectArrayWeightedSum(AbstractObjectKey objectKey,
LocalAbstractObject... objects)
Creates a new instance of MetaObjectArrayWeightedSum.
|
protected |
MetaObjectArrayWeightedSum(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of MetaObjectArrayWeightedSum loaded from binary input.
|
|
MetaObjectArrayWeightedSum(java.io.BufferedReader stream,
java.lang.Class<? extends LocalAbstractObject>[] classes)
Creates a new instance of MetaObjectArrayWeightedSum from the given text stream.
|
|
MetaObjectArrayWeightedSum(java.io.BufferedReader stream,
int objectCount,
java.lang.Class<? extends LocalAbstractObject> objectClass)
Creates a new instance of MetaObjectArrayWeightedSum from the given text stream.
|
|
MetaObjectArrayWeightedSum(LocalAbstractObject... objects)
Creates a new instance of MetaObjectArrayWeightedSum.
|
|
MetaObjectArrayWeightedSum(java.lang.String locatorURI,
LocalAbstractObject... objects)
Creates a new instance of MetaObjectArrayWeightedSum.
|
|
MetaObjectArrayWeightedSum(java.lang.String locatorURI,
java.util.Map<java.lang.String,? extends LocalAbstractObject> objects,
java.lang.String... objectNames)
Creates a new instance of MetaObjectArrayWeightedSum that takes the objects from the given map.
|
Modifier and Type | Method and Description |
---|---|
protected float |
getDistanceImpl(LocalAbstractObject obj,
float[] metaDistances,
float distThreshold)
The actual implementation of the metric function.
|
float |
getMaxDistance()
Returns a maximal possible distance for this class.
|
protected float |
getWeight(int index)
Returns the weight used for the
index th encapsulated object distance in the overall distance sum. |
binarySerialize, createClassArray, getBinarySize, getObject, getObject, getObjectCount, getObjectMap, getObjectName, getObjectNames, getObjects, readObjects, writeData
clearSurplusData, containsObject, createMetaDistancesHolder, createSearchMetaObject, dataEquals, dataHashCode, fillMetaDistances, fillMetaDistances, getDistanceImpl, getObjectFromMap, getSize, implementationGetDistance, readObject, readObject, readObjects, readObjects, readObjectsHeader, toString, writeObjects, writeObjectsHeader
clone, clone, cloneRandomlyModify, create, create, 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 MetaObjectArrayWeightedSum(LocalAbstractObject... objects)
objects
- the encapsulated list of objectspublic MetaObjectArrayWeightedSum(AbstractObjectKey objectKey, LocalAbstractObject... objects)
objectKey
- the key to be associated with this objectobjects
- the encapsulated list of objectspublic MetaObjectArrayWeightedSum(java.lang.String locatorURI, LocalAbstractObject... objects)
AbstractObjectKey
is generated for
the specified locatorURI
.locatorURI
- the locator URI for the new objectobjects
- the encapsulated list of objectspublic MetaObjectArrayWeightedSum(java.lang.String locatorURI, java.util.Map<java.lang.String,? extends LocalAbstractObject> objects, java.lang.String... objectNames)
objectNames
array. Note that if the object of a given
name is not in the map, null is inserted into the array.
A new unique object ID is generated and a new AbstractObjectKey
is
generated for the specified locatorURI
.locatorURI
- the locator URI for the new objectobjects
- the map with named objects to encapsulateobjectNames
- the names of the objects to take from the given objects
mappublic MetaObjectArrayWeightedSum(java.io.BufferedReader stream, java.lang.Class<? extends LocalAbstractObject>[] classes) throws java.io.IOException
stream
- the text stream to read the objects fromclasses
- the classes of the objects to read from the streamjava.io.IOException
- when an error appears during reading from given stream,
EOFException is returned if end of the given stream is reached.public MetaObjectArrayWeightedSum(java.io.BufferedReader stream, int objectCount, java.lang.Class<? extends LocalAbstractObject> objectClass) throws java.io.IOException
stream
- the text stream to read the objects fromobjectCount
- number of objects to readobjectClass
- the class of objects to read from the streamjava.io.IOException
- when an error appears during reading from given stream,
EOFException is returned if end of the given stream is reached.protected MetaObjectArrayWeightedSum(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the input to read the MetaObject fromserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error reading from the bufferprotected float getWeight(int index)
index
th encapsulated object distance in the overall distance sum.index
- the fixed index of the object the weight of which to getindex
th encapsulated objectpublic float getMaxDistance()
LocalAbstractObject
LocalAbstractObject.MAX_DISTANCE
.getMaxDistance
in class LocalAbstractObject
protected float getDistanceImpl(LocalAbstractObject obj, float[] metaDistances, float distThreshold)
MetaObjectArray
obj
.
The array metaDistances
is ignored.getDistanceImpl
in class MetaObjectArray
obj
- the object to compute distance tometaDistances
- the array that is filled with the distances of the respective encapsulated objects, if it is not nulldistThreshold
- the threshold value on the distanceLocalAbstractObject.getDistance