[mlpack-git] [mlpack/mlpack] DatasetMapper & Imputer (#694)
Tham
notifications at github.com
Tue Jun 28 20:45:43 EDT 2016
I think this behavior can adjust from map policies.
```
//please give it a better name if you can
class IncrementSpecificTargetPolicy
{
public:
typedef size_t mapped_type;
explicit IncrementSpecificTargetPolicy(std::set<std::string> specificString) :
specificString(std::move(specificString)) {}
template <typename MapType>
mapped_type MapString(MapType& maps,
std::vector<Datatype>& types,
const std::string& string,
const size_t dimension)
{
// If this condition is true, either we have no mapping for the given string
// or we have no mappings for the given dimension at all. In either case,
// we create a mapping.
if (specificString.count(string) != 0 && (maps.count(dimension) == 0 ||
maps[dimension].first.left.count(string) == 0))
{
//do your jobs
}
}
private:
std::set<std::string> specificString;
}; // class IncrementPolicy
```
---
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#issuecomment-229226017
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160628/3b97e4bf/attachment.html>
More information about the mlpack-git
mailing list