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.
Constructor Abstract class.
- read_file(doe_file, delimiter=',', comments='#', skiprows=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.
- Returns:
The samples.
- Return type:
ndarray
- COMMENTS_KEYWORD: ClassVar[str] = 'comments'
The name given to the string indicating a comment line.
- DELIMITER_KEYWORD: ClassVar[str] = 'delimiter'
The name given to the string separating two fields.
- DOE_FILE: ClassVar[str] = 'doe_file'
The name given to the DOE file.
- SAMPLES: ClassVar[str] = 'samples'
The name given to the samples.
- SKIPROWS_KEYWORD: ClassVar[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: Any | None
The problem to be solved.
- samples: ndarray
The input samples with the design space variable types stored as dtype metadata.
- seed: int
The seed to be used for reproducibility reasons.
This seed is initialized at 0 and each call to
execute()
increments it before using it.
- unit_samples: ndarray
The input samples transformed in \([0,1]\).