| 13 | namespace treelite { |
| 14 | |
| 15 | std::string TaskTypeToString(TaskType type) { |
| 16 | switch (type) { |
| 17 | case TaskType::kBinaryClf: |
| 18 | return "kBinaryClf"; |
| 19 | case TaskType::kRegressor: |
| 20 | return "kRegressor"; |
| 21 | case TaskType::kMultiClf: |
| 22 | return "kMultiClf"; |
| 23 | case TaskType::kLearningToRank: |
| 24 | return "kLearningToRank"; |
| 25 | case TaskType::kIsolationForest: |
| 26 | return "kIsolationForest"; |
| 27 | default: |
| 28 | return ""; |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | TaskType TaskTypeFromString(std::string const& str) { |
| 33 | if (str == "kBinaryClf") { |