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, norms
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, ramBytesUsed
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getChildResources
protected Float[] featureToWeight
public void setWeights(Object weights)
protected void validate() throws ModelException
LTRScoringModel
ModelException
if they do not make sense.validate
in class LTRScoringModel
ModelException
public float score(float[] modelFeatureValuesNormalized)
LTRScoringModel
score
in class LTRScoringModel
modelFeatureValuesNormalized
- 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)
LTRScoringModel
explain
in class LTRScoringModel
context
- Context the document is indoc
- Document to explainfinalScore
- Original scorefeatureExplanations
- Explanations for each feature calculationpublic String toString()
toString
in class LTRScoringModel
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.