<p>In <a href="https://github.com/mlpack/mlpack/pull/457#discussion_r40664352">src/mlpack/methods/softmax_regression/softmax_regression_function.hpp</a>:</p>
<pre style='color:#555'>> @@ -38,12 +37,25 @@ class SoftmaxRegressionFunction
> const arma::mat InitializeWeights();
>
> /**
> + * Initialize Softmax Regression weights(trainable parameters) with
> + * the given parameters.
> + * @param featureSize The features size of the training set
> + * @param numClasses Number of classes for classification.
> + * @param fitIntercept Intercept term flag.
> + * @return weights after initialize
> + */
> + static const arma::mat InitializeWeights(const size_t featureSize,
> + const size_t numClasses,
> + const bool fitIntercept = false);
</pre>
<p>My only suggestion here might be to take the return value as a parameter (i.e. <code>arma::mat& weights</code>). RVO might successfully optimize out the copy in some cases, but I'm not sure that every compiler will do RVO correctly in this case.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/pull/457/files#r40664352">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFNIjlJHSo14ymYHHkBhhUx5OkW3eks5o2nsrgaJpZM4GFbCy.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/457/files#r40664352"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>