public class LinearModel extends LTRScoringModel
Example configuration:
{
"class" : "org.apache.solr.ltr.model.LinearModel",
"name" : "myModelName",
"features" : [
{ "name" : "userTextTitleMatch" },
{ "name" : "originalScore" },
{ "name" : "isBook" }
],
"params" : {
"weights" : {
"userTextTitleMatch" : 1.0,
"originalScore" : 0.5,
"isBook" : 0.1
}
}
}
Training libraries:
Background reading:
| Modifier and Type | Field and Description |
|---|---|
protected Float[] |
featureToWeight
featureToWeight is part of the LTRScoringModel params map
and therefore here it does not individually
influence the class hashCode, equals, etc.
|
features, name, normsNULL_ACCOUNTABLE| Constructor and Description |
|---|
LinearModel(String name,
List<Feature> features,
List<Normalizer> norms,
String featureStoreName,
List<Feature> allFeatures,
Map<String,Object> params) |
| Modifier and Type | Method and Description |
|---|---|
Explanation |
explain(LeafReaderContext context,
int doc,
float finalScore,
List<Explanation> featureExplanations)
Similar to the score() function, except it returns an explanation of how
the features were used to calculate the score.
|
float |
score(float[] modelFeatureValuesNormalized)
Given a list of normalized values for all features a scoring algorithm
cares about, calculate and return a score.
|
void |
setWeights(Object weights) |
String |
toString() |
protected void |
validate()
Validate that settings make sense and throws
ModelException if they do not make sense. |
equals, getAllFeatures, getFeatures, getFeatureStoreName, getInstance, getName, getNormalizerExplanation, getNorms, getParams, hashCode, normalizeFeaturesInPlace, ramBytesUsedclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetChildResourcesprotected Float[] featureToWeight
public void setWeights(Object weights)
protected void validate()
throws ModelException
LTRScoringModelModelException if they do not make sense.validate in class LTRScoringModelModelExceptionpublic float score(float[] modelFeatureValuesNormalized)
LTRScoringModelscore in class LTRScoringModelmodelFeatureValuesNormalized - List of normalized feature values. Each feature is identified by
its id, which is the index in the arraypublic Explanation explain(LeafReaderContext context, int doc, float finalScore, List<Explanation> featureExplanations)
LTRScoringModelexplain in class LTRScoringModelcontext - Context the document is indoc - Document to explainfinalScore - Original scorefeatureExplanations - Explanations for each feature calculationpublic String toString()
toString in class LTRScoringModelCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.