Readding a removed comment about the Python "Model" for the ProcessModelTest
Correctly using all caps for a final variable
@@ -30,6 +30,14 @@ import java.util.regex.Pattern;
public class ProcessModelVertexTest {
/*
+ The model we are mimicking here is a python script, model.py.
+
+ It takes one input, Temperature, and produces two outputs of type double, Chance of Rain & Humidity. These outputs
+ are written to file.
+
+ It also produces one integer output and one boolean output. Suggested Factor of Suncream and 'is it sunny'. These
+ are also written to file.
+
This test provides an example of how to make use of a model implemented in an external application. At the moment
though we just simulate this and the model is actually run in Java code, with our external application just being
chosen for speed of execution.
@@ -37,7 +45,7 @@ public class ProcessModelVertexTest {
private DoubleVertex inputToModel;
private SimpleWeatherModel weatherModel;
- private static final String command = "echo";
+ private static final String COMMAND = "echo";
@Rule
public DeterministicRule rule = new DeterministicRule();
@@ -73,7 +81,7 @@ public class ProcessModelVertexTest {
weatherModel.setInputToModel(inputToModel);
Map<VertexLabel, Vertex<? extends Tensor>> inputs = ImmutableMap.of(new VertexLabel("Temperature"), inputToModel);
- ModelVertex model = LambdaModelVertex.createFromProcess(inputs, command, weatherModel::updateValues);
+ ModelVertex model = LambdaModelVertex.createFromProcess(inputs, COMMAND, weatherModel::updateValues);
DoubleVertex chanceOfRain = model.getDoubleModelOutputVertex(new VertexLabel("ChanceOfRain"));
DoubleVertex humidity = model.getDoubleModelOutputVertex(new VertexLabel("Humidity"));
@@ -94,7 +102,7 @@ public class ProcessModelVertexTest {
weatherModel.setInputToModel(inputToModel);
Map<VertexLabel, Vertex<? extends Tensor>> inputs = ImmutableMap.of(new VertexLabel("Temperature"), inputToModel);
- ModelVertex model = LambdaModelVertex.createFromProcess(inputs, command, weatherModel::updateValuesMultipleTypes);
+ ModelVertex model = LambdaModelVertex.createFromProcess(inputs, COMMAND, weatherModel::updateValuesMultipleTypes);
IntegerVertex suggestedFactorSuncream = model.getIntegerModelOutputVertex(new VertexLabel("suggestedFactorSuncream"));
BoolVertex isSunny = model.getBoolModelOutputVertex(new VertexLabel("isSunny"));
@@ -113,7 +121,7 @@ public class ProcessModelVertexTest {
weatherModel.setInputToModel(inputToModel);
Map<VertexLabel, Vertex<? extends Tensor>> inputs = ImmutableMap.of(new VertexLabel("Temperature"), inputToModel);
- ModelVertex model = LambdaModelVertex.createFromProcess(inputs, command, weatherModel::updateValues);
+ ModelVertex model = LambdaModelVertex.createFromProcess(inputs, COMMAND, weatherModel::updateValues);
DoubleVertex chanceOfRain = model.getDoubleModelOutputVertex(new VertexLabel("ChanceOfRain"));
DoubleVertex humidity = model.getDoubleModelOutputVertex(new VertexLabel("Humidity"));
@@ -137,7 +145,7 @@ public class ProcessModelVertexTest {
Map<VertexLabel, Vertex<? extends Tensor>> inputs = ImmutableMap.of(new VertexLabel("Temperature"), inputToModel);
- ModelVertex model = LambdaModelVertex.createFromProcess(inputs, command, weatherModel::updateValues);
+ ModelVertex model = LambdaModelVertex.createFromProcess(inputs, COMMAND, weatherModel::updateValues);
DoubleVertex chanceOfRain = model.getDoubleModelOutputVertex(new VertexLabel("ChanceOfRain"));
DoubleVertex humidity = model.getDoubleModelOutputVertex(new VertexLabel("Humidity"));
@@ -158,7 +166,7 @@ public class ProcessModelVertexTest {
weatherModel.setInputToModel(inputToModel);
Map<VertexLabel, Vertex<? extends Tensor>> inputs = ImmutableMap.of(new VertexLabel("Temperature"), inputToModel);
- ModelVertex model = LambdaModelVertex.createFromProcess(inputs, command, weatherModel::updateValues);
+ ModelVertex model = LambdaModelVertex.createFromProcess(inputs, COMMAND, weatherModel::updateValues);
DoubleVertex chanceOfRain = model.getDoubleModelOutputVertex(new VertexLabel("ChanceOfRain"));
DoubleVertex humidity = model.getDoubleModelOutputVertex(new VertexLabel("Humidity"));
