You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "kusha.pande" <ku...@gmail.com> on 2018/02/15 13:11:36 UTC

solr ltr jar is not able to recognize MultipleAdditiveTreesModel

Hi I am trying to upload a training model generated from ranklib jar using
lamdamart mart.

The model is like 
{"class":"org.apache.solr.ltr.model.MultipleAdditiveTreesModel",
    "name":"lambdamartmodel",
"params" : {
"trees" :[
   {
      "id": "1",
      "weight": "0.1",
      "split": {
         "feature": "8",
         "threshold": "7.111333",
         "split": [
            {
               "pos": "left",
               "feature": "8",
               "threshold": "5.223557",
               "split": [
                  {
                     "pos": "left",
                     "feature": "8",
                     "threshold": "3.2083516",
                     "split": [
                        {
                           "pos": "left",
                           "feature": "1",
                           "threshold": "100.0",
                           "split": [
                              {
                                 "pos": "left",
                                 "feature": "8",
                                 "threshold": "2.2626402",
                                 "split": [
                                    {
                                       "pos": "left",
                                       "feature": "8",
                                       "threshold": "2.2594802",
                                       "split": [
                                          {
                                             "pos": "left",
                                             "output": "-1.6371088"
                                          },
                                          {
                                             "pos": "right",
                                             "output": "-2.0"
                                          }
                                       ]
                                    },
                                    {
                                       "pos": "right",
                                       "feature": "8",
                                       "threshold": "2.4438097",
                                       "split": [
                                          {
                                             "pos": "left",
                                             "feature": "2",
                                             "threshold": "0.05",
                                             "split": [
                                                {
                                                   "pos": "left",
                                                   "output": "2.0"
                                                },
......


getting an exception as :
Exception: Status: 400 Bad Request
Response: {
  "responseHeader":{
    "status":400,
    "QTime":43},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","java.lang.RuntimeException"],
    "msg":"org.apache.solr.ltr.model.ModelException: Model type does not
exist org.apache.solr.ltr.model.MultipleAdditiveTreesModel",
    "code":400}}
.

I have used RankLib-2.1-patched.jar to generate the model and converted the
generated xml to json.





--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: solr ltr jar is not able to recognize MultipleAdditiveTreesModel

Posted by Alessandro Benedetti <a....@sease.io>.
You can not just use the model output from Ranklib.
I opened this issue few months ago but I never had the right
time/motivation to implement it [1] .
You need to convert it in the Apache Solr LTR expected format.
I remember a script should be available[2]

[1]  https://sourceforge.net/p/lemur/feature-requests/144/

[2] https://github.com/ryac/lambdamart-xml-to-json

--------------------------
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
www.sease.io

On Thu, Feb 15, 2018 at 3:55 PM, Brian Yee <by...@wayfair.com> wrote:

> I'm not sure if this will solve your problem, but you are using a very old
> version of Ranklib. The most recent version is 2.9.
> https://sourceforge.net/projects/lemur/files/lemur/RankLib-2.9/
>
>
> -----Original Message-----
> From: kusha.pande [mailto:kusha.pande@gmail.com]
> Sent: Thursday, February 15, 2018 8:12 AM
> To: solr-user@lucene.apache.org
> Subject: solr ltr jar is not able to recognize MultipleAdditiveTreesModel
>
> Hi I am trying to upload a training model generated from ranklib jar using
> lamdamart mart.
>
> The model is like
> {"class":"org.apache.solr.ltr.model.MultipleAdditiveTreesModel",
>     "name":"lambdamartmodel",
> "params" : {
> "trees" :[
>    {
>       "id": "1",
>       "weight": "0.1",
>       "split": {
>          "feature": "8",
>          "threshold": "7.111333",
>          "split": [
>             {
>                "pos": "left",
>                "feature": "8",
>                "threshold": "5.223557",
>                "split": [
>                   {
>                      "pos": "left",
>                      "feature": "8",
>                      "threshold": "3.2083516",
>                      "split": [
>                         {
>                            "pos": "left",
>                            "feature": "1",
>                            "threshold": "100.0",
>                            "split": [
>                               {
>                                  "pos": "left",
>                                  "feature": "8",
>                                  "threshold": "2.2626402",
>                                  "split": [
>                                     {
>                                        "pos": "left",
>                                        "feature": "8",
>                                        "threshold": "2.2594802",
>                                        "split": [
>                                           {
>                                              "pos": "left",
>                                              "output": "-1.6371088"
>                                           },
>                                           {
>                                              "pos": "right",
>                                              "output": "-2.0"
>                                           }
>                                        ]
>                                     },
>                                     {
>                                        "pos": "right",
>                                        "feature": "8",
>                                        "threshold": "2.4438097",
>                                        "split": [
>                                           {
>                                              "pos": "left",
>                                              "feature": "2",
>                                              "threshold": "0.05",
>                                              "split": [
>                                                 {
>                                                    "pos": "left",
>                                                    "output": "2.0"
>                                                 }, ......
>
>
> getting an exception as :
> Exception: Status: 400 Bad Request
> Response: {
>   "responseHeader":{
>     "status":400,
>     "QTime":43},
>   "error":{
>     "metadata":[
>       "error-class","org.apache.solr.common.SolrException",
>       "root-error-class","java.lang.RuntimeException"],
>     "msg":"org.apache.solr.ltr.model.ModelException: Model type does not
> exist org.apache.solr.ltr.model.MultipleAdditiveTreesModel",
>     "code":400}}
> .
>
> I have used RankLib-2.1-patched.jar to generate the model and converted the
> generated xml to json.
>
>
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>

RE: solr ltr jar is not able to recognize MultipleAdditiveTreesModel

Posted by Brian Yee <by...@wayfair.com>.
I'm not sure if this will solve your problem, but you are using a very old version of Ranklib. The most recent version is 2.9.
https://sourceforge.net/projects/lemur/files/lemur/RankLib-2.9/


-----Original Message-----
From: kusha.pande [mailto:kusha.pande@gmail.com] 
Sent: Thursday, February 15, 2018 8:12 AM
To: solr-user@lucene.apache.org
Subject: solr ltr jar is not able to recognize MultipleAdditiveTreesModel

Hi I am trying to upload a training model generated from ranklib jar using lamdamart mart.

The model is like
{"class":"org.apache.solr.ltr.model.MultipleAdditiveTreesModel",
    "name":"lambdamartmodel",
"params" : {
"trees" :[
   {
      "id": "1",
      "weight": "0.1",
      "split": {
         "feature": "8",
         "threshold": "7.111333",
         "split": [
            {
               "pos": "left",
               "feature": "8",
               "threshold": "5.223557",
               "split": [
                  {
                     "pos": "left",
                     "feature": "8",
                     "threshold": "3.2083516",
                     "split": [
                        {
                           "pos": "left",
                           "feature": "1",
                           "threshold": "100.0",
                           "split": [
                              {
                                 "pos": "left",
                                 "feature": "8",
                                 "threshold": "2.2626402",
                                 "split": [
                                    {
                                       "pos": "left",
                                       "feature": "8",
                                       "threshold": "2.2594802",
                                       "split": [
                                          {
                                             "pos": "left",
                                             "output": "-1.6371088"
                                          },
                                          {
                                             "pos": "right",
                                             "output": "-2.0"
                                          }
                                       ]
                                    },
                                    {
                                       "pos": "right",
                                       "feature": "8",
                                       "threshold": "2.4438097",
                                       "split": [
                                          {
                                             "pos": "left",
                                             "feature": "2",
                                             "threshold": "0.05",
                                             "split": [
                                                {
                                                   "pos": "left",
                                                   "output": "2.0"
                                                }, ......


getting an exception as :
Exception: Status: 400 Bad Request
Response: {
  "responseHeader":{
    "status":400,
    "QTime":43},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","java.lang.RuntimeException"],
    "msg":"org.apache.solr.ltr.model.ModelException: Model type does not
exist org.apache.solr.ltr.model.MultipleAdditiveTreesModel",
    "code":400}}
.

I have used RankLib-2.1-patched.jar to generate the model and converted the
generated xml to json.





--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html