0
$\begingroup$

I want to use cluster numbers from soft clustering algorithm output as a some sort of categorical feature (or features), add them to other features for further training in another model (Y's from soft clustering model as additional X-es for dataset). Because of soft clustering, for different rows we have sets of clusters with different length.

for example:

row1: {1, 2, 3}
row2: {2, 3}
row2: {50, 100, 110, 120, 121, 122, 123, 220}

etc.

The total number of different clusters and the number of clusters for one record are quite large, so any variation of one-hot encoding will create too many features.

What is the way to encode a set of cluster numbers, unequal in length for each row, to fixed number of features? Is it possible to encode the affinity dependence of different sets of cluster numbers when they intersect? For example: {10, 12, 13} is close to {10, 12, 13, 14}

$\endgroup$

1 Answer 1

0
$\begingroup$

To encode the set of cluster numbers from a soft clustering algorithm output to a fixed number of features, you can use a technique called "binary encoding" or "set encoding." This technique involves creating binary columns for each unique cluster and marking the presence of a cluster with a 1 and the absence with a 0. This way, the varying lengths of the cluster sets can be accommodated without creating an excessive number of features.

Additionally, to encode the affinity dependence of different sets of cluster numbers when they intersect, you can consider using techniques like Jaccard similarity or cosine similarity to measure the similarity between different sets of clusters. This can help capture the relationship between intersecting clusters and provide additional information for the downstream model.

You can encode them as follows:

For row1: 1st feature: 1, 2nd feature: 1, 3rd feature: 1, 4th feature onwards: 0
For row2: 1st feature: 0, 2nd feature: 1, 3rd feature: 1, 4th feature onwards: 0
For row3: 50th feature: 1, 100th feature: 1, 110th feature: 1, 120th feature: 1, 121st feature: 1, 122nd feature: 1, 123rd feature: 1, 220th feature: 1, other features: 0

etc.

This way, the varying lengths of the cluster sets are encoded into a fixed number of features, and the affinity dependence of intersecting clusters can be captured through similarity measures.

$\endgroup$

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.