TradingView
RicardoSantos
30 Oca 2022 11:32

FunctionCosineSimilarity 

Bitcoin / U.S. dollarBitstamp

Açıklama

Library "FunctionCosineSimilarity"
Cosine Similarity method.

function(sample_a, sample_b) Measure the similarity of 2 vectors.
  Parameters:
    sample_a: float array, values.
    sample_b: float array, values.
  Returns: float.

diss(cosim) Dissimilarity helper function.
  Parameters:
    cosim: float, cosine similarity value (0 > 1)
  Returns: float

Sürüm Notları

v2 - added error messages.
Yorumlar
slowcoconut
curious how this compares to correlation. thanks for posting
kakola
if sample_a and sample_b have inequal sizes?
RicardoSantos
@kakola, you get error, ill add the error message in a bit, thank you.
kakola
@RicardoSantos, Thanks. I've been trying to compare two *un-even* datasets for similarity, but I gave up...
RicardoSantos
@kakola, you can always rescale one of them to match the other, plenty of techniques to do that :)
Daha Fazla