I am trying to find some sort of encoding algorithm that would allow to transform system file paths eg. "c:/users/file1/subfile2/targetfile" into a feature that I could use in machine learning like a float value. It would be best if the folders/files located in the end of the path would have a smaller impact on the output value.

I am thinking maybe some combination of hashing and arithmetics but not sure for now.

I tried looking for something like that in scientific papers and on the internet in general but with no success.

Have anyone ever done something like that or similar?

Sorry if there are some stupid errors in my question. I am just starting my data science adventure.

  • $\begingroup$ What exactly is your aim? Please describe what you are up to modeling wise... $\endgroup$ – Peter Jun 28 at 20:20
  • $\begingroup$ I am performing anomaly detection experiments with multiple methods and file paths are one type of the input. I am trying to perform this feature extraction to fit one-class svm input. $\endgroup$ – m b Jun 28 at 20:29

You may encode each level and concatenate -

If we ignore the path till file1 as its same across all the names.
Then we need 1 digit for subfile and 2 digit for targetfile

c:/users/file1/subfile1/targetfile_0 - [0 00]
c:/users/file1/subfile1/targetfile_1 - [0 01]
c:/users/file1/subfile1/targetfile_2 - [0 10]
c:/users/file1/subfile2/targetfile_0 - [1 00]
c:/users/file1/subfile2/targetfile_1 - [1 01]
c:/users/file1/subfile2/targetfile_2 - [1 10]

Another approach can treat all paths as a feature. With this, you may try all the many encoding approaches e.g. Here.

| Feature#1 | Feature#2  |  Feature#3   |
| File_1    | Subfile_1  | Targetfile_1 |
| File_1    | Subfile_1  | Targetfile_2 |
| File_1    | Subfile_1  | Targetfile_3 |
| improve this answer | |

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.