Skip to content

Commit

Permalink
[ml] Fix randomize_seed versions and unmute BWC tests (#50027)
Browse files Browse the repository at this point in the history
... now that #49990 has been backported.

Relates #49990
  • Loading branch information
dimitris-athanasiou committed Dec 11, 2019
1 parent 022e5f5 commit 6790cc2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public Classification(StreamInput in) throws IOException {
predictionFieldName = in.readOptionalString();
numTopClasses = in.readOptionalVInt();
trainingPercent = in.readDouble();
if (in.getVersion().onOrAfter(Version.CURRENT)) {
if (in.getVersion().onOrAfter(Version.V_7_6_0)) {
randomizeSeed = in.readOptionalLong();
} else {
randomizeSeed = Randomness.get().nextLong();
Expand Down Expand Up @@ -163,7 +163,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalString(predictionFieldName);
out.writeOptionalVInt(numTopClasses);
out.writeDouble(trainingPercent);
if (out.getVersion().onOrAfter(Version.CURRENT)) {
if (out.getVersion().onOrAfter(Version.V_7_6_0)) {
out.writeOptionalLong(randomizeSeed);
}
}
Expand All @@ -180,7 +180,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
builder.field(PREDICTION_FIELD_NAME.getPreferredName(), predictionFieldName);
}
builder.field(TRAINING_PERCENT.getPreferredName(), trainingPercent);
if (version.onOrAfter(Version.CURRENT)) {
if (version.onOrAfter(Version.V_7_6_0)) {
builder.field(RANDOMIZE_SEED.getPreferredName(), randomizeSeed);
}
builder.endObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public Regression(StreamInput in) throws IOException {
boostedTreeParams = new BoostedTreeParams(in);
predictionFieldName = in.readOptionalString();
trainingPercent = in.readDouble();
if (in.getVersion().onOrAfter(Version.CURRENT)) {
if (in.getVersion().onOrAfter(Version.V_7_6_0)) {
randomizeSeed = in.readOptionalLong();
} else {
randomizeSeed = Randomness.get().nextLong();
Expand Down Expand Up @@ -130,7 +130,7 @@ public void writeTo(StreamOutput out) throws IOException {
boostedTreeParams.writeTo(out);
out.writeOptionalString(predictionFieldName);
out.writeDouble(trainingPercent);
if (out.getVersion().onOrAfter(Version.CURRENT)) {
if (out.getVersion().onOrAfter(Version.V_7_6_0)) {
out.writeOptionalLong(randomizeSeed);
}
}
Expand All @@ -146,7 +146,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
builder.field(PREDICTION_FIELD_NAME.getPreferredName(), predictionFieldName);
}
builder.field(TRAINING_PERCENT.getPreferredName(), trainingPercent);
if (version.onOrAfter(Version.CURRENT)) {
if (version.onOrAfter(Version.V_7_6_0)) {
builder.field(RANDOMIZE_SEED.getPreferredName(), randomizeSeed);
}
builder.endObject();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
setup:
- skip:
version: "all"
reason: "Until backport of https://github.com/elastic/elasticsearch/issues/49690"

---
"Get old outlier_detection job":

Expand Down Expand Up @@ -65,6 +60,7 @@ setup:
- match: { data_frame_analytics.0.dest.index: "old_cluster_regression_job_results" }
- match: { data_frame_analytics.0.analysis.regression.dependent_variable: "foo" }
- match: { data_frame_analytics.0.analysis.regression.training_percent: 100.0 }
- is_true: data_frame_analytics.0.analysis.regression.randomize_seed

---
"Get old regression job stats":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
setup:
- skip:
version: "all"
reason: "Until backport of https://github.com/elastic/elasticsearch/issues/49690"

- do:
index:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
setup:
- skip:
version: "all"
reason: "Until backport of https://github.com/elastic/elasticsearch/issues/49690"

---
"Get old cluster outlier_detection job":

Expand Down Expand Up @@ -45,6 +40,7 @@ setup:
- match: { data_frame_analytics.0.dest.index: "old_cluster_regression_job_results" }
- match: { data_frame_analytics.0.analysis.regression.dependent_variable: "foo" }
- match: { data_frame_analytics.0.analysis.regression.training_percent: 100.0 }
- is_true: data_frame_analytics.0.analysis.regression.randomize_seed

---
"Get old cluster regression job stats":
Expand Down

0 comments on commit 6790cc2

Please sign in to comment.