I tried sklearn SelectKBest for feature selection (feature scores) of supervised machine learning before. It looks good, but can only take numbers as inputs.

Although I can present some string columns into numbers, for examples:

  • Max/min length of strings
  • nunique of different strings, etc.

I still hope there's a feature selection method to read strings as input.

Please recommend some feature selection that be able to analyze string (*remark) columns. Or Python import xxx.

  • remark: Or maybe some special kinds of strings, e.g., IP addresses, web URL.
  • $\begingroup$ Normally string columns are encoded as they are most often classification columns. What kind are yours as in what data do they represent and how do believe this will effect the output $\endgroup$ – Tasty213 Aug 27 '19 at 10:28
  • $\begingroup$ @Tasty: for example, i break a full URL columns into several columns of partial URL components (e.g, root domain, 1st /, 2nd /, etc) , can take these string columns into feature selection. This is just one example. i have other columns such as IP address $\endgroup$ – TJCLK Aug 27 '19 at 10:31
  • 1
    $\begingroup$ After encoding they become integers, for instance you could asign each possibility for each section of the URL an integer $\endgroup$ – Tasty213 Aug 27 '19 at 10:35
  • 1
    $\begingroup$ Yes but you could limit the resoloution or change the ip adresses into something more usefull (like the ip reigon) $\endgroup$ – Tasty213 Aug 27 '19 at 10:42
  • 1
    $\begingroup$ ML and AI models won't read strings in, even high level text/sentiment analysis algorithms convert them internally $\endgroup$ – Tasty213 Aug 27 '19 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.