Lift Ratio 2
Posted by: Fendi
Date: July 15, 2012 10:47PM

I've tried the source code that you explain to me ..
I had to modify the source code by linking your item numbers with a database that contains the name of the item that I have set
but there is one result, where there are two items cosequent and testified that the lift ratio is infinity, why is that ..?

samples that have a value of lift ratio = 0

1 ==> sup = 0.3% 3.6 conf = 0.75 lift = Infinity

instructions please ..

thank you ..


Re: Lift Ratio 2
Date: July 16, 2012 10:15AM

Hi Fendi,

As you know, lift (x -->y) = sup(x U y) / (sup(x)*sup(y))

The reason why it shows "infinity" is that sup(x) or sup(y) is equal to 0. In Java, if you divide something like this 5 / (0 * 6) the results will be infinity.

I'm not sure if it is a bug in your case or if it is because of the data.

I think that maybe i made a mistake when i wrote the instructions on the website to modify the code for the lift. To make sure that this is not the problem, you could try to download the latest version of SPMF from the webpage and replace the file: AlgoAgrawalFaster94_FPGrowth_version_saveToFile or AlgoAgrawalFaster94_FPGrowth_version, and the class AlgoFPGrowth in the package ca.pfv.spmf.frequentpatterns.fpgrowth with the new version.

Maybe it will fix the problem.

Otherwise, you could check the data manually and calculate the lift manually for the rule that got "infinity" to see if the problem is because of the data. But i don't think so.

Finally, if if does not fix the problem, please send me some code or data to my e-mail so that i can reproduce the problem on my computer and find a solution.



Edited 1 time(s). Last edit at 07/16/2012 10:16AM by webmasterphilfv.

Re: Lift Ratio 2
Posted by: Fendi
Date: July 17, 2012 03:37AM

I want to send my file to you ..

can I ask for your e-mail address?

Re: Lift Ratio 2
Date: July 17, 2012 05:33AM

Here it is:

philippe.fv AT gmail DOT com


Re: Lift Ratio 2
Posted by: Fendi
Date: July 19, 2012 03:49AM

because the file is too big, I upload in mediafire

this address

on this project, I have made modifications to the software by taking the fp-growth algorithm as the core process, now I'm confused how to implement the lift measure and how to combine the fp-growth frequent itemsets and association rules fp-growth in one application. I hope you can help me to combine the two processes.

Thank you very much

Re: Lift Ratio 2
Posted by: Fendi
Date: July 19, 2012 09:38AM

please help me..

I want to ask again, is the result of the support and confidence in association rule algorithms fpgrowth, the decimal value is rounded to 2 decimal places

example 0.138793526238352 to be 0.14

thank you.


Re: Lift Ratio 2
Date: July 19, 2012 05:31PM

Hi Fendi,

I will explain to you how to print only two decimals with FPGrowth. I will explain for the FPGrowth version that saves to file.

But it would be the same thing for any algorithms.

For FPGrowth that saves to file, you can open the file "AlgoAgrawalFaster94_FPGrowth_version_saveToFile" in the package "ca.pfv.spmf.associationrules.agrawal_FPGrowth_version_saveToFile"

In this file, there is a method named "saveToFile(RuleAgrawal rule)" that is used for writing a rule to the file.

If we want to change the format to two decimals, we need to modify this.

So we need to add this:

DecimalFormat df = new DecimalFormat("#.##"winking smiley;

and if you want the confidence with two decimals, you can replace this:


with this:


You do the same thing for the lift and support.

By the way, to use DecimalFormat, you need to add this to your class

import java.text.DecimalFormat;

Hope this helps!


Re: Lift Ratio 2
Posted by: Fendi
Date: July 20, 2012 10:37PM

Thank you verymuch Philippe

it's work with well.. smiling smiley

Re: Lift Ratio 2
Date: July 21, 2012 03:36AM

Great ;-) you are welcome!

Re: Lift Ratio 2
Posted by: Fendi
Date: July 22, 2012 05:22AM

I'm sorry to ask again ..
because I wanted to learn ..
whether the input value and minconf minsupport fp-growth algorithm in association rule can be inputted in the value of percent?

example 0.1 to be10%

in this case, I apply the class of fp-growth association rule save to file

thanks for the help ..

best regards

Re: Lift Ratio 2
Date: July 22, 2012 05:49AM

Hi Fendi,

If the 10 % is an integer:

		int value = 10;
		double minsup = ((double)value) / 100d;

If the 10 % is a string:

String value = "10%";
		value = value.substring(0, value.length()-1);
		double minsup = Double.parseDouble(value) / 100d;



Edited 3 time(s). Last edit at 07/28/2012 05:40AM by webmasterphilfv.

Re: Lift Ratio 2
Date: July 28, 2012 05:41AM

I made a mistake in my previous message.

It should be

value = value.substring(0, value.length()-1);

instead of

"value = value.substring(0, value.length()-2);


This forum is powered by Phorum and provided by P. Fournier-Viger (© 2012).
Terms of use.