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 scoringfeaturesspecified 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 classRelevancyModel.FeatureWeightstatic classRelevancyModel.Source
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MAX_HISTORYstatic longDEFAULT_MAX_SIGNAL_AGEstatic java.lang.StringRELEVANCY_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 voidaddWeight(java.lang.String feature, float weight)RelevancyModelclone()intcompareTo(RelevancyModel other)booleanequals(java.lang.Object other)doublegetAccuracy()Get the computed accuracy for a trained relevancy model.static java.lang.StringgetBaseName(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.RelevancyFeatureVectorgetFeatures()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.longgetLastModified()Get the timestamp for the last modification to this relevancy modelintgetMaxHistory()Get the maximum number of trained relevancy models to retain.longgetMaxSignalAge()Get maximum age for a signal to include when training relevancy model (in milliseconds).java.lang.StringgetName()java.lang.StringgetOption(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.doublegetPublishThreshold()Get the accuracy threshold needed to be achieved to automatically publish a trained relevancy model.java.lang.StringgetQueryString()Get a query string for explicitly selecting this relevancy model.static java.lang.StringgetQueryString(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.SourcegetSource()longgetVersion()static longgetVersion(java.lang.String query)Get the version for a relevancy model query.java.util.List<RelevancyModel.FeatureWeight>getWeights()inthashCode()static booleanisBaseName(java.lang.String query)Returnstrueifqueryis 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.voidsetAccuracy(double value)Set the computed accuracy for a trained relevancy model.voidsetFeatureBlacklist(java.lang.String... value)Set the names of the features to exclude from relevancy model training data.voidsetFeatureBlacklist(java.util.Set<java.lang.String> value)Set the names of the features to exclude from relevancy model training data.voidsetFeatureWhitelist(java.lang.String... value)Set the names of the features to use for training relevancy model.voidsetFeatureWhitelist(java.util.Set<java.lang.String> value)Set the names of the features to use for training relevancy model.voidsetLastModified(long value)Get the timestamp for the last modification to this relevancy modelvoidsetMaxHistory(int value)Set the maximum number of trained relevancy models to retain.voidsetMaxSignalAge(long value)Set maximum age for a signal to include when training relevancy model (in milliseconds).voidsetName(java.lang.String value)voidsetOption(java.lang.String name, java.lang.String value)voidsetOptions(java.util.Map<java.lang.String,java.lang.String> value)Set options to use for training relevancy model.voidsetPublishThreshold(double value)Set the accuracy threshold needed to be achieved to automatically publish a trained relevancy model.voidsetSignalTypes(java.lang.String... value)voidsetSignalTypes(java.util.Set<java.lang.String> value)Set the signal types to use when training relevancy model.voidsetSource(RelevancyModel.Source value)voidsetVersion(long value)voidsetWeights(java.util.List<RelevancyModel.FeatureWeight> value)java.lang.StringtoString()
-
-
-
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.TRAINEDrelevancy 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.TRAINEDrelevancy 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
nullall 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
nullall 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
nullall 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:
iteratorin interfacejava.lang.Iterable<RelevancyModel.FeatureWeight>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
compareTo
public int compareTo(RelevancyModel other)
- Specified by:
compareToin interfacejava.lang.Comparable<RelevancyModel>
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
clone
public RelevancyModel clone()
- Overrides:
clonein classjava.lang.Object
-
isBaseName
public static boolean isBaseName(java.lang.String query)
Returnstrueifqueryis a base relevancy model name.Returns
falseifquerycontains 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.
-
-