Package smile.neighbor.lsh
Class Probe
java.lang.Object
smile.neighbor.lsh.Probe
- All Implemented Interfaces:
Comparable<Probe>
Probe to check for nearest neighbors.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
copy()
Returns a shallow copy that shares the range array.expand()
This operation sets to one the component following the last nonzero component if it is not the last one.extend()
This operation adds one to the last nonzero component.int
Returns the bucket number of the probe.boolean
Returns true if the probe is expandable.boolean
Returns true if the probe is extendable.boolean
Returns true if the probe is shiftable.void
Calculate the probability of the probe.shift()
This operation shifts to the right the last nonzero component if it is equal to one and if it is not the last one.
-
Constructor Details
-
Probe
public Probe(int[] range) Constructor.- Parameters:
range
- the valid range of buckets.
-
-
Method Details
-
copy
Returns a shallow copy that shares the range array. -
isShiftable
public boolean isShiftable()Returns true if the probe is shiftable.- Returns:
- true if the probe is shiftable.
-
shift
This operation shifts to the right the last nonzero component if it is equal to one and if it is not the last one.- Returns:
- the shifted probe.
-
isExpandable
public boolean isExpandable()Returns true if the probe is expandable.- Returns:
- true if the probe is expandable.
-
expand
This operation sets to one the component following the last nonzero component if it is not the last one.- Returns:
- the expanded probe.
-
isExtendable
public boolean isExtendable()Returns true if the probe is extendable.- Returns:
- true if the probe is extendable.
-
extend
This operation adds one to the last nonzero component.- Returns:
- the extended probe.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Probe>
-
setProb
Calculate the probability of the probe.- Parameters:
pz
- the probability of the probe.
-
hash
Returns the bucket number of the probe.- Parameters:
hash
- the hash function.pz
- the probability list of all buckets for given query object.- Returns:
- the hash code.
-