Skip to content

[ml] Fix randomize_seed versions and unmute BWC tests #50027

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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