More categorical tests and disable shap sparse test. (#6219)

* Fix tree load with 32 category.
This commit is contained in:
Jiaming Yuan
2020-10-10 16:12:37 +08:00
committed by GitHub
parent c991eb612d
commit b5b24354b8
5 changed files with 120 additions and 27 deletions

View File

@@ -186,7 +186,9 @@ Json& JsonObject::operator[](int ind) {
}
bool JsonObject::operator==(Value const& rhs) const {
if (!IsA<JsonObject>(&rhs)) { return false; }
if (!IsA<JsonObject>(&rhs)) {
return false;
}
return object_ == Cast<JsonObject const>(&rhs)->GetObject();
}
@@ -275,10 +277,14 @@ Json& JsonNumber::operator[](int ind) {
bool JsonNumber::operator==(Value const& rhs) const {
if (!IsA<JsonNumber>(&rhs)) { return false; }
auto r_num = Cast<JsonNumber const>(&rhs)->GetNumber();
if (std::isinf(number_)) {
return std::isinf(Cast<JsonNumber const>(&rhs)->GetNumber());
return std::isinf(r_num);
}
return std::abs(number_ - Cast<JsonNumber const>(&rhs)->GetNumber()) < kRtEps;
if (std::isnan(number_)) {
return std::isnan(r_num);
}
return number_ - r_num == 0;
}
Value & JsonNumber::operator=(Value const &rhs) {