Struct Model::CalibrationInput
Defined in File model.hpp
Nested Relationships
This struct is a nested type of Template Class Model.
Struct Documentation
-
struct CalibrationInput
Represents a calibration dataset with multi-dimensional input features, target values, and uncertainties.
This struct stores multi-dimensional input vectors (represented as arrays of size
N
), target output values (y
), and uncertainties (dy
) associated with the output targets. The struct includes a method for checking consistency between the sizes of the input, output, and uncertainty vectors.Public Functions
-
inline bool size_consistent() const
Checks whether the sizes of the input, output, and uncertainty vectors are consistent.
Ensures that the number of input samples matches the number of target values and their uncertainties
- Returns:
True if all vectors have consistent sizes; false otherwise.
-
inline void clear()
-
inline void serialize(const std::string &filename) const
Serializes the contents of the CalibrationInput object to a binary file.
The function writes the size of the data followed by the raw bytes of the
x
,y
, anddy
vectors to the specified file using binary format.- Parameters:
filename – Path to the output file.
- Throws:
std::runtime_error – if the file cannot be opened.
-
inline void deserialize(const std::string &filename)
Deserializes the contents of a CalibrationInput object from a binary file.
The function reads the binary-encoded data from the specified file and populates the
x
,y
, anddy
vectors.- Parameters:
filename – Path to the input file.
- Throws:
std::runtime_error – if the file cannot be opened or if the read fails.
-
inline CalibrationInput subset(int sample_interval) const
Returns a sampled subset of the calibration data.
This function flattens the calibration data stored in
x
,y
, anddy
, applies uniform downsampling based on the providedsample_interval
, and then reconstructs a newCalibrationInput
object with the sampled data.- Parameters:
sample_interval – Sampling stride: every
sample_interval
-th data point will be retained. Must be ≥ 1.- Returns:
A new
CalibrationInput
instance containing the sampled data.
Public Members
-
std::vector<std::array<double, N>> x
Multi-dimensional input values. Each entry in the vector is an array of size
N
representing a set of input features for a sample.
-
std::vector<double> y
Target output values. A vector of target values associated with each input sample.
-
std::vector<double> dy
Uncertainties associated with the target values. A vector of uncertainties (standard deviations) corresponding to the target values.
-
inline bool size_consistent() const