Advanced Octave A36 — Public recipes and fit reuse
Advanced GNU Octave with GX-TXT · Module 06
A recipe describes a accepted fit so that you can control dependencies and explicitly request a new execution. Acquisition, validation and re-execution are distinct operations.
Objectives and prerequisites
We start from a linear fit accepted in the Curve Fitter on the Synthetic Dataset octave_advanced_batch_a of lesson A14. We already know fit and Session from the introductory course. The test uses GX-TXT dev112-P011-bis and GNU Octave 9.4.0.
In the Curve Fitter we selected time_s time and signal_v signal, created the linear preview, accepted the fit and saved the Workspace. idoc_7899510237316669 and accepted1 IDs belong to this specific Session: they are not universal identifiers. To adapt the script to your Session you need the actual identifiers of the Workspace and the accepted fit, obtained from the public tools available in your version.
Purchasing and validating
Import valida_recipe.m, replace IDs with those corresponding to your Session, record the script and start it in the Runner.
api = 'DATASET_CURVE_FIT_API_v1';
recipe = gxtxt_api_call(api,'recipe_capture',{doc,fit_id});
validation = gxtxt_api_call(api,'recipe_validate',{recipe});
disp(validation);
recipe_capture acquires an encoded description of the accepted fit. recipe_validate controls the dependencies and information required by the contract without rethinking the estimate.
In our test the validation returns status = validated, model linear and acquired fit accepted1. Validation is not the re-enforcement of the fit and does not guarantee that the conditions remain valid if source or version changes.
Restore a recipe
The public contract includes recipe_run with the recipe and a Workspace name to perform the analysis again and return a reference to the result. It is a separate action from the simple reading of the previous result. Before reusing a recipe always checks source, model, version, unit and validation status.
Note on the version. In the dev112-P011-bis copy used for driving, acquisition and validation were successful, but two
recipe_runattempts, even after the closure of the Curve Fitter, returnedSession Workspace database already has an active writer or invalid lock. A screenshot of a successful rerun is not available. The expected behavior is to create the new result when the recipe is valid and the Workspace can be updated. The version in which the problem will be correct has not been verified. The small playback script retains the observed call and uses the IDs of the sample session.
Exercise
- Does the validation again fit?
- Why should the script IDs be adapted to another Session?
- Is it correct to declare successful re-execution if
recipe_runsignals an error?
Worked solution
- No. Check the conditions provided by the recipe without re-evaluating the estimate.
- They identify a Workspace and a fit accepted in the Test Session.
- No. The error must be reported and the re-execution should not be presented as a success.
Other steps of this project
- Advanced Octave A75 — Dynamical systems in phase space
- Advanced Octave A81 — Geography of the waves and a 3D surface
- Advanced Octave A82 — Age, sex and demographic inequalities
- Advanced Octave A83 — All-cause mortality, certified COVID deaths and surveillance
- Advanced Octave A84 — A reproducible public account
- Advanced Octave A73 — Optimization landscapes and 3D trajectories