0
$\begingroup$

I'm trying to play with the breast cancer data available through UCI: https://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/wdbc.data

When trying to classify the data through Weka using J48 decision tree, I'm noticing that the J48 algorithm is disables maybe because it can't handle continuous attributes. I can use C4.5 or C5.0 through R. Can these implementations of ID3 handle continuous attributes or do i need to do pre-processing to put the attributes in ranges?

I'd appreciate any example that shows classifying continuous attribute data via decision trees.

$\endgroup$
1
$\begingroup$

You need to discretize the continuous variables first. A very common approach is finding the splits which minimize the resulting total entropy (i.e. the sum of entropies of each split).

See for example Improved Use of Continuous Attributes in C4.5, and Supervised and Unsupervised Discretization of Continuous Features. Weka offers the possibility to discretize your data. There are a number of tutorials showing how to do it. Regretfully I am not familiar with Weka, and cannot tell which one is good enough.

$\endgroup$
1
$\begingroup$

J48 is a Weka implementation of C4.5, so it is able to handle numerical continuous variables. Here is not a problem, for sure.

I am thinking that because you mentioned that J48 is not enabled, it means that you use Weka's Explorer GUI. One thing which is not very nice at that interface is that it supposes that the target variable is the last one. This is not so nice.

After taking a look at the description of the dataset fields found here, you can notice that the first field is an identifier and it ceirtalny should be eliminated from the dataset and the target field is the second one.

I suggest you to try to change the csv file having the target field to be the last one. Perhaps it is possible to do that directly in Weka's Explorer, but I do not know how.

The R's implemenations you mentioned does not have this nasty inconvenient, since you have to specify the independent / dependent variables through a formula using field names, and not based on position.

[Later edit]

I did not used Weka since years ago, now I took a look on that again. I use 3.6.11 version. It seems that the things were improved with this problem. So, if you use Weka's Explorer GUI, after you select you data, on the Classify panel, you have the possibility to select the field used as target / dependent variable. This can be done using the combobox placed just upper the start button. After you select the proper target, J48 will be enabled.

$\endgroup$
1
$\begingroup$

It may be an old question now, though the answer is that Weka has an implementation of REPtree, at least now, that handles continuous variables. See https://stackoverflow.com/questions/23042806/reptree-weka-only-sorts-values-for-numeric-attributes-once for a few more details

$\endgroup$
0
$\begingroup$

As @Mark noted, this question is old, but I feel that the answers still are not completely satisfactory. J48 handles continuous independent variables (predictors). Just load up the iris data (delivered with basic installation of WEKA) and you will have no trouble running J48 even though all predictors are continuous. However, J48 does not handle continuous dependent variables, i.e. it does not do regression. @Mark's answer is correct; REPTree handles continuous dependent variables, but I think that it is useful to clarify the distinction between which variables may or may not be continuous.

$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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