2
$\begingroup$

I am working on fraud detection on blockchains. To be more specific, I fetched a big number of transactions that took place on the blockchain, labeled them to spam / non spam using an appropriate API and now I will train a model to detect fraud using SVM, etc ...

My question is about the preparation of the data. The fields I have are : hash, nonce transaction_index, from_address, to_address,...

The fields "from/to_address" are hexadecimal fields like 0x5e14d30d2155c0cdd65044d7e0f296373f3e92f65ebd

My question is, how should I format this data ? Should I delete this field ? ( I do not think so since it is very relevant to the problem at hand ). I can't find the appropriate encoding, neither.

$\endgroup$
5
  • $\begingroup$ Welcome to DataScienceSE. If this from/to_address is a relevant information, it means that the model will learn which addresses are likely to be related to spam, so the model probably won't able to generalize to new addresses (and essentially it's going to be just an expensive list of 'spam' addresses). $\endgroup$
    – Erwan
    Nov 30, 2021 at 18:59
  • $\begingroup$ I understand. Thank you. But however, how should I format this data ? Is it fine to input hexadecimal values in the model ? $\endgroup$
    – Namrouch
    Nov 30, 2021 at 21:40
  • $\begingroup$ No, everything needs to be encoded and since this is a categorical variable it would need to be one-hot-encoded. This raises another issue: the number of features might be too high since with one-hot encoding there's one feature for each unique value of the variable. $\endgroup$
    – Erwan
    Nov 30, 2021 at 22:46
  • $\begingroup$ and this is the exact reason why I tried to avoid the one-hot-encoding method. Is there any better way ? $\endgroup$
    – Namrouch
    Dec 1, 2021 at 10:11
  • 1
    $\begingroup$ Frequency encoding would avoid the large number of features, it might be a good option if the frequency of an address is a good indicator for its spam status. But I think the main problem is whether the features you use actually help for detecting spam. Usually fraud detection problems don't work just from a list of transactions as far as I know, they need additional indicators. $\endgroup$
    – Erwan
    Dec 1, 2021 at 10:51

1 Answer 1

0
$\begingroup$

It is fine to leave the "from/to_address" in the model. It would be useful to choose an algorithm that learns to weight the feature appropriately.

The current hexadecimal format would be encoded as a string in most machine learning algorithms. It might be useful to use feature hashing to encoding it into numerical values that are amenable to most machine learning algorithms.

$\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.