Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(3)  |  Call(2)  |  Derive(0)  |  Import(1)

        def similarity(a, b):
    scalar = sum(a[k] * b[k] for k in a if k in b)
    norm_a = math.sqrt(sum(v ** 2 for v in a.values()))
    norm_b = math.sqrt(sum(v ** 2 for v in b.values()))
    return scalar / (norm_a * norm_b)
        


src/m/p/mpdc-HEAD/mpdc/libs/lastfmhelper.py   mpdc(Download)
 
from mpdc.initialize import cache
from mpdc.libs.utils import similarity, warning
 
 
        for artist, tags in self.artists_tags.items():
            if tags:
                score = similarity(tags, query)
                if score > LastfmHelper.min_similarity:
                    scores[artist] = score
        for (album, artist), tags in self.albums_tags.items():
            if tags:
                score = similarity(tags, query)
                if score > LastfmHelper.min_similarity:
                    scores[(album, artist)] = score