Support feature names/types for cudf. (#4902)

* Implement most of the pandas procedure for cudf except for type conversion.
* Requires an array of interfaces in metainfo.
This commit is contained in:
Jiaming Yuan
2019-09-29 15:07:51 -04:00
committed by GitHub
parent 2fa8b359e0
commit d30e63a0a5
6 changed files with 90 additions and 25 deletions

View File

@@ -35,8 +35,10 @@ void CopyInfoImpl(std::map<std::string, Json> const& column, HostDeviceVector<fl
}
void MetaInfo::SetInfo(const char * c_key, std::string const& interface_str) {
Json j_arr = Json::Load({interface_str.c_str(), interface_str.size()});
auto const& j_arr_obj = get<Object>(j_arr);
Json j_interface = Json::Load({interface_str.c_str(), interface_str.size()});
auto const& j_arr = get<Array>(j_interface);
CHECK_EQ(j_arr.size(), 1) << "MetaInfo: " << c_key << ". " << ColumnarErrors::Dimension(1);;
auto const& j_arr_obj = get<Object const>(j_arr[0]);
std::string key {c_key};
ArrayInterfaceHandler::Validate(j_arr_obj);
if (j_arr_obj.find("mask") != j_arr_obj.cend()) {