public class PreferenceVectorBasedCorrelationDistance extends CorrelationDistance<PreferenceVectorBasedCorrelationDistance>
Modifier and Type | Field and Description |
---|---|
private BitSet |
commonPreferenceVector
The common preference vector of the two objects defining this distance.
|
private int |
dimensionality
The dimensionality of the feature space (needed for serialization).
|
static PreferenceVectorBasedCorrelationDistance |
FACTORY
The static factory instance
|
private static long |
serialVersionUID
Serial version
|
CORRELATION_DISTANCE_PATTERN, correlationValue, euclideanValue, SEPARATOR
DOUBLE_PATTERN, INFINITY_PATTERN, INTEGER_PATTERN
Constructor and Description |
---|
PreferenceVectorBasedCorrelationDistance()
Empty constructor for serialization purposes.
|
PreferenceVectorBasedCorrelationDistance(int dimensionality,
int correlationValue,
double euclideanValue,
BitSet commonPreferenceVector)
Constructs a new CorrelationDistance object.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(PreferenceVectorBasedCorrelationDistance distance)
Checks if the dimensionality values of this distance and the specified
distance are equal.
|
int |
externalizableSize()
Returns the number of Bytes this distance uses if it is written to an
external file.
|
BitSet |
getCommonPreferenceVector()
Returns the common preference vector of the two objects defining this
distance.
|
Pattern |
getPattern()
Get the pattern accepted by this distance
|
PreferenceVectorBasedCorrelationDistance |
infiniteDistance()
Provides an infinite distance.
|
PreferenceVectorBasedCorrelationDistance |
minus(PreferenceVectorBasedCorrelationDistance distance)
Returns a new Distance by subtracting the given distance from this
distance.
|
PreferenceVectorBasedCorrelationDistance |
nullDistance()
Provides a null distance.
|
PreferenceVectorBasedCorrelationDistance |
parseString(String pattern)
Provides a measurement suitable to this measurement function based on the
given pattern.
|
PreferenceVectorBasedCorrelationDistance |
plus(PreferenceVectorBasedCorrelationDistance distance)
Returns a new distance as sum of this distance and the given distance.
|
void |
readExternal(ObjectInput in)
Calls
CorrelationDistance.readExternal(java.io.ObjectInput)
and reads additionally the dimensionality and each Byte of the common
preference vector from the specified stream.. |
String |
toString()
Returns a string representation of this
PreferenceVectorBasedCorrelationDistance.
|
PreferenceVectorBasedCorrelationDistance |
undefinedDistance()
Provides an undefined distance.
|
void |
writeExternal(ObjectOutput out)
Calls
CorrelationDistance.writeExternal(java.io.ObjectOutput)
and writes additionally the dimensionality and each Byte of the common
preference vector to the specified stream. |
equals, getCorrelationValue, getEuclideanValue, hashCode
isInfiniteDistance, isNullDistance, isUndefinedDistance, requiredInputPattern, testInputPattern
public static final PreferenceVectorBasedCorrelationDistance FACTORY
private static final long serialVersionUID
private int dimensionality
private BitSet commonPreferenceVector
public PreferenceVectorBasedCorrelationDistance()
public PreferenceVectorBasedCorrelationDistance(int dimensionality, int correlationValue, double euclideanValue, BitSet commonPreferenceVector)
dimensionality
- the dimensionality of the feature space (needed for
serialization)correlationValue
- the correlation dimension to be represented by the
CorrelationDistanceeuclideanValue
- the euclidean distance to be represented by the
CorrelationDistancecommonPreferenceVector
- the common preference vector of the two
objects defining this distancepublic BitSet getCommonPreferenceVector()
public String toString()
toString
in interface Distance<PreferenceVectorBasedCorrelationDistance>
toString
in class CorrelationDistance<PreferenceVectorBasedCorrelationDistance>
public PreferenceVectorBasedCorrelationDistance plus(PreferenceVectorBasedCorrelationDistance distance)
Distance
distance
- the distance to be added to this distanceIllegalArgumentException
- if the dimensionality values and common
preference vectors of this distance and the specified distance are
not equalpublic PreferenceVectorBasedCorrelationDistance minus(PreferenceVectorBasedCorrelationDistance distance)
Distance
distance
- the distance to be subtracted from this distanceIllegalArgumentException
- if the dimensionality values and common
preference vectors of this distance and the specified distance are
not equalpublic int compareTo(PreferenceVectorBasedCorrelationDistance distance)
CorrelationDistance#compareTo(distance)
is returned.compareTo
in interface Comparable<PreferenceVectorBasedCorrelationDistance>
compareTo
in class CorrelationDistance<PreferenceVectorBasedCorrelationDistance>
CorrelationDistance#compareTo(distance)
IllegalArgumentException
- if the dimensionality values of this
distance and the specified distance are not equalpublic void writeExternal(ObjectOutput out) throws IOException
CorrelationDistance.writeExternal(java.io.ObjectOutput)
and writes additionally the dimensionality and each Byte of the common
preference vector to the specified stream.writeExternal
in interface Externalizable
writeExternal
in class CorrelationDistance<PreferenceVectorBasedCorrelationDistance>
IOException
public void readExternal(ObjectInput in) throws IOException
CorrelationDistance.readExternal(java.io.ObjectInput)
and reads additionally the dimensionality and each Byte of the common
preference vector from the specified stream..readExternal
in interface Externalizable
readExternal
in class CorrelationDistance<PreferenceVectorBasedCorrelationDistance>
IOException
public int externalizableSize()
externalizableSize
in interface Distance<PreferenceVectorBasedCorrelationDistance>
externalizableSize
in class CorrelationDistance<PreferenceVectorBasedCorrelationDistance>
public Pattern getPattern()
AbstractDistance
getPattern
in class AbstractDistance<PreferenceVectorBasedCorrelationDistance>
public PreferenceVectorBasedCorrelationDistance parseString(String pattern) throws IllegalArgumentException
Distance
pattern
- a pattern defining a similarity suitable to this measurement
functionIllegalArgumentException
- if the given pattern is not compatible
with the requirements of this measurement functionpublic PreferenceVectorBasedCorrelationDistance infiniteDistance()
Distance
public PreferenceVectorBasedCorrelationDistance nullDistance()
Distance
public PreferenceVectorBasedCorrelationDistance undefinedDistance()
Distance