I'm working on an intrusion detection project, I have many categorical features, for some I used label encoding since I don't have many possible values. But for IP addresses, it's a high cardinality feature, What is the best encoding method to use for features with high cardinality?
I tried using the library ipaddress, here's the code :
data['dstip'] =int(ipaddress.IPv4Address(data['dstip']))
but it returns : Expected 4 octets in %r
Do you have any better suggestion for encoding features with high cardinality ? Thanks