Unsupervised encoding of categorical features I have multiple log records with discrete categorical features. Shape of my dataset is (100k, 24) My aim is to look for anomalies in these records. I am planning to cluster the data after encoding.

Before going forward with any analysis, the categorical features need to be encoded; I'd have ideally gone with LabelEncoder or OneHotEncoder but the issue is some features have > 40 possible values. 

As of now, I've frequency encoded the variables but is there something I am missing and is there a better way of going about this?
High cardinality is a common issue that we run into when doing encoding for categorical variables. One hot encoding and label encoding are the most common approaches however label encoding maynot be ideal if the variable is not nominal (not inherently hierarchical) and one hot encoding will lead to curse of dimensionality when no of categories are high. REplacing with ratio or looking at spectral encoding is a good approach to circumvent this

Details of spectral encoding are :-
https://towardsdatascience.com/spectral-encoding-of-categorical-features-b4faebdf4a