import * as tf from '@tensorflow/tfjs-node' ; /**
   The cosine similarity between two vectors
*/ export function cosineSimilarity ( a , b ) { let similarity = a . dot ( b . reshape ( [ - 1 ] ) ) . div ( ( tf . norm ( a , "euclidean" , 1 ) . mul ( tf . norm ( b , "euclidean" , 1 ) ) ) ) ; return similarity ; } /**
   The euclidean distance between two vectors
*/ export function euclideandistance ( a , b ) { let similarity = tf . norm ( a . sub ( b ) , "euclidean" , 1 ) ; return similarity ; }