I am performing analysis on the well-known 'Adult' data-set, available on UCI using Orange Data Mining. In a PhD thesis, Pelleg (2004; pg 79) uses unsupervised clustering of the prescribed training set, setting the number of clusters to 4, and then uses the resulting clusters to define continuous regions of feature space defined by each cluster. During clustering, the target variable, 'income' (two classes: '>50K', and '<=50K') is initially treated as one of the features. Each cluster region is then ascribed a class, depending on the majority target variable class, i.e., '>50K' or '<=50K'.

To evaluate the 'cluster training', he determines whether each instance in the independent test-set falls into cluster region (e.g., 1 = '>50K', 2 = '<=50K', 3 = '>50K', and 4 = '<=50K', for example). A confusion matrix can then be built from this simple exercise. Pelleg quotes an accuracy of up to 97%.

I tried training with decision tree, random forest, and kNN learners (testing and training on the same data) I ended up with 90% ACC (RF learner). I decided to give Pelleg's concept a shot. Right now, I am not concerned with achieving a high ACC, just with being able to build a training/testing workflow in Orange, effectively using clustering as the learner. I have managed to:

  1. randomly select 3000 instances (data sampler widget) from the training set (k-Means clustering can take a max of 3000 instances)
  2. convert the target variable to a feature variable ('select columns' widget)
  3. use k-Means clustering widget, setting 4 clusters
  4. convert the cluster meta column of the training set to the target variable ('select columns' and 'edit domain' widgets) by setting the majority target class in each cluster to the whole cluster.
  5. Feed in the clustered training set and original test set to the 'test and score' widget, using kNN as the learner.

Steps 4-5 was the only way I could figure to determine if each test instance falls the 'region' of each cluster (i.e., using kNN learner to find the nearest training instance and effectively placing the test instance in that cluster).

In Orange Data Mining, is there a better way to establish/define continuous cluster 'regions' which can be labeled as a target class (perhaps weighting the size of the region by the size of the cluster?)

Can those regions then be used to test and score/evaluate/build a confusion matrix?

Clustering and Training/Testing Workflow

The majority class is ascribed to each cluster

Clustered data in 'Age' vs. 'Education-Number' feature space, with the target classes represented by X/O symbols.

  • $\begingroup$ Do you mean a solution to have clear clusters like this one? orange3.readthedocs.io/projects/orange-visual-programming/en/… $\endgroup$ Oct 20, 2022 at 9:02
  • $\begingroup$ Clear clusters would be great, but I am not expecting that from this data set. My goal is to find a workflow (some combination of widgets) that allows me to effectively use one of the clustering widgets as the learner for training/testing (testing and scoring). You cannot directly plug a clustering algorithm into the Learner input of 'Testing and Scoring' widget. But, I'm convinced there is a way to use the resulting cluster output from clustering the training data set for prediction on the un-clustered test data set, using Orange. $\endgroup$ Oct 21, 2022 at 11:41
  • 1
    $\begingroup$ What if you do a custom widget instead? If you know the functions very well, you can merge them in a single widget to avoid a too complex workflow... orangedatamining.com/blog/2017/02/23/my-first-orange-widget $\endgroup$ Oct 21, 2022 at 20:04

1 Answer 1


I to wanted to use clustering for input of an learner but find out that data was passes to the learner in order like in original dataset. In Orange this isn't possible. Only if you manually read the data from cluster widget and somehow manually "transpose" re-arrange original dataset to cluster data alike to be feed to learner. The other solutions, use some other software package (didn't test), or u code some solutions otherwise. Maybe u try to use Rapid Miner, clusterization is possible to be defined in pre-input to the learner.


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.