How to calculate gauss value

I want to know how this gauss value is calculated.

POST sneaker/_search
{
  "query": {
    "function_score": {
      "functions": [
        {
          "gauss": {
            "price": {
              "origin": "300",
              "scale": "200"
            }
          }
        }
      ]
    }
  }
  , "explain": true
}

query result

 "_explanation" : {
          "value" : 1.0,
          "description" : "function score, product of:",
          "details" : [
            {
              "value" : 1.0,
              "description" : "*:*",
              "details" : [ ]
            },
            {
              "value" : 1.0,
              "description" : "min of:",
              "details" : [
                {
                  "value" : 1.0,
                  "description" : "Function for field price:",
                  "details" : [
                    {
                      "value" : 1.0,
                     "description" : "exp(-0.5*pow(MIN[Math.max(Math.abs(300.0(=doc value) -300.0(=origin))) - 0.0(=offset), 0)],2.0)/28853.900817779268)",

"details" : [ ]
                    }
                  ]
                },
              

Referring to this Function score query doc

where sigma is computed to assure that the score takes the value decay at distance scale from origin +- offset

sigma calc

I want to know how this standard deviation value is calculated.

"value" : 1.0,
"description" : "exp(-0.5*pow(MIN[Math.max(Math.abs(300.0(=doc value) -300.0(=origin))) - 0.0(=offset), 0)],2.0)/28853.900817779268)",

How this 28853.900817779268 value is calculated

Hi, this is the direct application of the formula for sigma-square:
decay is 0.5 (by default)
your scale is 200
so sigma-square is - (400^2) / ( 2 * ln (0.5) )

It is solved in this

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.