regorxxx / Search-by-Distance-SMP

An implementation of Music-Graph for foobar2000, using Spider Monkey, which creates intelligent "spotify-like" playlist using high-level data from tracks and computing their similarity using genres/styles.
https://regorxxx.github.io/foobar2000-SMP.github.io/scripts/search-by-distance-smp/
GNU Affero General Public License v3.0
35 stars 7 forks source link

Different results with custom tag slot #25

Closed username116 closed 10 months ago

username116 commented 10 months ago

Hi,

Maybe it's not a bug, it's something I don't understand.

Describe the bug

If I "move" the GENRE tag to a custom tag slot, the results are different. By move I mean: duplicate the tag and set the first one to 0. I sort results by score (not random). Shouldn't playlists be the same? Is the calculation of custom tag slots different?

To Reproduce

  1. Load buttons_toolbar.js, then insert a search-by-distance customizable button with the menu.
  2. Wait for cache calculation in console, and rename button.
  3. Uncheck option Set pool picking > Random picking (not sorted by score)
  4. Uncheck option Set final sorting > Smart Shuffle by Artist
  5. Choose a reference track, click on the button to launch a search with this first configuration (first screenshot)
  6. Set Tags and weighting > Genre > Set Weight to 0
  7. Set Tags and weighting > Genre > Remap... to []. Reset link cache now? No
  8. Set Tags and weighting > New tag.... Enter a name for the tag: Genre 2. Is multi-valued? Yes. Is a genre/style-like tag? Yes
  9. Set Tags and weighting > Genre 2 > Remap... to ["GENRE"]. Reset link cache now? No
  10. Set Tags and weighting > Genre 2 > Set Weight to 15
  11. With the same reference track, click on the button to launch a search with this second configuration (second screenshot). This playlist is different from the first.

Expected behavior I don't understand why the playlists are different.

Screenshots

Playlist with 1st configuration (default)

