Advanced Octave A31 — Model catalog and parameters

by Giux GX-TXT, octave-en, scripts-en 2 min read

Advanced GNU Octave with GX-TXT · Module 06

Before adapting a model to data it is necessary to know what it represents, what parameters it requires and what hypotheses it uses. Curve Fitter’s public cards help you explore this information directly from an Octave script.

Objectives and prerequisites

The introductory course introduced regression and fitting. We now begin an advanced path by questioning the DATASET_CURVE_FIT_API_v1/model_cards catalog via the Bridge. The test uses GX-TXT dev112-P011-bis and GNU Octave 9.4.0.

Read a tab

Import catalogo_modelli.m, register it and run it in the Runner.

% Advanced Octave course A31: inspect public Curve Fitter model cards.
% SPDX-License-Identifier: GPL-3.0-or-later
gxtxt_api_require({'DATASET_CURVE_FIT_API_v1@1'});
cards = gxtxt_api_call('DATASET_CURVE_FIT_API_v1','model_cards',{});
fprintf('Model cards available: %d\n',numel(cards));
if !isempty(cards)
  fprintf('First available model card:\n');
  if iscell(cards), disp(cards{1}); else, disp(cards(1)); endif
endif

Control on the empty set avoids requiring the first tab when the catalog does not contain it. The iscell branch allows you to read the first item in the form of container actually received; it does not assume that the order of the catalog is stable between versions.

In the test the catalog contains 22 tabs and the first describes the linear regression. Identifying, equation, parameters, domain, method and indications on uncertainty and extrapolation are visible. The number of cards and the first item can change with installed releases and modules.

Read the card critically

For a straight, intercept and slope have different units: if the output is in volts and the entrance in seconds, the intercept is in volts and the slope in volts per second. The board helps to identify parameters and hypotheses, but does not show that the model is suitable for the data of a particular experiment.

Before the fit, consider domain, units, initial conditions when required, weights and parameters limits. After the fit test diagnostics and residues. A catalog description is model documentation; it is not an adapted result or a physical proof of validity.

Exercise

  1. Will the first tab of your catalogue always be the linear one?
  2. What units do you have the slope if the output is in volt and the time in seconds?
  3. Does the presence of a model in the catalog guarantee that it describes your experiment?

Worked solution

  1. No. Order and availability can change; identify the model from its ID and verify the version.
  2. Volt per second.
  3. No. It is necessary to evaluate hypotheses, data, fit and scientific interpretation.

Download the Module 06 scripts (ZIP)

#GNU Octave #GX-TXT #GX-TXT public APIs

Other steps of this project

Leave a Reply

Your email address will not be published. Required fields are marked *