1
$\begingroup$

In my project, I am facing a multi-class classification problem.
As a first research/modeling step, I used a clustering algorithm with 3 clusters.
Motivation behind this step, was to understand potential patterns in the feature space. And their relation to the class variable(y).
Clustering results showed, there is an equal distribution of the 3 target classes values in each of the clusters.
My question is: do the 'similar' distribution of target variable on the 3 clusters suggest that classification task would be difficult based on existing features?
When clustering with more than 3 clusters I got similar results.

My dataset has 150 features and ok 20 000 instances.

$\endgroup$
1
  • $\begingroup$ Why would you do clustering before classification? And why do you suppose that poor results on clustering would imply poor results on classification? The two have different aims. $\endgroup$
    – Peter Flom
    Jan 20 '20 at 12:22
2
$\begingroup$

No, similar distribution of Y's does not entail poor classification results.

See this for example, two features X1, X2 and binary response variable(colored green and red).
Clustering results are apparent and a simple heuristic based classifier would work fine.

enter image description here

##Generate cluster based data
cl_size = 100
c1 = [(x, y) for x, y in zip(list(np.random.uniform(low=6, high=10, size=cl_size)),
                         list(np.random.uniform(low=0, high=4, size=cl_size)))]
c2 = [(x, y) for x, y in zip(list(np.random.uniform(low=6, high=10, size=cl_size)),
                         list(np.random.uniform(low=6, high=10, size=cl_size)))]
c3 = [(x, y) for x, y in zip(list(np.random.uniform(low=0, high=4, size=cl_size)),
                         list(np.random.uniform(low=0, high=4, size=cl_size)))]
c4 = [(x, y) for x, y in zip(list(np.random.uniform(low=0, high=4, size=cl_size)),
                         list(np.random.uniform(low=6, high=10, size=cl_size)))]
df = pd.concat([pd.DataFrame(c, columns=['x1', 'x2']) for c in [c1, c2, c3, c4]])
##Classify
df['y'] = [1 if x > 2 and x < 8 else 0 for x in df['x2']]
##Plot
cax = df[df['y'] > 0].plot(x='x1', y='x2', color='green', kind='scatter')
_ = df[df['y'] < 1].plot(x='x1', y='x2', color='red', ax=cax, kind='scatter')
_ = cax.set_facecolor('k')
$\endgroup$
1
  • $\begingroup$ Thank you, your explanation is really good :) $\endgroup$ Jan 20 '20 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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