<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: I wanted to do one hot encoding on categorical variables for Machine Learning . How can I do that in  Splunk? in Splunk ITSI</title>
    <link>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294552#M274</link>
    <description>&lt;P&gt;@aljohnson_splunk, can label encoding done the same way? I want to categorical variables into numbers with some sort of ranking to it. Is there any method for this?&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jun 2018 13:38:37 GMT</pubDate>
    <dc:creator>aeapen</dc:creator>
    <dc:date>2018-06-29T13:38:37Z</dc:date>
    <item>
      <title>I wanted to do one hot encoding on categorical variables for Machine Learning . How can I do that in  Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294548#M270</link>
      <description>&lt;P&gt;How to do label encoding on categorical variables in splunk.  I'm new to splunk and trying to explore hidden features. Can I also know how to split the fields as done in excel.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 19:45:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294548#M270</guid>
      <dc:creator>jcvytla</dc:creator>
      <dc:date>2018-03-27T19:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: I wanted to do one hot encoding on categorical variables for Machine Learning . How can I do that in  Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294549#M271</link>
      <description>&lt;P&gt;When using the Machine Learning toolkit - it will actually convert your categorical variables into indicator variables - columns of 0's and 1's automatically, behind the scenes. Pretty nifty! It uses panda's &lt;A href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.get_dummies.html"&gt;get_dummies&lt;/A&gt; to do this.&lt;/P&gt;

&lt;P&gt;If you want to do so manually, you can try using eval:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval {fieldToEncode} = 1
| fillnull
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The way this works: the &lt;CODE&gt;{ }&lt;/CODE&gt; around the field mean to take the field's value, and use that as the name for the field. Then we assign that to 1, and fill in all the blanks with zeros.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 20:00:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294549#M271</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2018-03-27T20:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: I wanted to do one hot encoding on categorical variables for Machine Learning . How can I do that in  Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294550#M272</link>
      <description>&lt;P&gt;Hi @aljohnson&lt;/P&gt;

&lt;P&gt;If I want to encode Server_name column ,  should I use&lt;BR /&gt;
 | eval {Server_name} =1 ?&lt;/P&gt;

&lt;P&gt;and extension of that question : suppose i have app_id column , which have values like 1234456122.xxxx&lt;/P&gt;

&lt;P&gt;Now I want only the numerical part ,and want to remove the xxxx part...how do I do it in  splunk&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:43:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294550#M272</guid>
      <dc:creator>jcvytla</dc:creator>
      <dc:date>2020-09-29T18:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: I wanted to do one hot encoding on categorical variables for Machine Learning . How can I do that in  Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294551#M273</link>
      <description>&lt;P&gt;Thats one way you could do it - sure. You'd need to add the &lt;CODE&gt;fillnull&lt;/CODE&gt; command in order to get the zeros in the columns though, too.&lt;/P&gt;

&lt;P&gt;For your second question, you can use &lt;CODE&gt;eval&lt;/CODE&gt; or &lt;CODE&gt;rex&lt;/CODE&gt; or many other search commands to do that:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.3/SearchReference/Eval"&gt;http://docs.splunk.com/Documentation/Splunk/7.0.3/SearchReference/Eval&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.3/SearchReference/rex"&gt;http://docs.splunk.com/Documentation/Splunk/7.0.3/SearchReference/rex&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.3/SearchReference/replace"&gt;http://docs.splunk.com/Documentation/Splunk/7.0.3/SearchReference/replace&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 16:58:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294551#M273</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2018-03-28T16:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: I wanted to do one hot encoding on categorical variables for Machine Learning . How can I do that in  Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294552#M274</link>
      <description>&lt;P&gt;@aljohnson_splunk, can label encoding done the same way? I want to categorical variables into numbers with some sort of ranking to it. Is there any method for this?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 13:38:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294552#M274</guid>
      <dc:creator>aeapen</dc:creator>
      <dc:date>2018-06-29T13:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: I wanted to do one hot encoding on categorical variables for Machine Learning . How can I do that in  Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294553#M275</link>
      <description>&lt;P&gt;You could use a lookup if the values are static and you know the categories before hand. Otherwise I'd think you need to add a custom algorithm - &lt;A href="https://docs.splunk.com/Documentation/MLApp/3.2.0/API/Overview"&gt;https://docs.splunk.com/Documentation/MLApp/3.2.0/API/Overview&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 15:57:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294553#M275</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2018-06-29T15:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: I wanted to do one hot encoding on categorical variables for Machine Learning . How can I do that in  Splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294554#M276</link>
      <description>&lt;P&gt;thank you for the answer.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 16:36:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-ITSI/I-wanted-to-do-one-hot-encoding-on-categorical-variables-for/m-p/294554#M276</guid>
      <dc:creator>aeapen</dc:creator>
      <dc:date>2018-06-29T16:36:52Z</dc:date>
    </item>
  </channel>
</rss>

