lib_custom module¶
Design of experiments from custom data.
- class gemseo.algos.doe.lib_custom.CustomDOE[source]
Bases:
DOELibrary
A design of experiments from samples provided as a file or an array.
The samples are provided either as a file in text or csv format or as a sequence of sequences of numbers, e.g. a 2D numpy array.
A csv file format is assumed to have a header whereas a text file (extension .txt) does not.
- static read_file(doe_file, delimiter=',', comments='#', skiprows=0, dimension=0)[source]
Read a file containing several samples (one per line) and return them.
- Parameters:
doe_file (str | Path | TextIO) – Either the file, the filename, or the generator to read.
delimiter (str | None) –
The character used to separate values. If
None
, use whitespace.By default it is set to “,”.
comments (str | Sequence[str] | None) –
The characters or list of characters used to indicate the start of a comment.
None
implies no comments.By default it is set to “#”.
skiprows (int) –
Skip the first
skiprows
lines.By default it is set to 0.
dimension (int) –
The dimension of the variables space if known.
By default it is set to 0.
- Returns:
The samples.
- Return type:
RealArray
- COMMENTS_KEYWORD: Final[str] = 'comments'
The name given to the string indicating a comment line.
- DELIMITER_KEYWORD: Final[str] = 'delimiter'
The name given to the string separating two fields.
- DOE_FILE: Final[str] = 'doe_file'
The name given to the DOE file.
- LIBRARY_NAME: ClassVar[str] = 'GEMSEO'
The name of the interfaced library.
- SAMPLES: Final[str] = 'samples'
The name given to the samples.
- SKIPROWS_KEYWORD: Final[str] = 'skiprows'
The name given to the number of skipped rows in the DOE file.
- descriptions: dict[str, AlgorithmDescription]
The description of the algorithms contained in the library.
- eval_jac: bool
Whether to evaluate the Jacobian.
- internal_algo_name: str | None
The internal name of the algorithm used currently.
It typically corresponds to the name of the algorithm in the wrapped library if any.
- opt_grammar: JSONGrammar | None
The grammar defining the options of the current algorithm.
- problem: OptimizationProblem
The optimization problem the driver library is bonded to.
- samples: RealArray
The design vector samples in the design space.
The design space variable types stored as dtype metadata.
To access those in the unit hypercube, use
unit_samples
.
- unit_samples: RealArray
The design vector samples projected in the unit hypercube.
In the case of a design space of dimension \(d\), the unit hypercube is \([0,1]^d\).
To access those in the design space, use
samples
.