MCPcopy
hub / github.com/WassimTenachi/PhySO / execute

Method execute

physo/physym/program.py:285–306  ·  view source on GitHub ↗

Executes program on X. Parameters ---------- X : torch.tensor of shape (n_dim, ?,) of float Values of the input variables of the problem with n_dim = nb of input variables, ? = number of samples. i_realization : int, optional Index of

(self, X, i_realization = 0, n_samples_per_dataset = None)

Source from the content-addressed store, hash-verified

283 return y
284
285 def execute(self, X, i_realization = 0, n_samples_per_dataset = None):
286 """
287 Executes program on X.
288 Parameters
289 ----------
290 X : torch.tensor of shape (n_dim, ?,) of float
291 Values of the input variables of the problem with n_dim = nb of input variables, ? = number of samples.
292 i_realization : int, optional
293 Index of realization to use for dataset specific free constants (0 by default).
294 n_samples_per_dataset : array_like of shape (n_realizations,) of int or None, optional
295 Overrides i_realization if given. If given assumes that X contains multiple datasets with samples of each
296 dataset following each other and each portion of X corresponding to a dataset should be treated with its
297 corresponding dataset specific free constants values. n_samples_per_dataset is the number of samples for
298 each dataset. Eg. [90, 100, 110] for 3 datasets, this will assume that the first 90 samples of X are for
299 the first dataset, the next 100 for the second and the last 110 for the third.
300 Returns
301 -------
302 y : torch.tensor of shape (?,) of float
303 Result of computation.
304 """
305 y = self.candidate_wrapper(lambda X: self.execute_wo_wrapper(X=X, i_realization=i_realization, n_samples_per_dataset=n_samples_per_dataset), X)
306 return y
307
308 def optimize_constants(self, X, y_target, y_weights = 1., i_realization = 0, n_samples_per_dataset = None, args_opti = None, freeze_class_free_consts = False):
309 """

Calls 1

execute_wo_wrapperMethod · 0.95