refactor: simplify nested loop for finding min and max values in training data
This commit is contained in:
@@ -23,15 +23,14 @@ public class Main {
|
||||
|
||||
int minValue = Integer.MAX_VALUE;
|
||||
int maxValue = Integer.MIN_VALUE;
|
||||
for (LabeledSequence sequence : train) {
|
||||
for (LabeledSequence labeledSequence : train) {
|
||||
for (int v : labeledSequence.sequence()) {
|
||||
if (v < minValue) minValue = v;
|
||||
if (v > maxValue) maxValue = v;
|
||||
}
|
||||
for (LabeledSequence ls : train) {
|
||||
for (int v : ls.sequence()) {
|
||||
if (v < minValue) minValue = v;
|
||||
if (v > maxValue) maxValue = v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
minValue = minValue - 1;
|
||||
maxValue = maxValue + 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user