mlxtend icon indicating copy to clipboard operation
mlxtend copied to clipboard

Leverage returns values greater than 1

Open adgrig opened this issue 3 years ago • 4 comments

While running the apriori algo for a project, Leverage returned (some) values > 1; I'm not doing anything exotic with the library and am working from a rather standard sparse matrix. Shouldn't Leverage take values within [-1,1]?

Happy to provide more context if needed.

adgrig avatar Jan 25 '22 07:01 adgrig

Oh yeah, a leverage larger than 1 would we weird, I think, because it is computed as

support(A->C) - support(A)*support(C)

and support(A->C) can't be greater than 1.

(code: https://github.com/rasbt/mlxtend/blob/5a14e3781ea0b0318a303040a03b0c66c438fbbe/mlxtend/frequent_patterns/association_rules.py#L110)

If you have an example that can reproduce this, or maybe the support columns of the dataset in that row, that'd be useful for looking into this further

rasbt avatar Jan 25 '22 12:01 rasbt

Haha, thought as much. What struck me as weird was that even if my dataset were corrupted somehow, this still shouldn't be able to return values greater than 1 considering its formula.

I'll ask if I can share the data with you (or a part of it/ or columns with labels obscured etc) and get back.

-- Edit: I can share some sample data privately with you. Let me know how to proceed here :).

adgrig avatar Jan 25 '22 12:01 adgrig

@adgrig can you share data on this. I can work to fix this. If the data can't be publicly shares, please private message me.

zuari1993 avatar Nov 12 '22 04:11 zuari1993

Hi, I unfortunately no longer have access to that dataset.

adgrig avatar Nov 14 '22 07:11 adgrig