Class MultipleAdditiveTreesModel

java.lang.Object
org.apache.solr.ltr.model.LTRScoringModel
org.apache.solr.ltr.model.MultipleAdditiveTreesModel
All Implemented Interfaces:
org.apache.lucene.util.Accountable

public class MultipleAdditiveTreesModel extends LTRScoringModel
A scoring model that computes scores based on the summation of multiple weighted trees. Example models are LambdaMART and Gradient Boosted Regression Trees (GBRT) .

Example configuration:

 {
   "class" : "org.apache.solr.ltr.model.MultipleAdditiveTreesModel",
   "name" : "multipleadditivetreesmodel",
   "features":[
     { "name" : "userTextTitleMatch"},
     { "name" : "originalScore"}
   ],
   "params" : {
     "trees" : [
       {
         "weight" : "1",
         "root": {
           "feature" : "userTextTitleMatch",
           "threshold" : "0.5",
           "left" : {
             "value" : "-100"
           },
           "right" : {
             "feature" : "originalScore",
             "threshold" : "10.0",
             "left" : {
               "value" : "50"
             },
             "right" : {
               "value" : "75"
             }
           }
         }
       },
       {
         "weight" : "2",
         "root" : {
           "value" : "-10"
         }
       }
     ]
   }
 }
 

Training libraries:

Background reading:

  • Constructor Details

  • Method Details

    • setIsNullSameAsZero

      public void setIsNullSameAsZero(boolean nullSameAsZero)
    • setTrees

      public void setTrees(Object trees)
    • validate

      protected void validate() throws ModelException
      Description copied from class: LTRScoringModel
      Validate that settings make sense and throws ModelException if they do not make sense.
      Overrides:
      validate in class LTRScoringModel
      Throws:
      ModelException
    • normalizeFeaturesInPlace

      public void normalizeFeaturesInPlace(float[] modelFeatureValues)
      Description copied from class: LTRScoringModel
      Goes through all the stored feature values, and calculates the normalized values for all the features that will be used for scoring.
      Overrides:
      normalizeFeaturesInPlace in class LTRScoringModel
    • normalizeFeaturesInPlace

      protected void normalizeFeaturesInPlace(float[] modelFeatureValues, boolean isNullSameAsZero)
    • score

      public float score(float[] modelFeatureValuesNormalized)
      Description copied from class: LTRScoringModel
      Given a list of normalized values for all features a scoring algorithm cares about, calculate and return a score.
      Specified by:
      score in class LTRScoringModel
      Parameters:
      modelFeatureValuesNormalized - List of normalized feature values. Each feature is identified by its id, which is the index in the array
      Returns:
      The final score for a document
    • explain

      public org.apache.lucene.search.Explanation explain(org.apache.lucene.index.LeafReaderContext context, int doc, float finalScore, List<org.apache.lucene.search.Explanation> featureExplanations)
      Description copied from class: LTRScoringModel
      Similar to the score() function, except it returns an explanation of how the features were used to calculate the score.
      Specified by:
      explain in class LTRScoringModel
      Parameters:
      context - Context the document is in
      doc - Document to explain
      finalScore - Original score
      featureExplanations - Explanations for each feature calculation
      Returns:
      Explanation for the scoring of a document
    • toString

      public String toString()
      Overrides:
      toString in class LTRScoringModel