8000 added info about new decay functions by alexbakharew · Pull Request #718 · arangodb/docs · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.

added info about new decay functions #718

Merged
merged 6 commits into from
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Partial review
  • Loading branch information
Simran-B committed Jun 24, 2021
commit 0d9e0adb1db578c3102e3530a9639bc5341f6aa8
41 changes: 25 additions & 16 deletions 3.9/aql/functions-numeric.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,20 @@ COS(RADIANS(45)) // 0.7071067811865476
```

DECAY_GAUSS()
------
-------------

`DECAY_GAUSS(arg, origin, scale, offset, decay) → num, array`
`DECAY_GAUSS(value, origin, scale, offset, decay) → score`

Score a document or an array of documents with an gaussian function that decays depending on the distance of a numeric field value of the document from a user given origin. Return score or an array of scores
Score a document or an array of documents with an gaussian function that
decays depending on the distance of a numeric field value of the document
from a user given origin.

- **arg** (number, array): the input value or array with input values
- **origin** (number): The point of origin used for calculating distance
- **scale** (number): Defines the distance from origin + offset at which the computed score will equal decay parameter.
- **offset** (number): decay function will be computed for documents with a distance greater than the defined offset
- **decay** (number): The decay parameter defines how documents are scored at the distance given at scale
- **value** (number\|array): the input value or an array with input values
- **origin** (number): the point of origin used for calculating distance
- **scale** (number): defines the distance from origin + offset at which the computed score will equal decay parameter
- **offset** (number): the decay function will be computed for documents with a distance greater than the defined offset
- **decay** (number): the decay parameter defines how documents are scored at the distance given at scale
- returns **score** (number\|array): a single score or an array of scores depending on the type of `value`

```js
DECAY_GAUSS(41, 40, 5, 5, 0.5) // 1
Expand All @@ -168,17 +171,20 @@ DECAY_GAUSS(49.9889, 49.987, 0.001, 0.001, 0.2) // 0.2715403018822964
```

DECAY_EXP()
------
-----------

`DECAY_EXP(arg, origin, scale, offset, decay) → num, array`
`DECAY_EXP(value, origin, scale, offset, decay) → num, array`

Score a document or an array of documents with an exponential function that decays depending on the distance of a numeric field value of the document from a user given origin. Return score or an array of scores
Score a document or an array of documents with an exponential function that
decays depending on the distance of a numeric field value of the document from
a user given origin.

- **arg** (number, array, range): the input value, array with input values or range
- **value** (number, array, range): the input value or an array with input values (can also be a [range](operators.html#range-operator))
- **origin** (number): The point of origin used for calculating distance
- **scale** (number): Defines the distance from origin + offset at which the computed score will equal decay parameter.
- **offset** (number): decay function will be computed for documents with a distance greater than the defined offset
- **decay** (number): The decay parameter defines how documents are scored at the distance given at scale
- returns **score** (number\|array): a single score or an array of scores depending on the type of `value`

```js
DECAY_EXP(41, 40, 5, 5, 0.7) // 1
Expand All @@ -187,17 +193,20 @@ DECAY_EXP(2, 0, 10, 0, 0.2) // 0.7247796636776955
```

DECAY_LINEAR()
------
--------------

`DECAY_LINEAR(arg, origin, scale, offset, decay) → num, array`
`DECAY_LINEAR(value, origin, scale, offset, decay) → score`

Score a document or an array of documents with a linear function that decays depending on the distance of a numeric field value of the document from a user given origin. Return score or an array of scores
Score a document or an array of documents with a linear function that decays
depending on the distance of a numeric field value of the document from a user
given origin.

- **arg** (number, array): the input value or array with input values
- **value** (number, array): the input value or an array with input values
- **origin** (number): The point of origin used for calculating distance
- **scale** (number): Defines the distance from origin + offset at which the computed score will equal decay parameter.
- **offset** (number): decay function will be computed for documents with a distance greater than the defined offset
- **decay** (number): The decay parameter defines how documents are scored at the distance given at scale
- returns **score** (number\|array): a single score or an array of scores depending on the type of `value`

```js
DECAY_LINEAR(41, 40, 5, 5, 0.5) // 1
Expand Down
33 changes: 20 additions & 13 deletions 3.9/release-notes-new-features39.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,26 @@ The following list shows in detail which features have been added or improved in
ArangoDB 3.9. ArangoDB 3.9 also contains several bug fixes that are not listed
here.

AQL
---

### Decay Functions

Added three decay functions to AQL:

- [DECAY_EXP()](aql/functions-numeric.html#decay_exp)
- [DECAY_LINEAR()](aql/functions-numeric.html#decay_linear)
- [DECAY_GAUSS()](aql/functions-numeric.html#decay_gauss)

Decay functions score a document with a function that decays depending on the
distance of a numeric field value of the document from a user given origin.

```js
DECAY_GAUSS(41, 40, 5, 5, 0.5) // 1
DECAY_LINEAR(5, 0, 10, 0, 0.2) // 0.6
DECAY_EXP(2, 0, 10, 0, 0.2) // 0.7247796636776955
```

UI
--

Expand Down Expand Up @@ -54,16 +74,3 @@ architecture to the Sandy Bridge architecture. 256-bit AVX instructions are
now expected to be present on all targets that run ArangoDB 3.9 executables.
If a target does not support AVX instructions, it may fail with SIGILL at
runtime.

Decay Functions
----------------

Added 3 Decay functions to AQL : DECAY_EXP, DECAY_LINEAR and DECAY_GAUSS

Decay functions score a document with a function that decays depending on the distance of a numeric field value of the document from a user given origin.

```js
DECAY_GAUSS(41, 40, 5, 5, 0.5) // 1
DECAY_LINEAR(5, 0, 10, 0, 0.2) // 0.6
DECAY_EXP(2, 0, 10, 0, 0.2) // 0.7247796636776955
```
0