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
Functions are renamed
  • Loading branch information
alexbakharew committed Jun 17, 2021
commit bf47a3aa7708f23ac46e08ba6dc85622d7d7267a
114 changes: 57 additions & 57 deletions 3.9/aql/functions-numeric.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,63 @@ COS(-3.141592653589783) // -1
COS(RADIANS(45)) // 0.7071067811865476
```

DECAY_GAUSS()
------

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

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

- **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

```js
DECAY_GAUSS(41, 40, 5, 5, 0.5) // 1
DECAY_GAUSS([20.0, 41], 40, 5, 5, 0.5) // [0.0019531250000000017, 1.0]
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`

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 arra 8000 y of scores

- **arg** (number, array, range): the input value, array with input values or range
- **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

```js
DECAY_EXP(41, 40, 5, 5, 0.7) // 1
DECAY_EXP(49.9889, 50, 0.001, 0.001, 0.2) // 8.717720806626885e-08
DECAY_EXP(2, 0, 10, 0, 0.2) // 0.7247796636776955
```

DECAY_LINEAR()
------

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

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

- **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

```js
DECAY_LINEAR(41, 40, 5, 5, 0.5) // 1
DECAY_LINEAR(5, 0, 10, 0, 0.2) // 0.6
DECAY_LINEAR(9.8, 0, 10, 0, 0.2) // 0.21599999999999994
```

DEGREES()
---------

Expand Down Expand Up @@ -196,25 +253,6 @@ EXP2(1) // 2
EXP2(0) // 1
```

EXP_DECAY()
------

`EXP_DECAY(arg, 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

- **arg** (number, array, range): the input value, array with input values or range
- **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

```js
EXP_DECAY(41, 40, 5, 5, 0.7) // 1
EXP_DECAY(49.9889, 50, 0.001, 0.001, 0.2) // 8.717720806626885e-08
EXP_DECAY(2, 0, 10, 0, 0.2) // 0.7247796636776955
```

FLOOR()
-------

Expand All @@ -235,44 +273,6 @@ FLOOR(-2.50) // -3
FLOOR(-2.51) // -3
```

GAUSS_DECAY()
------

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

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

- **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

```js
GAUSS_DECAY(41, 40, 5, 5, 0.5) // 1
GAUSS_DECAY([20.0, 41], 40, 5, 5, 0.5) // [0.0019531250000000017, 1.0]
GAUSS_DECAY(49.9889, 49.987, 0.001, 0.001, 0.2) // 0.2715403018822964
```

LINEAR_DECAY()
------

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

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

- **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

```js
LINEAR_DECAY(41, 40, 5, 5, 0.5) // 1
LINEAR_DECAY(5, 0, 10, 0, 0.2) // 0.6
LINEAR_DECAY(9.8, 0, 10, 0, 0.2) // 0.21599999999999994
```

LOG()
-----

Expand Down
8 changes: 4 additions & 4 deletions 3.9/release-notes-new-features39.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ runtime.
Decay Functions
----------------

Added 3 Decay functions to AQL : EXP_DECAY, LINEAR_DECAY and GAUSS_DECAY
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
GAUSS_DECAY(41, 40, 5, 5, 0.5) // 1
LINEAR_DECAY(5, 0, 10, 0, 0.2) // 0.6
EXP_DECAY(2, 0, 10, 0, 0.2) // 0.7247796636776955
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