Details
-
New Feature
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
We implment new LTR model which uses DSL for describing the scoring function. This model is inspired by the implementation of JavascriptCompiler which compiles javascript codes by using ANTLR and ASM. The syntax of our DSL is based on Java and FunctionQuery, and we can describe various models freely by using the DSL. Please see ltr/dsl/package-info.java for more details.
The configuration of our model looks like belows:
{ "class":"org.apache.solr.ltr.model.DSLModel", "name":"dslmodel", "features":[ {"name":"popularity"}, {"name":"normHits"}, {"name":"isTrendy"} ], "params":{ "dsl": "(0.2 * popularity / 10 + 0.3 * normHits) * if(isTrendy==1, 2.0, 1.0)" } }
This approach is similar to re-ranking with FunctionQuery, except that our model compiles the DSL into bytecodes on ahead and can calculate scores faster. In practice, the performance of the model is depended on the structure of formula. For example, if we convert existing models (i.e., LinearModel and MultipleAdditiveTreesModel) to DSLs and compare the performance (with large models), our model is 4.5x slower than LinearModel but 1.5x faster than MultipleAdditiveTreesModel.