1
$\begingroup$

I have a CSV file where all comlumns contains numerical values except for the quality column which contains nominal values. I want to use FP Growth Weka algorithm on the dataset. For that I need to binarize my data. In Weka I choose in the Preprocess tab: Choose->Unsupervised->attribute->NumericToBinary with attributeIndices covering all columns except for the last on (which has nominal values).

After the operation when I select the attribute in Weka's preprocess window I see that each variable indeed was converted to 0 or 1 label but 0 has 0 records count while 1 has all the records:

enter image description here

When I binarize the quality variable which has nominal values:

Preprocess->Choose->unsupervised->NominalToBinary (with attributeIndex only for the quality column) nothing happens at all.

As a result I can't use FP Growth of course. How should I binarize the data correctly to be able to use FP Growth?

These are some example rows of my data:

enter image description here

The original dataset can be found here.


EDIT 1: I guess because the numeric values greater than 0 but less than 1 Weka uses floor function when binarizing data that's why all values appear under 1. So I discretized the numeric attributes and then binarized them using NominalToBinary filter. In addition I changed my dataset from having 3 possible values for quality to only have 0 or 1 values possible (manually binarized it). Still the FP Growth is not available in Weka. This is an excerpt from .arff output after binarization.


EDIT 2: I managed to get FP Growth become active by selecting NumericToBinary filter with ignoreClass=True, and selecting class: None next to Visualize All button. However I still have all attributes have all values under 1 label. I tried manually converting all decimal values to integers (because I thought in this cases Weka will not be using floor function on decimal values) but this didn't help at all.

$\endgroup$

2 Answers 2

1
$\begingroup$

I figured out the answer finally and wrote the solution here.

In essence, I had to manually convert binarized attributes type from numeric to binarized and reduce support and confidence settings.

$\endgroup$
1
$\begingroup$

There are two major data-mining issues underlying this question.*

The first data-mining issue is matching the tools you use to the data and the goals of your project. Almost all the predictors in your linked dataset are continuous variables. In general, it's not a good idea to bin continuous predictors, as this page discusses in detail.

Yes, association-rule-mining tools like FP-Growth do require binarized predictors. But if your data are continuous variables then you will be better off using other approaches to identify relationships and subclasses among the predictors and the observations. Other approaches would exploit rather than discard the information provided by continuous variables. James et al describe several supervised and unsupervised approaches to such statistical learning.**

The second data-mining issue is how to binarize data in cases when it might be appropriate. For example, if most of a set of columns in market-basket data were already binary (items bought/not bought) but there were a few for each transaction that were continuous (like profit per transaction), then it could be appropriate to map the non-binary data to binary representations, as noted on page 8 of the arules package vignette .

You should not, however, depend on automated processes to do that continuous-to-binary conversion in any useful way. As the arules vignette continues:

First, a domain expert has to create useful categories for all metric attributes.

It is best to use your (or a colleague's) expertise in the subject matter to perform this task. If a predictor is so novel that there is no prior expertise available, look at its distribution among observations to see if there are obvious breakpoints.

Breaking a continuous predictor first into multiple categories that then are represented by dummy binary predictors discards less information than simply breaking it arbitrarily into 2 categories. For example, arules provides "equal interval length, equal frequency, clustering-based and custom interval discretization." I suspect that Weka provides similar pre-processing facilities.* You should ideally examine several different discretization schemes to ensure that your results don't depend strongly on any particular data pre-processing choices.

With today's easy access to powerful data-mining tools, it's easy to hope that you can just put a new data set into the input and have useful results come out the other end. That false hope can easily lead you astray. Close familiarity with the data and with the questions you are trying to answer is the most reliable way to get useful results via choosing appropriate tools and pre-processing data usefully into forms that those tools need.


*The Weka-specific aspects of this question are off-topic on this site. See this page for a link to Weka-specific help.

**If your interest is in learning how to use FP-growth rather than in these data per se, you should consider another dataset like the 1984 US Congressional voting records also available from UCI. Those data are already effectively binary; I have seen them used in explanations of association-rule mining.

$\endgroup$
2
  • $\begingroup$ Your answer is great in terms of providing extra knowledge on binarization in general. However it doesn't provide the answer to my question. Also the link you provided for Weka-specific help doesn't say Weka questions are off-topic. In fact there're more than 600 questions on Weka on this site. $\endgroup$
    – Yos
    Commented May 24, 2019 at 15:16
  • $\begingroup$ that being said, I'll gladly accept your answer if you add the link to the answer (I provided in my answer and say that is the answer to the question and then provide your answer below). $\endgroup$
    – Yos
    Commented May 24, 2019 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.