<p>In <a href="https://github.com/mlpack/mlpack/pull/466#discussion_r43379700">src/mlpack/methods/softmax_regression/softmax_main.cpp</a>:</p>
<pre style='color:#555'>&gt; +  //data::Load(labelFile, trainLabels, true);
&gt; +
&gt; +  std::cout&lt;&lt;trainData&lt;&lt;&quot;\n\n&quot;;
&gt; +  std::cout&lt;&lt;trainLabels&lt;&lt;&quot;\n\n&quot;;
&gt; +  if(trainData.n_cols != trainLabels.n_elem)
&gt; +  {
&gt; +    Log::Fatal &lt;&lt; &quot;Samples of input_data should same as the size &quot;
&gt; +                  &quot;of input_label &quot; &lt;&lt; std::endl;
&gt; +  }
&gt; +
&gt; +  size_t numClasses = CLI::GetParam&lt;int&gt;(&quot;number_of_classes&quot;);
&gt; +  if(numClasses == 0){
&gt; +    const std::set&lt;size_t&gt; unique_labels(std::begin(trainLabels),
&gt; +                                         std::end(trainLabels));
&gt; +    numClasses = unique_labels.size();
&gt; +  }
</pre>
<p>I think <code>data::NormalizeLabels()</code> will do what you want here.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/pull/466/files#r43379700">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFDVKm2E6Z9XdFOApPtOg3Hb9v36fks5pAgxVgaJpZM4GX7Ld.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/pull/466/files#r43379700"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>