public class MetaObjectParametricArrayWeightedSum extends MetaObjectParametricArray
MetaObjectParametricArray
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 |
---|---|
|
MetaObjectParametricArrayWeightedSum(AbstractObjectKey objectKey,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
LocalAbstractObject... objects)
Creates a new instance of MetaObjectParametricArrayWeightedSum.
|
|
MetaObjectParametricArrayWeightedSum(AbstractObjectKey objectKey,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
java.util.Map<java.lang.String,? extends LocalAbstractObject> objects,
java.lang.String... objectNames)
Creates a new instance of MetaObjectParametricArrayWeightedSum that takes the objects from the given map.
|
protected |
MetaObjectParametricArrayWeightedSum(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of MetaObjectParametricArrayWeightedSum loaded from binary input.
|
|
MetaObjectParametricArrayWeightedSum(java.io.BufferedReader stream)
Creates a new instance of MetaObjectParametricArrayWeightedSum from the given text stream with header.
|
|
MetaObjectParametricArrayWeightedSum(java.io.BufferedReader stream,
java.lang.Class<? extends LocalAbstractObject>[] classes)
Creates a new instance of MetaObjectParametricArrayWeightedSum from the given text stream.
|
|
MetaObjectParametricArrayWeightedSum(java.io.BufferedReader stream,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
java.lang.Class<? extends LocalAbstractObject>[] classes)
Creates a new instance of MetaObjectParametricArrayWeightedSum from the given text stream.
|
|
MetaObjectParametricArrayWeightedSum(java.io.BufferedReader stream,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
int objectCount,
java.lang.Class<? extends LocalAbstractObject> objectClass)
Creates a new instance of MetaObjectParametricArrayWeightedSum from the given text stream.
|
|
MetaObjectParametricArrayWeightedSum(java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
LocalAbstractObject... objects)
Creates a new instance of MetaObjectParametricArrayWeightedSum.
|
|
MetaObjectParametricArrayWeightedSum(java.lang.String locatorURI,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
LocalAbstractObject... objects)
Creates a new instance of MetaObjectParametricArrayWeightedSum.
|
|
MetaObjectParametricArrayWeightedSum(java.lang.String locatorURI,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
java.util.Map<java.lang.String,? extends LocalAbstractObject> objects,
java.lang.String... objectNames)
Creates a new instance of MetaObjectParametricArrayWeightedSum 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, getBinarySize, getObject, getObject, getObjectCount, getObjectMap, getObjectName, getObjectNames, getObjects, writeDataImpl
clearSurplusData, containsParameter, getParameter, getParameter, getParameter, getParameterCount, getParameterMap, getParameterNames, getRequiredParameter, getRequiredParameter, parseObjectComment, removeParameter, setParameter, writeData
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, peekNextChar, readAttributesFromStream, readObjectComments, readObjectCommentsWithoutData, unchainFilter, write, write, writeAttributesToStream, writeObjectComment
clone, getLocatorURI, getNoDataObject, getObjectKey, getObjectKey, getObjectLocatorURI, setObjectKey
public MetaObjectParametricArrayWeightedSum(java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, LocalAbstractObject... objects)
additionalParameters
- additional parameters for this meta objectobjects
- the encapsulated list of objectspublic MetaObjectParametricArrayWeightedSum(AbstractObjectKey objectKey, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, LocalAbstractObject... objects)
objectKey
- the key to be associated with this objectadditionalParameters
- additional parameters for this meta objectobjects
- the encapsulated list of objectspublic MetaObjectParametricArrayWeightedSum(java.lang.String locatorURI, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, LocalAbstractObject... objects)
AbstractObjectKey
is generated for
the specified locatorURI
.locatorURI
- the locator URI for the new objectadditionalParameters
- additional parameters for this meta objectobjects
- the encapsulated list of objectspublic MetaObjectParametricArrayWeightedSum(java.lang.String locatorURI, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, 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 objectadditionalParameters
- additional parameters for this meta objectobjects
- the map with named objects to encapsulateobjectNames
- the names of the objects to take from the given objects
mappublic MetaObjectParametricArrayWeightedSum(AbstractObjectKey objectKey, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, 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 the given objectKey
is used for the object.objectKey
- the key to be associated with this objectadditionalParameters
- additional parameters for this meta objectobjects
- the map with named objects to encapsulateobjectNames
- the names of the objects to take from the given objects
mappublic MetaObjectParametricArrayWeightedSum(java.io.BufferedReader stream) throws java.io.IOException
stream
- the text stream to read the objects fromjava.io.IOException
- when an error appears during reading from given stream,
EOFException is returned if end of the given stream is reached.MetaObject.readObjectsHeader(java.io.BufferedReader)
public MetaObjectParametricArrayWeightedSum(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 MetaObjectParametricArrayWeightedSum(java.io.BufferedReader stream, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, java.lang.Class<? extends LocalAbstractObject>[] classes) throws java.io.IOException
stream
- the text stream to read the objects fromadditionalParameters
- additional parameters for this meta objectclasses
- 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 MetaObjectParametricArrayWeightedSum(java.io.BufferedReader stream, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, int objectCount, java.lang.Class<? extends LocalAbstractObject> objectClass) throws java.io.IOException
stream
- the text stream to read the objects fromadditionalParameters
- additional parameters for this meta objectobjectCount
- 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 MetaObjectParametricArrayWeightedSum(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)
MetaObjectParametricArray
obj
.
The array metaDistances
is ignored.getDistanceImpl
in class MetaObjectParametricArray
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