[mlpack-git] [mlpack/mlpack] DatasetMapper & Imputer (#694)

Tham notifications at github.com
Sat Jul 2 04:15:40 EDT 2016


>  bool Load(const std::string& filename,
>            arma::Mat<eT>& matrix,
> -          MapperType& info,
> +          DatasetMapper<PolicyType>& info,
> +          PolicyType& policy,

I think we should reduce duplicate codes, there are two solutions

1 : Use 

```
template<typename eT, typename PolicyType>
bool Load(const std::string& filename,
                 arma::Mat<eT>& matrix,
                 DatasetMapper<PolicyType>& info,
                 PolicyType& policy,
                 const bool fatal,
                 const bool transpose)
```

To implement 

```
template<typename eT, typename PolicyType>
bool Load(const std::string& filename,
                 arma::Mat<eT>& matrix,
                 DatasetMapper<PolicyType>& info,                 
                 const bool fatal,
                 const bool transpose)
```

You can 

```
template<typename eT, typename PolicyType>
inline
bool Load(const std::string& filename,
                 arma::Mat<eT>& matrix,
                 DatasetMapper<PolicyType>& info,                 
                 const bool fatal,
                 const bool transpose)
{
  Load(filename, matrix, info, PolicyType(), fatal, transpose);
}
```

2 : Add a new api in DatasetMapper

`PolicyTypes const& policy() const;`

In this case, we do not need two functions, one function is enough, but the user need to store
the policy in the DatasetMapper before they pass the DatasetMapper into the function.I think this
way is more consistent.

---
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/694/files/87d8d46396a42a4cd491b32be4f17e8582c9223d..de0b2dbba2422296d801e7aa60dc2ed06091ae1a#r69374855
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160702/ca868b71/attachment-0001.html>


More information about the mlpack-git mailing list