Class RelevancyModel
- java.lang.Object
-
- com.attivio.sdk.search.relevancy.RelevancyModel
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<RelevancyModel>
,java.lang.Iterable<RelevancyModel.FeatureWeight>
public class RelevancyModel extends java.lang.Object implements java.lang.Iterable<RelevancyModel.FeatureWeight>, java.lang.Comparable<RelevancyModel>, java.io.Serializable, java.lang.Cloneable
The model for applying weights and scoringfeatures
specified on aQueryRequest
.EXPERIMENTAL: this class is expected to change in incompatible ways.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RelevancyModel.FeatureWeight
static class
RelevancyModel.Source
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_MAX_HISTORY
static long
DEFAULT_MAX_SIGNAL_AGE
static java.lang.String
RELEVANCY_MODEL_WARNING
-
Constructor Summary
Constructors Constructor Description RelevancyModel()
RelevancyModel(java.lang.String name)
RelevancyModel(java.lang.String name, long version)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addWeight(java.lang.String feature, float weight)
RelevancyModel
clone()
int
compareTo(RelevancyModel other)
boolean
equals(java.lang.Object other)
double
getAccuracy()
Get the computed accuracy for a trained relevancy model.static java.lang.String
getBaseName(java.lang.String query)
Get the relevancy model name for a query.java.util.Set<java.lang.String>
getFeatureBlacklist()
Get the names of the features to exclude from relevancy model training data.RelevancyFeatureVector
getFeatures()
Get this relevancy model's features as aRelevancyFeatureVector
.java.util.Set<java.lang.String>
getFeatureWhitelist()
Get the names of the features to use for training relevancy model.long
getLastModified()
Get the timestamp for the last modification to this relevancy modelint
getMaxHistory()
Get the maximum number of trained relevancy models to retain.long
getMaxSignalAge()
Get maximum age for a signal to include when training relevancy model (in milliseconds).java.lang.String
getName()
java.lang.String
getOption(java.lang.String name)
Get an option by name.java.util.Map<java.lang.String,java.lang.String>
getOptions()
Get options to use for training relevancy model.double
getPublishThreshold()
Get the accuracy threshold needed to be achieved to automatically publish a trained relevancy model.java.lang.String
getQueryString()
Get a query string for explicitly selecting this relevancy model.static java.lang.String
getQueryString(java.lang.String name, long version)
Get a query string for explicitly selecting this relevancy model.java.util.Set<java.lang.String>
getSignalTypes()
Get the signal types to use when training relevancy model.RelevancyModel.Source
getSource()
long
getVersion()
static long
getVersion(java.lang.String query)
Get the version for a relevancy model query.java.util.List<RelevancyModel.FeatureWeight>
getWeights()
int
hashCode()
static boolean
isBaseName(java.lang.String query)
Returnstrue
ifquery
is a base relevancy model name.java.util.Iterator<RelevancyModel.FeatureWeight>
iterator()
static java.util.List<java.lang.String>
parseRelevancyModelNames(java.lang.String value)
Parse a comma separated list of relevancy model names.void
setAccuracy(double value)
Set the computed accuracy for a trained relevancy model.void
setFeatureBlacklist(java.lang.String... value)
Set the names of the features to exclude from relevancy model training data.void
setFeatureBlacklist(java.util.Set<java.lang.String> value)
Set the names of the features to exclude from relevancy model training data.void
setFeatureWhitelist(java.lang.String... value)
Set the names of the features to use for training relevancy model.void
setFeatureWhitelist(java.util.Set<java.lang.String> value)
Set the names of the features to use for training relevancy model.void
setLastModified(long value)
Get the timestamp for the last modification to this relevancy modelvoid
setMaxHistory(int value)
Set the maximum number of trained relevancy models to retain.void
setMaxSignalAge(long value)
Set maximum age for a signal to include when training relevancy model (in milliseconds).void
setName(java.lang.String value)
void
setOption(java.lang.String name, java.lang.String value)
void
setOptions(java.util.Map<java.lang.String,java.lang.String> value)
Set options to use for training relevancy model.void
setPublishThreshold(double value)
Set the accuracy threshold needed to be achieved to automatically publish a trained relevancy model.void
setSignalTypes(java.lang.String... value)
void
setSignalTypes(java.util.Set<java.lang.String> value)
Set the signal types to use when training relevancy model.void
setSource(RelevancyModel.Source value)
void
setVersion(long value)
void
setWeights(java.util.List<RelevancyModel.FeatureWeight> value)
java.lang.String
toString()
-
-
-
Field Detail
-
RELEVANCY_MODEL_WARNING
public static final java.lang.String RELEVANCY_MODEL_WARNING
- See Also:
- Constant Field Values
-
DEFAULT_MAX_HISTORY
public static final int DEFAULT_MAX_HISTORY
- See Also:
- Constant Field Values
-
DEFAULT_MAX_SIGNAL_AGE
public static final long DEFAULT_MAX_SIGNAL_AGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
public java.lang.String getName()
-
setName
public void setName(java.lang.String value)
-
getSource
public RelevancyModel.Source getSource()
-
setSource
public void setSource(RelevancyModel.Source value)
-
getVersion
public long getVersion()
-
setVersion
public void setVersion(long value)
-
getLastModified
public long getLastModified()
Get the timestamp for the last modification to this relevancy model
-
setLastModified
public void setLastModified(long value)
Get the timestamp for the last modification to this relevancy model
-
getQueryString
public java.lang.String getQueryString()
Get a query string for explicitly selecting this relevancy model.
-
getAccuracy
public double getAccuracy()
Get the computed accuracy for a trained relevancy model.Accuracy score will range between 0.0 and 100.0, indicating a percentage score.
Accuracy will only be populated for
RelevancyModel.Source.TRAINED
relevancy models and will be computed over the signal data used to train the model.
-
setAccuracy
public void setAccuracy(double value)
Set the computed accuracy for a trained relevancy model.Accuracy score will range between 0.0 and 100.0, indicating a percentage score.
Accuracy will only be populated for
RelevancyModel.Source.TRAINED
relevancy models and will be computed over the signal data used to train the model.
-
getPublishThreshold
public double getPublishThreshold()
Get the accuracy threshold needed to be achieved to automatically publish a trained relevancy model.If this threshold is > 0.0 and the computed accuracy for the relevancy model is greater than this threshold, the relevancy model will be automatically published as part of training.
NOTE: only applies when relevancy model is being trained.
-
setPublishThreshold
public void setPublishThreshold(double value)
Set the accuracy threshold needed to be achieved to automatically publish a trained relevancy model.If this threshold is > 0.0 and the computed accuracy for the relevancy model is greater than this threshold, the relevancy model will be automatically published as part of training.
NOTE: only applies when relevancy model is being trained.
-
getMaxHistory
public int getMaxHistory()
Get the maximum number of trained relevancy models to retain.If greater than zero, upon successful training of this relevancy model, old trained relevancy models that are not published will be purged.
-
setMaxHistory
public void setMaxHistory(int value)
Set the maximum number of trained relevancy models to retain.If greater than zero, upon successful training of this relevancy model, old trained relevancy models that are not published will be purged.
-
getMaxSignalAge
public long getMaxSignalAge()
Get maximum age for a signal to include when training relevancy model (in milliseconds).If less than 1, signals will be included in training data regardless of age.
-
setMaxSignalAge
public void setMaxSignalAge(long value)
Set maximum age for a signal to include when training relevancy model (in milliseconds).If less than 1, signals will be included in training data regardless of age.
-
getSignalTypes
public java.util.Set<java.lang.String> getSignalTypes()
Get the signal types to use when training relevancy model.If
null
all signal types will be included in training data.
-
setSignalTypes
public void setSignalTypes(java.util.Set<java.lang.String> value)
Set the signal types to use when training relevancy model.If
null
all signal types will be included in training data.
-
setSignalTypes
public void setSignalTypes(java.lang.String... value)
-
getFeatureWhitelist
public java.util.Set<java.lang.String> getFeatureWhitelist()
Get the names of the features to use for training relevancy model.If
null
all available features not ingetFeatureBlacklist()
will be included in training data.
-
setFeatureWhitelist
public void setFeatureWhitelist(java.util.Set<java.lang.String> value)
Set the names of the features to use for training relevancy model.If no features are specified, all available features not in
getFeatureBlacklist()
will be included in training data.
-
setFeatureWhitelist
public void setFeatureWhitelist(java.lang.String... value)
Set the names of the features to use for training relevancy model.If no features are specified, all available features not in
getFeatureBlacklist()
will be included in training data.
-
getFeatureBlacklist
public java.util.Set<java.lang.String> getFeatureBlacklist()
Get the names of the features to exclude from relevancy model training data.
-
setFeatureBlacklist
public void setFeatureBlacklist(java.util.Set<java.lang.String> value)
Set the names of the features to exclude from relevancy model training data.
-
setFeatureBlacklist
public void setFeatureBlacklist(java.lang.String... value)
Set the names of the features to exclude from relevancy model training data.
-
getOption
public java.lang.String getOption(java.lang.String name)
Get an option by name.Options are advanced arbitrary key/value pairs used for tuning the training of relevancy models.
-
setOption
public void setOption(java.lang.String name, java.lang.String value)
-
getOptions
public java.util.Map<java.lang.String,java.lang.String> getOptions()
Get options to use for training relevancy model.Options are advanced arbitrary key/value pairs used for tuning the training of relevancy models.
-
setOptions
public void setOptions(java.util.Map<java.lang.String,java.lang.String> value)
Set options to use for training relevancy model.Options are advanced arbitrary key/value pairs used for tuning the training of relevancy models.
-
getFeatures
public RelevancyFeatureVector getFeatures()
Get this relevancy model's features as aRelevancyFeatureVector
.
-
getWeights
public java.util.List<RelevancyModel.FeatureWeight> getWeights()
-
setWeights
public void setWeights(java.util.List<RelevancyModel.FeatureWeight> value)
-
addWeight
public void addWeight(java.lang.String feature, float weight)
-
iterator
public java.util.Iterator<RelevancyModel.FeatureWeight> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<RelevancyModel.FeatureWeight>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
compareTo
public int compareTo(RelevancyModel other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<RelevancyModel>
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
clone
public RelevancyModel clone()
- Overrides:
clone
in classjava.lang.Object
-
isBaseName
public static boolean isBaseName(java.lang.String query)
Returnstrue
ifquery
is a base relevancy model name.Returns
false
ifquery
contains a version specification.
-
getBaseName
public static java.lang.String getBaseName(java.lang.String query)
Get the relevancy model name for a query.
-
getVersion
public static long getVersion(java.lang.String query)
Get the version for a relevancy model query.
-
getQueryString
public static java.lang.String getQueryString(java.lang.String name, long version)
Get a query string for explicitly selecting this relevancy model.
-
parseRelevancyModelNames
public static java.util.List<java.lang.String> parseRelevancyModelNames(java.lang.String value)
Parse a comma separated list of relevancy model names.
-
-