0
votes

I am trying to find a clustering algorithm to cluster nominal data with python. For that purpose I tried DBSCAN algorithm with RapidMiner and it worked with nominal data. But when I try same dataset with DBSCAN algorithm which is provided by scikit-learn it gave error that says function could not convert string to float.

Are DBSCANs in rapidminer and scikit-learn different and how can I solve that problem? Also if you tell me another clustering algorithm that works with nominal data it would be great?

2
You need to encode your data into some numerical data types when using scikit learn, this then depends on your interpretation of the string values. Are the values labels, do you need to extract a feature from the strings e.g. length, tf-idf etc. Look at LabelEncoder and preprocessing in general - EdChum

2 Answers

2
votes

SciPy defaults to Euclidean distance (metric='euclidean'), which is not defined for nominal data.

You need to specify your distance measure!

1
votes

RapidMiner implements various distance measures including Nominal Distance. This is used by DBSCAN and other algorithms.

The distance between two examples is zero if the values of the attributes are identical and 1 otherwise. In other words "Raspberry" is a distance of 1 away from "Apple" and from "Computer". In addition "Apple" is one away from "Raspberry" and "Computer" and so on.