Fuse: Total of weights cannot exceed 1

Created on 10 Mar 2020  路  4Comments  路  Source: krisk/Fuse

Hi,
In your new version there is a breaking change. The total weight can max 1

if (weightsTotal > 1) { throw new Error('Total of weights cannot exceed 1') }
it is ok but how can i handle this limitation.

My intention is:
from {name: 'zip', weight: 0.5}, {name: 'city', weight: 0.4}, {name: 'street', weight: 0.3}, {name: 'land', weight: 0.02} {name: 'housenummer', weight: 0.1}, to {name: 'zip', weight: 0.05}, {name: 'city', weight: 0.04}, {name: 'street', weight: 0.03}, {name: 'land', weight: 0.02} {name: 'housenummer', weight: 0.01},

discussion

Most helpful comment

I would agree, it would be great if the library could handle it. Seeing as the error was not thrown before, this is sort of a breaking change, that maybe one that should not be introduced in a minor version bump?

All 4 comments

Same problem here. After updating to 3.6.0 fuse throws the mentioned error from above.

By design, the total weights should not exceed 1, as it throws off the new scoring calculation. Could you not change the weights to accommodate this restriction?

Alternatively, I could normalize the weights so that they are between (0, 1)

I think it would be fine if you could normalize the weights.

I would agree, it would be great if the library could handle it. Seeing as the error was not thrown before, this is sort of a breaking change, that maybe one that should not be introduced in a minor version bump?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

x1unix picture x1unix  路  3Comments

mirzazulfan picture mirzazulfan  路  5Comments

ibraheemdev picture ibraheemdev  路  3Comments

cathy810218 picture cathy810218  路  4Comments

fsskeach picture fsskeach  路  3Comments