master
Vladimir Mandic 2020-11-23 08:44:23 -05:00
parent 6a8806585c
commit 333457d935
1 changed files with 3 additions and 1 deletions

@ -38,10 +38,12 @@ They can be stored as normal arrays and reused as needed
Simmilarity function is based on *Eucilidean distance* between all points in vector
*Eucliean distance is limited case of Minkowski distance with order of 2*
*[Minkowski distance](https://en.wikipedia.org/wiki/Minkowski_distance) is a nth root of sum of nth powers of distances between each point in (each value in 192-member array)*
*[Minkowski distance](https://en.wikipedia.org/wiki/Minkowski_distance) is a nth root of sum of nth powers of distances between each point (each value in 192-member array)*
Changing `order` can make simmilarity matching more or less sensitive:
```js
const distance = ((firstEmbedding.map((val, i) => (val - secondEmbedding[i])).reduce((dist, diff) => dist + (diff ** order), 0) ** (1 / order)));
```
*Once embedding values are calculated and stored, if you want to use stored embedding values without requiring `Human` library you can use above formula to calculate simmilarity on the fly.*