Class KDTreeFactory
java.lang.Object
org.tribuo.math.neighbour.kdtree.KDTreeFactory
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>,Serializable,NeighboursQueryFactory,ProtoSerializable<org.tribuo.math.protos.NeighbourFactoryProto>
A factory which creates k-d tree nearest neighbour query objects.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intProtobuf serialization version.Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER -
Constructor Summary
ConstructorsConstructorDescriptionKDTreeFactory(Distance distance, int numThreads) Constructs a k-d tree nearest neighbor query factory object using the supplied parameters. -
Method Summary
Modifier and TypeMethodDescriptioncreateNeighboursQuery(SGDVector[] data) Constructs a k-d tree nearest neighbor query object using the supplied array ofSGDVector.static KDTreeFactorydeserializeFromProto(int version, String className, com.google.protobuf.Any message) Deserialization factory.booleanGets theDistanceset on this object.intGet the number of threads set on this object.inthashCode()voidUsed by the OLCUT configuration system, and should not be called by external code.org.tribuo.math.protos.NeighbourFactoryProtoSerializes this object to a protobuf.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.tribuo.math.neighbour.NeighboursQueryFactory
getProvenance
-
Field Details
-
CURRENT_VERSION
public static final int CURRENT_VERSIONProtobuf serialization version.- See Also:
-
-
Constructor Details
-
KDTreeFactory
Constructs a k-d tree nearest neighbor query factory object using the supplied parameters.- Parameters:
distance- The distance function.numThreads- The number of threads to be used to parallelize the computation.
-
-
Method Details
-
deserializeFromProto
public static KDTreeFactory deserializeFromProto(int version, String className, com.google.protobuf.Any message) throws com.google.protobuf.InvalidProtocolBufferException Deserialization factory.- Parameters:
version- The serialized object version.className- The class name.message- The serialized data.- Returns:
- The deserialized object.
- Throws:
com.google.protobuf.InvalidProtocolBufferException- If the protobuf could not be parsed from themessage.
-
serialize
public org.tribuo.math.protos.NeighbourFactoryProto serialize()Description copied from interface:ProtoSerializableSerializes this object to a protobuf.- Specified by:
serializein interfaceProtoSerializable<org.tribuo.math.protos.NeighbourFactoryProto>- Returns:
- The protobuf.
-
createNeighboursQuery
Constructs a k-d tree nearest neighbor query object using the supplied array ofSGDVector.- Specified by:
createNeighboursQueryin interfaceNeighboursQueryFactory- Parameters:
data- An array ofSGDVector.- Returns:
- A query object.
-
getDistance
Description copied from interface:NeighboursQueryFactoryGets theDistanceset on this object.- Specified by:
getDistancein interfaceNeighboursQueryFactory- Returns:
- The distance function.
-
getNumThreads
public int getNumThreads()Description copied from interface:NeighboursQueryFactoryGet the number of threads set on this object. There could be factory implementations that are sequential, meaning they are single threaded.- Specified by:
getNumThreadsin interfaceNeighboursQueryFactory- Returns:
- The number of threads used to parallelize the query operation.
-
postConfig
public void postConfig()Used by the OLCUT configuration system, and should not be called by external code.- Specified by:
postConfigin interfacecom.oracle.labs.mlrg.olcut.config.Configurable
-
equals
-
hashCode
-