Compares the Paths created by munin.provider.genre.GenreTreeProvider.
>>> dfunc = GenreTreeDistance(genre_tree_provider)
>>> dfunc.compare_single_path((190, 1, 0), (190, 1, 1))
0.333
>>> dfunc.compare_single_path((190, 0, 1), (190, 1, 1))
0.666
>>> dfunc(
... [(190, 1, 0), (190, 1, 1)],
... [(190, 1, 1), (190, 0, 1)]
... )
0.333 # Take the lowest possible distance. (Complete Link)
Like munin.distance.genre.GenreTreeDistance, but use Average Linkage instead of Single Linkage.
This is recommended if you have long genre descriptions, like produced by munin.provider.genre.DiscogsGenreProvider.
This class is supposed to be overriden, but can also be used as fallback.
__call__ is implemented as shortcut to compute()
Parameters: | name (String.) – Name of the DistanceFunction (used for display) |
---|
DistanceFunction Calculator for comparing two lists of GenrePaths.
(Lists of GenrePaths as returned by the GenreTree Provider)
This class is supposed to be overriden, but can also be used as fallback.
__call__ is implemented as shortcut to compute()
Parameters: | name (String.) – Name of the DistanceFunction (used for display) |
---|