| 103 | } |
| 104 | |
| 105 | void GetTaskType(const std::unordered_map<std::string, std::string>& params, TaskType* task) { |
| 106 | std::string value; |
| 107 | if (Config::GetString(params, "task", &value)) { |
| 108 | std::transform(value.begin(), value.end(), value.begin(), Common::tolower); |
| 109 | if (value == std::string("train") || value == std::string("training")) { |
| 110 | *task = TaskType::kTrain; |
| 111 | } else if (value == std::string("predict") || value == std::string("prediction") |
| 112 | || value == std::string("test")) { |
| 113 | *task = TaskType::kPredict; |
| 114 | } else if (value == std::string("convert_model")) { |
| 115 | *task = TaskType::kConvertModel; |
| 116 | } else if (value == std::string("refit") || value == std::string("refit_tree")) { |
| 117 | *task = TaskType::KRefitTree; |
| 118 | } else { |
| 119 | Log::Fatal("Unknown task type %s", value.c_str()); |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | void GetDeviceType(const std::unordered_map<std::string, std::string>& params, std::string* device_type) { |
| 125 | std::string value; |