xlsindy.simulation module

This module enable user to launch nearly complete workflow in order to run Xl-Sindy simulation

xlsindy.simulation.combine_best_fit(solutions, v_ideal)

Return the best linear combination of a and b to fit v_ideal.

Parameters: - solutions: disjoint solution array - v_ideal: target vector

Returns: - v_hat: best fit vector (alpha * a + beta * b) - residual: L2 norm of the residual (||v_hat - v_ideal||)

xlsindy.simulation.regression_explicite(theta_values: ~numpy.ndarray, velocity_values: ~numpy.ndarray, acceleration_values: ~numpy.ndarray, time_symbol: ~sympy.core.symbol.Symbol, symbol_matrix: ~numpy.ndarray, catalog_repartition: ~xlsindy.catalog.CatalogRepartition, external_force: ~numpy.ndarray, regression_function: ~typing.Callable = <function lasso_regression>) Tuple[ndarray, ndarray, ndarray, ndarray]

Executes regression for a dynamic system to estimate the system’s parameters. This function can only be used with explicit system, meaning that external forces array need to be populated at maximum

Parameters:
  • theta_values (np.ndarray) – Array of angular positions over time.

  • symbol_list (np.ndarray) – Symbolic variables for model construction.

  • catalog_repartition (List[tuple]) – a listing of the different part of the catalog used need to follow the following structure : [(“lagrangian”,lagrangian_catalog),…,(“classical”,classical_catalog,expand_matrix)]

  • external_force (np.ndarray) – array of external forces.

  • time_step (float) – Time step value.

  • hard_threshold (float) – Threshold below which coefficients are zeroed.

  • velocity_values (np.ndarray) – Array of velocities (optional).

  • acceleration_values (np.ndarray) – Array of accelerations (optional).

  • regression_function (Callable) – the regression function used to make the retrieval

Returns:

Solution vector, experimental matrix, sampled time values, covariance matrix.

Return type:

Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]

xlsindy.simulation.regression_implicite(theta_values: ndarray, velocity_values: ndarray, acceleration_values: ndarray, time_symbol: Symbol, symbol_matrix: ndarray, catalog_repartition: CatalogRepartition, l1_lambda=1e-07, debug: bool = False) Tuple[ndarray, ndarray, ndarray, ndarray]

Executes regression for a dynamic system to estimate the system’s parameters. This function can only be used with implicit system, meaning that no external forces are provided. Actually, it is an implementation of SYNDy-PI with the general catalog framework

Parameters:
  • theta_values (np.ndarray) – Array of angular positions over time.

  • symbol_list (np.ndarray) – Symbolic variables for model construction.

  • catalog_repartition (CatalogRepartition) – a listing of the different part of the catalog used need to follow the following structure : [(“lagrangian”,lagrangian_catalog),…,(“classical”,classical_catalog,expand_matrix)]

  • external_force (np.ndarray) – array of external forces.

  • time_step (float) – Time step value.

  • hard_threshold (float) – Threshold below which coefficients are zeroed.

  • velocity_values (np.ndarray) – Array of velocities (optional).

  • acceleration_values (np.ndarray) – Array of accelerations (optional).

  • regression_function (Callable) – the regression function used to make the retrieval

  • debug (bool) – Whether to go into debug mode.

Returns:

Solution vector, experimental matrix, sampled time values, covariance matrix.

Return type:

Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]

xlsindy.simulation.regression_mixed(theta_values: ~numpy.ndarray, velocity_values: ~numpy.ndarray, acceleration_values: ~numpy.ndarray, time_symbol: ~sympy.core.symbol.Symbol, symbol_matrix: ~numpy.ndarray, catalog_repartition: ~xlsindy.catalog.CatalogRepartition, external_force: ~numpy.ndarray, regression_function: ~typing.Callable = <function lasso_regression>)

Executes regression for a dynamic system to estimate the system’s parameters. This function can be used with both explicit and implicit systems, and will performs a chain of implicit/explicit regression.

The algorithm is the following: 1. Find recursively the explicit part of the catalog from the external forces. 2. Perform a first explicit regression on this part of the catalog to retrieve the coefficients 3. Perform an implicit regression on the remaining part of the catalog (remaining part calculated from the result of explicit regression).

[Need to explore this algorithm maybe] The algorithm is the following: 1. Create the experimental matrix from the catalog. 2. Search the “activated” part of the catalog where force are present. 3. Perform a first explicit regression on this experiment matrix to retrieve the coefficients of the explicit part. 4. Search if the solution “activate” another part of the catalog. 5. Repeat 3 and 4 until no new part of the catalog is activated. 6. Perform a final implicit regression on the remaining part of the catalog.

Parameters:
  • theta_values (np.ndarray) – Array of angular positions over time.

  • velocity_values (np.ndarray) – Array of velocities (optional).

  • acceleration_values (np.ndarray) – Array of accelerations (optional).

  • time_symbol (sympy.Symbol) – Symbol representing time.

  • symbol_matrix (np.ndarray) – Matrix of symbolic variables for model construction.

  • catalog_repartition (CatalogRepartition) – Catalog containing the different parts used in the regression.

  • external_force (np.ndarray) – Array of external forces. Defaults to None.

  • regression_function (Callable, optional) – The regression function used to make the retrieval. Defaults to lasso_regression. ( Maybe change to CVxPY in the future)

Returns:

Tuple TODO