![1](https://github.com/regorxxx/Search-by-Distance-SMP/assets/108369600/3e44d838-cad7-4f28-b432-6bdc6599aea2)

Playlist with 2nd configuration

![2](https://github.com/regorxxx/Search-by-Distance-SMP/assets/108369600/2a0fd113-fab7-4e84-8e4d-f4c8c6987fbe)

Desktop

Additional context

1st configuration (default) : tags used for scoring (from panel properties)

```javascript { "genre": { "weight": 15, "tf": ["GENRE"], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["string", "multiple", "graph"] }, "style": { "weight": 15, "tf": ["STYLE"], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["string", "multiple", "graph"] }, "dynGenre": { "weight": 15, "tf": [], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["number", "single", "virtual", "absRange"], "range": 1 }, "mood": { "weight": 10, "tf": ["MOOD"], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["string", "multiple", "combinations"], "combs": 6 }, "key": { "weight": 5, "tf": ["KEY"], "baseScore": 0, "scoringDistribution": "LOGARITHMIC", "type": ["string", "single", "keyMix", "keyRange"], "range": 3 }, "bpm": { "weight": 5, "tf": ["BPM"], "baseScore": 0, "scoringDistribution": "NORMAL", "type": ["number", "single", "percentRange"], "range": 50 }, "date": { "weight": 10, "tf": ["$year(%DATE%)"], "baseScore": 0, "scoringDistribution": "NORMAL", "type": ["number", "single", "absRange"], "range": 30 }, "composer": { "weight": 0, "tf": ["COMPOSER"], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["string", "multiple"] }, "artistRegion": { "weight": 5, "tf": ["LOCALE LAST.FM"], "baseScore": 0, "scoringDistribution": "LOGISTIC", "type": ["string", "single", "virtual", "absRange", "tfRemap"], "range": 5 }, "genreStyleRegion": { "weight": 7, "tf": [], "baseScore": 0, "scoringDistribution": "LOGISTIC", "type": ["string", "single", "virtual", "absRange"], "range": 5 }, "related": { "weight": 25, "tf": ["RELATED"], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["string", "multiple", "virtual", "tfRemap", "bNegative"] }, "unrelated": { "weight": -25, "tf": ["UNRELATED"], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["string", "multiple", "virtual", "tfRemap", "bNegative"] } } ```

2nd configuration

```javascript { "genre": { "weight": 0, "tf": [], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["string", "multiple", "graph"] }, "style": { "weight": 15, "tf": ["STYLE"], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["string", "multiple", "graph"] }, "dynGenre": { "weight": 15, "tf": [], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["number", "single", "virtual", "absRange"], "range": 1 }, "mood": { "weight": 10, "tf": ["MOOD"], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["string", "multiple", "combinations"], "combs": 6 }, "key": { "weight": 5, "tf": ["KEY"], "baseScore": 0, "scoringDistribution": "LOGARITHMIC", "type": ["string", "single", "keyMix", "keyRange"], "range": 3 }, "bpm": { "weight": 5, "tf": ["BPM"], "baseScore": 0, "scoringDistribution": "NORMAL", "type": ["number", "single", "percentRange"], "range": 50 }, "date": { "weight": 10, "tf": ["$year(%DATE%)"], "baseScore": 0, "scoringDistribution": "NORMAL", "type": ["number", "single", "absRange"], "range": 30 }, "composer": { "weight": 0, "tf": ["COMPOSER"], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["string", "multiple"] }, "artistRegion": { "weight": 5, "tf": ["LOCALE LAST.FM"], "baseScore": 0, "scoringDistribution": "LOGISTIC", "type": ["string", "single", "virtual", "absRange", "tfRemap"], "range": 5 }, "genreStyleRegion": { "weight": 7, "tf": [], "baseScore": 0, "scoringDistribution": "LOGISTIC", "type": ["string", "single", "virtual", "absRange"], "range": 5 }, "related": { "weight": 25, "tf": ["RELATED"], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["string", "multiple", "virtual", "tfRemap", "bNegative"] }, "unrelated": { "weight": -25, "tf": ["UNRELATED"], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["string", "multiple", "virtual", "tfRemap", "bNegative"] }, "Genre 2": { "weight": 15, "tf": ["GENRE"], "baseScore": 0, "scoringDistribution": "LINEAR", "type": ["multiple", "string", "graph"] } } ```

I've tried doing Reset link cache and restarting foobar with both configurations, it doesn't change the playlists. I saw this several weeks ago, before the cache structure change. It's not a recent change.

regorxxx commented 10 months ago

It only happens because you removed the TF "genre" on first tag, which should never be removed. Just set weight to zero, you will see they match.

Now, why removing the TF changes the score... need to take a look at that.

regorxxx commented 10 months ago

Fixed now.

username116 commented 10 months ago

That's right, I tried again, simply setting the weight of the 1st tag to 0 and leaving the TF ["GENRE"], as you said. This time the second playlist is identical to the first. The scores and screenshots are identical. I'll be careful about that now.

Then I tried with the new update. The playlists are identical between them again, but this time they look very much like the second result of my first message (at least the first tracks). The scores have changed slightly and the pool is larger.

Thanks for the explanation. Thanks for checking it out.

regorxxx commented 10 months ago

It's supposed to now be equivalent if you remove the TF or not, or if "GENRE" is in the default slot or a custom slot. All cases should now give the same results. (you were not supposed to remove the old TF to add a new tag, but anyway that was a bug since removing it should not affect other things)

Also, ¿could you check the reference track outputs a 100 score? If you take a look at your console, the reference track is always at the output too (at least without touching other things), and the score is obviously 100. If that's right (in all cases), then it has all been fixed now.

username116 commented 10 months ago

Oh, okay, that's good. Yes, I had identical results with this reference track as I said in my previous message. I tried to remove the TF "GENRE" from the default slot again. The playlist looks a little different, but I think that's only because the tracks that have an equal score are in a different order.

On my first screenshot, my reference track had a score of 95.5. I had seen that and was wondering. Now I have a score of 100 every time. I've tried a few other tracks, they're at 100 too, with the default configuration and the one with the custom tag.

username116 commented 10 months ago

could you check the reference track outputs a 100 score?

I found a reference track that doesn't give a score of 100. I just did steps 1 to 5 as in the first message, otherwise it's the default configuration with Search-by-Distance https://github.com/regorxxx/Search-by-Distance-SMP/commit/44e41cd4c00b526b75bfa958aa89d19e45051095.

Screenshot

My reference track is "Mantra". ![1](https://github.com/regorxxx/Search-by-Distance-SMP/assets/108369600/6d7269e8-35a7-466c-8b2e-262b0d8ed6dc)

The track metadata are here.


Something else that has nothing to do with it: I think I saw a typo on your profile, on the link All my Foobar2000 SPM scripts can be found here. SPM? SMP?

regorxxx commented 9 months ago

Fixed both things. https://github.com/regorxxx/Search-by-Distance-SMP/issues/26