[mlpack-git] [mlpack/mlpack] add overload that imputes every dimensions (#740)

Tham notifications at github.com
Tue Jul 26 15:01:10 EDT 2016


> +              const std::string& missingValue)
> +  {
> +    if (columnMajor)
> +    {
> +      for (size_t i = 0; i < input.n_rows; ++i)
> +      {
> +        if (mapper.NumMappings(i) > 0)
> +        {
> +          T mappedValue = static_cast<T>(mapper.UnmapValue(missingValue, i));
> +          strategy.Impute(input, mappedValue, i, columnMajor);
> +        }
> +      }
> +    }
> +    else
> +    {
> +      for (size_t i = 0; i < input.n_rows; ++i)

I think this one should be input.n_cols?
Besides, we could reduce duplicate codes

```
const size_t dimensions = columnMajor ? input.n_rows : input.n_cols;
for (size_t i = 0; i != dimensions ; ++i)
 {
        if (mapper.NumMappings(i) > 0)
        {
          T mappedValue = static_cast<T>(mapper.UnmapValue(missingValue, i));
          strategy.Impute(input, mappedValue, i, columnMajor);
        }
}
```

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/740/files/645c58d4f0d413b2fe0c97766b1aa4bc486e21bb#r72315082
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160726/22312bc9/attachment-0001.html>


More information about the mlpack-git mailing list