You can use the val function, which will just returns the string.

val(CRIME) as expected

Joel Bernstein
http://joelsolr.blogspot.com/


On Mon, Sep 23, 2019 at 10:00 PM Peter Davie <
peter.da...@convergentsolutions.com.au> wrote:

> Hi,
>
> I have trained a number of logistic regression classification models
> (using train()) and I am now trying to evaluate these models.  I want to
> add the model name to the classify() (output) stream.  I am trying to
> use the following select() with setValue() as follows:
>
> select(
>      classify(
>          model(
>              models,
>              id="crime_model",
>              cacheMillis=5000
>          ),
>          search(
>              news_categories,
>              sort="id asc",
>              q="role:test",
>              qt="/export",
>              fl="id,body",
>              rows=50000
>          ),
>          field="body"
>      ),
>      id,
>      score_d,
>      probability_d,
>      setValue("expected","CRIME") as expected
> )
>
> However, I am not seeing the "expected" field in the output stream:
>
> {
>    "result-set": {
>      "docs": [
>        {
>          "probability_d": 0.9807157418649378,
>          "score_d": 1.7570993028820825,
>          "id": "0001b92f-da6e-41a6-8518-a0d083c0f870"
>        },
>        {
>          "probability_d": 0.7310585786300049,
>          "score_d": 0.24253562092781067,
>          "id": "0003b45b-aab9-4635-8f93-903c6f492355"
>        },
>        {
>          "probability_d": 0.7310585786300049,
>          "score_d": 0.2773500978946686,
>          "id": "0008ecb1-3add-4ef5-85e1-736bf37a834b"
>        },
>        etc.
>      ]}
> }
>
> Can anyone point out what am I doing wrong?
>
> Peter
>
>
>

Reply via email to