public final class FeatureVectorsPartition extends Object implements FeatureVectors
ALSServingModel
or ALSSpeedModel. This represents one partition of vectors; see PartitionedFeatureVectors
for a representation of many partitions.| Constructor and Description |
|---|
FeatureVectorsPartition() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAllIDsTo(Collection<String> allIDs)
Adds all IDs that are mapped to a feature vector to a given collection
|
void |
addAllRecentTo(Collection<String> allRecent)
Add all recently set IDs to the given collection
|
void |
forEach(BiConsumer<String,float[]> action) |
float[] |
getVector(String id) |
double[] |
getVTV(boolean background) |
void |
removeAllIDsFrom(Collection<String> allIDs)
Removes all IDs that are mapped to a feature vector from a given collection
|
void |
retainRecentAndIDs(Collection<String> newModelIDs)
Given IDs that are part of a new model, and whose values are going to be sent later,
retain only IDs that are also in the new model (or have been recently seen -- possibly since
last model was built), and remove the rest.
|
void |
setVector(String id,
float[] vector)
Sets the value of a feature vector for an ID.
|
int |
size() |
String |
toString() |
public int size()
size in interface FeatureVectorspublic float[] getVector(String id)
getVector in interface FeatureVectorsid - ID to get feature vector fornull if doesn't existpublic void setVector(String id, float[] vector)
FeatureVectorsFeatureVectors.retainRecentAndIDs(Collection) call.setVector in interface FeatureVectorsid - ID to set feature vector forvector - new feature vectorpublic void addAllIDsTo(Collection<String> allIDs)
FeatureVectorsaddAllIDsTo in interface FeatureVectorsallIDs - collection to add IDs topublic void removeAllIDsFrom(Collection<String> allIDs)
FeatureVectorsremoveAllIDsFrom in interface FeatureVectorsallIDs - collection to add IDs topublic void addAllRecentTo(Collection<String> allRecent)
FeatureVectorsaddAllRecentTo in interface FeatureVectorsallRecent - collection to add IDs topublic void retainRecentAndIDs(Collection<String> newModelIDs)
FeatureVectorsretainRecentAndIDs in interface FeatureVectorsnewModelIDs - new model IDspublic void forEach(BiConsumer<String,float[]> action)
action - function to apply to every ID/vector pairpublic double[] getVTV(boolean background)
getVTV in interface FeatureVectorsbackground - if true, a hint that this potentially expensive computation may be
deprioritized and need not use all available resources to computeCopyright © 2014–2018. All rights reserved.