PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, October 7, 2022

[FIXED] How to calculate gauss value?

 October 07, 2022     elasticsearch, elasticsearch-dsl, statistics     No comments   

Issue

I am just curious to know how this value came i applied formula but i think i am missing something can anybody tell me please.I am running single ELK stack version 7.16

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

Query result

 "max_score" : 1.0,
    "hits" : [
      {
        "_shard" : "[sneaker][0]",
        "_node" : "29ds_f0VSM6_-eDNhdQPLw",
        "_index" : "sneaker",
        "_type" : "_doc",
        "_id" : "6",
        "_score" : 1.0,
        "_source" : {
          "brand" : "flite",
          "price" : 300,
          "rating" : 2,
          "release_date" : "2020-12-21"
        },
        "_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" : [ ]
                    }
                  ]
                },

I look for guassian distribution but it is different from this. I want to know how 28853.900817779268 value came


Solution

If you look on the official documentation for the gauss decay function, you'll find the following formula for computing the sigma:

enter image description here

Using scale = 200 and decay = 0.5 (default value if unspecified), we get the following:

-200^2 / (2 * ln (0.5)) = -28853.90081

which is what you're seeing in the explanation of the query.



Answered By - Val
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing