Splitting Training Files Across Multiple MLL Scripts
Help Request
Use case
split training file into multiple separate files, but do the writing part in a single file
Minimal Working Example
ackley_training.mll:
import "definitions" from de.evoal.surrogate.ml;
import "definitions" from de.evoal.surrogate.smile.ml;
import "data" from surrogate;
module ackley_training {
prediction svr_ackley
maps 'x:0'
to 'y:0'
using
layer transfer
with function 'gaussian-svr'
mapping 'x:0'
to 'y:0'
with parameters
'ε' := 1.0; // default 1.4
'σ' := 2.0; // default 1.0
'soft-margin' := 0.3; // default 0.15
tolerance := 0.05; // default 0.1
}
all_training.mll:
import "definitions" from de.evoal.surrogate.ml;
import "definitions" from de.evoal.surrogate.smile.ml;
import "data" from surrogate;
import "svr_ackley" from ackley_training;
module all_training {
predict svr_ackley from "../generated/pure/samples-00008/sigma-1/all.json"
and measure
'cross-validation'(10);
'R²'();
'rmse'();
end
and store to "../generated/pure/samples-00008/sigma-1/gaussian_ackley.pson"
predict svr_rastrigin from "../generated/pure/samples-00008/sigma-1/all.json"
and measure
'cross-validation'(10);
'R²'();
'rmse'();
end
and store to "../generated/pure/samples-00008/sigma-1/gaussian_rastrigin.pson"
predict svr_rosenbrock from "../generated/pure/samples-00008/sigma-1/all.json"
and measure
'cross-validation'(10);
'R²'();
'rmse'();
end
and store to "../generated/pure/samples-00008/sigma-1/gaussian_rosenbrock.pson"
predict svr_weightedsphere from "../generated/pure/samples-00008/sigma-1/all.json"
and measure
'cross-validation'(10);
'R²'();
'rmse'();
end
and store to "../generated/pure/samples-00008/sigma-1/gaussian_weightedsphere.pson"
}
What is your question or problem
It was mentioned this would be possible, but i am not sure right now how to do this properly, this are the relevant error messages i get:
13:22:09.450 [main] ERROR d.e.s.m.c.MachineLearningModuleProducer - Error while processing rule 'all_training.mll': XtextLinkingDiagnostic: null:8 Couldn't resolve reference to SurrogateDefinition 'svr_ackley'.
13:22:09.454 [main] ERROR d.e.s.m.c.MachineLearningModuleProducer - Error while processing rule 'all_training.mll': XtextLinkingDiagnostic: null:16 Couldn't resolve reference to SurrogateDefinition 'svr_rastrigin'.
13:22:09.454 [main] ERROR d.e.s.m.c.MachineLearningModuleProducer - Error while processing rule 'all_training.mll': XtextLinkingDiagnostic: null:24 Couldn't resolve reference to SurrogateDefinition 'svr_rosenbrock'.
13:22:09.454 [main] ERROR d.e.s.m.c.MachineLearningModuleProducer - Error while processing rule 'all_training.mll': XtextLinkingDiagnostic: null:32 Couldn't resolve reference to SurrogateDefinition 'svr_weightedsphere'.
Why would i want to do this
i have the following prediction generator file:
import "definitions" from de.evoal.core.math;
import "definitions" from de.evoal.generator.generator;
import "definitions" from de.evoal.surrogate.generator;
import "data" from surrogate;
module surrogate {
/**
* Introduce a simple pipeline that generates some test data using
* the ackley function.
*/
pipeline 'main-pipeline' [
/**
* First, we generate some normally distributed data.
*/
step {
component 'normal-distribution' {
'μ' := 0.0;
'σ' := 1;
}
writes [data 'x:0', data 'x:1', data 'x:2', data 'x:3', data 'x:4'];
}
step {
component 'surrogate' {
}
reads [data 'x:0'];
writes [data 'y:0'];
}
step {
component 'surrogate' {
}
reads [data 'x:1'];
writes [data 'y:1'];
}
step {
component 'surrogate' {
}
reads [data 'x:2', data 'x:3'];
writes [data 'y:2'];
}
step {
component 'surrogate' {
}
reads [data 'x:4'];
writes [data 'y:3'];
}
]
write "../generated/pure/samples-16384/sigma-1/predicted.json" with 16384 samples from executing [ pipeline 'main-pipeline'];
}
this was the old training file:
import "definitions" from de.evoal.surrogate.ml;
import "definitions" from de.evoal.surrogate.smile.ml;
import "data" from surrogate;
module all_training {
prediction svr_ackley
maps 'x:0'
to 'y:0'
using
layer transfer
with function 'gaussian-svr'
mapping 'x:0'
to 'y:0'
with parameters
'ε' := 1.0; // default 1.4
'σ' := 2.0; // default 1.0
'soft-margin' := 0.3; // default 0.15
tolerance := 0.05; // default 0.1
prediction svr_rastrigin
maps 'x:1'
to 'y:1'
using
layer transfer
with function 'gaussian-svr'
mapping 'x:1'
to 'y:1'
with parameters
'ε' := 1.0; // default 0.5
'σ' := 2.0; // default 1.0
'soft-margin' := 0.3; // default 0.15
tolerance := 0.05; // default 0.1
prediction svr_rosenbrock
maps 'x:2', 'x:3'
to 'y:2'
using
layer transfer
with function 'gaussian-svr'
mapping 'x:2', 'x:3'
to 'y:2'
with parameters
'ε' := 1.0; // default 0.5
'σ' := 2.0; // default 1.0
'soft-margin' := 0.3; // default 0.15
tolerance := 0.05; // default 0.1
prediction svr_weightedsphere
maps 'x:4'
to 'y:3'
using
layer transfer
with function 'gaussian-svr'
mapping 'x:4'
to 'y:3'
with parameters
'ε' := 1.0; // default 0.5
'σ' := 2.0; // default 1.0
'soft-margin' := 0.3; // default 0.15
tolerance := 0.05; // default 0.1
predict svr_ackley from "../generated/pure/samples-00008/sigma-1/all.json"
and measure
'cross-validation'(10);
'R²'();
'rmse'();
end
and store to "../generated/pure/samples-00008/sigma-1/gaussian_ackley.pson"
predict svr_rastrigin from "../generated/pure/samples-00008/sigma-1/all.json"
and measure
'cross-validation'(10);
'R²'();
'rmse'();
end
and store to "../generated/pure/samples-00008/sigma-1/gaussian_rastrigin.pson"
predict svr_rosenbrock from "../generated/pure/samples-00008/sigma-1/all.json"
and measure
'cross-validation'(10);
'R²'();
'rmse'();
end
and store to "../generated/pure/samples-00008/sigma-1/gaussian_rosenbrock.pson"
predict svr_weightedsphere from "../generated/pure/samples-00008/sigma-1/all.json"
and measure
'cross-validation'(10);
'R²'();
'rmse'();
end
and store to "../generated/pure/samples-00008/sigma-1/gaussian_weightedsphere.pson"
}
and this is the shell file:
#!/bin/bash
export EVOAL_HOME=$( cd -- "$(dirname $0)/../../../" >/dev/null 2>&1 ; pwd -P )
$SHELL $EVOAL_HOME/bin/evoal-generator.sh . prediction.generator -Bsurrogate:configuration-file=all_training.mll -Bsurrogate:pre-trained=../generated/pure/samples-00008/sigma-1/gaussian_ackley.pson
after using the shell file, it correctly predicts the values for the first model (ackley), but the other values are empty in the json file