Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] add geo point formatting string for actual|typical #809

Merged
merged 6 commits into from
Nov 11, 2019
Merged

[ML] add geo point formatting string for actual|typical #809

merged 6 commits into from
Nov 11, 2019

Conversation

benwtrent
Copy link
Member

Adds new geo_point formatted fields for Java side consumption. These are only written if we have actual|typical values that have length of 2, and are using a lat_long function.

This is my first PR against this repo, let me know if I missed something.

Blocked by elastic/elasticsearch#47050

@edsavage edsavage self-assigned this Nov 11, 2019
Copy link
Contributor

@edsavage edsavage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

std::ostringstream sstream;
std::string partitionFieldName("tfn");
std::string partitionFieldValue("");
std::string overFieldName("pfn");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change these string values to ofv, ofn for consistency?

BOOST_TEST_REQUIRE(object.IsObject());

BOOST_TEST_REQUIRE(object.HasMember("typical"));
//BOOST_REQUIRE_EQUAL(2, object["typical"].GetArray().Size());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm.. I'm always in 2 minds about commented out code, maybe delete it if it's not needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I cannot get the tests to do what I want the to do :(. So, very WIP there.

// We don't want scientific notation and geo points only have precision up to 12 digits
ptStr << std::fixed;
ptStr << std::setprecision(12);
ptStr << results.s_BaselineMean[0] << "," << results.s_BaselineMean[1];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be inclined to factor this out as a lambda (or function), i.e.

auto geoPointToString = [](const auto& point) -> std::string {
    std::ostringstream result;
    return (result << std::fixed << std::setprecision(12) << point[0] << "," << point[1]).str();
};

@benwtrent benwtrent marked this pull request as ready for review November 11, 2019 13:58
@edsavage
Copy link
Contributor

Looks good to go @benwtrent

@@ -37,6 +37,7 @@
* Reduce the peak memory used by boosted tree training and fix an overcounting bug
estimating maximum memory usage. (See {ml-pull}781[#781].)
* Stratified fractional cross validation for regression. (See {ml-pull}784[#784].)
* Added `geo_point` supported output for `lat_long` function records. (See {ml-pull}809[#809].)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of the title of elastic/elasticsearch#47050, as things stand this release note will appear in addition to "Add new geo_results.(actual|typical) fields for lat_lon results". As a user I would wonder whether these two things were the same or different enhancements, so it's probably best to have just one of them.

Since this changelog is more flexible and can reference two PRs, it's probably best to mark elastic/elasticsearch#47050 as a non-issue so that it doesn't get auto-generated into the release notes, but then mention it in this one too, using (See {ml-pull}809[#809], {pull}47050[#47050].).

benwtrent added a commit to elastic/elasticsearch that referenced this pull request Nov 11, 2019
…_long` results (#47050)

[ML] Add new geo_results.(actual_point|typical_point) fields for `lat_long` results (#47050)

Related PR: elastic/ml-cpp#809
benwtrent added a commit to benwtrent/elasticsearch that referenced this pull request Nov 11, 2019
…_long` results (elastic#47050)

[ML] Add new geo_results.(actual_point|typical_point) fields for `lat_long` results (elastic#47050)

Related PR: elastic/ml-cpp#809
@benwtrent benwtrent merged commit 068ff67 into elastic:master Nov 11, 2019
benwtrent added a commit to elastic/elasticsearch that referenced this pull request Nov 11, 2019
…r `lat_long` results (#47050) (#48958)

* [ML] Add new geo_results.(actual_point|typical_point) fields for `lat_long` results (#47050)

[ML] Add new geo_results.(actual_point|typical_point) fields for `lat_long` results (#47050)

Related PR: elastic/ml-cpp#809

* adjusting bwc version
benwtrent added a commit that referenced this pull request Nov 11, 2019
Adds new geo_point formatted fields for Java side consumption. These are only written if we have actual|typical values that have length of 2, and are using a lat_long function.

This is my first PR against this repo, let me know if I missed something.

related elastic/elasticsearch#47050
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants