xlsindy.catalog module
This file implement catalog classes, it provides a unified way to treat of catalog category through abstract classes
This file replace the catalog_gen function from older version.
- class xlsindy.catalog.CatalogCategory(*args, **kwargs)
Bases:
ABC
The class that implement each of the subdictionnary for the general SINDy framework.
- Some variable are required :
catalog_length (int) : The total lenght of the output of the expanded catalog (should be infered without hard computation)
num_coordinate (int) : The number of coordinate of the system.
- abstractmethod create_solution_vector(*args, **kwargs)
This method output the solution vector from any solution related data.
- Returns:
an array of shape (catalog_length,1) containing the coefficient that replicate the solution system.
- Return type:
np.ndarray
- abstractmethod expand_catalog()
This method expand the catalog in a (catalog_length,num_coordinate) matrix.
- Returns:
an array of shape (catalog_length,num_coordinate) containing all the function
- Return type:
np.ndarray
- abstractmethod label()
Return the label of the expanded catalog.
- abstractmethod separate_by_mask(mask: ndarray) tuple
Separate the catalog by a mask. The mask is a boolean array of shape (catalog_length,).
- Parameters:
mask (np.ndarray) – a boolean array of shape (catalog_length,) to separate the catalog.
- Returns:
a new CatalogCategory with the masked data. CatalogCategory: a new CatalogCategory with the remaining data.
- Return type:
- class xlsindy.catalog.CatalogRepartition(catalog_repartition: List[CatalogCategory])
Bases:
object
A class that manage the repartition of the catalog. It is used to create a global catalog from different part of the catalog.
- create_solution_vector(solution_data: List[tuple]) ndarray
Create an unique solution vector from the catalog and the solution data. :param solution_data: the solution data composed of the different information to build the solution vector, each one dependend of the paradigm used [(Lagrangian,substitution),…,(coeff_matrix, binary_matrix)] :type solution_data: List[tuple]
- Returns:
the solution vector
- Return type:
np.ndarray
- expand_catalog()
create a global catalog for the regression system
- Returns:
a global catalog of shape (catalog_length,num_coordinate) containing all the function
- Return type:
np.ndarray
- label_catalog()
WARNING : NOT IMPLEMENTED YET Convert the catalog into label
- Parameters:
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)]
- Returns:
List of labels for the catalog.
- Return type:
List[str]
- reunite_solution_by_type(type_mask: List[str], masked_solution: ndarray, remaining_solution: ndarray)
Reunite the solution vector by type. The type is a list of string that match the label of the catalog. the type is the name of the class.
- Parameters:
type_mask (List[str]) – a list of string that match the label of the catalog.
masked_solution (np.ndarray) – the masked solution vector to be reunited.
remaining_solution (np.ndarray) – the remaining solution vector to be reunited.
- Returns:
the reunited solution vector.
- Return type:
np.ndarray
- separate_by_mask(mask: ndarray) tuple
Separate the catalog by a mask. The mask is a boolean array of shape (catalog_length,).
- Parameters:
mask (np.ndarray) – a boolean array of shape (catalog_length,) to separate the catalog.
- Returns:
two CatalogRepartition with the masked data and the remaining data.
- Return type:
tuple
- separate_solution_by_type(solution: ndarray, type_mask: List[str]) tuple
Separate the the solution vector by type. The type is a list of string that match the label of the catalog. the type is the name of the class.
- Parameters:
solution (np.ndarray) – the solution vector to be separated.
type_mask (List[str]) – a list of string that match the label of the catalog.
- Returns:
two CatalogRepartition with the masked data and the remaining data.
- Return type:
tuple
- seperate_by_type(type_mask: List[str]) tuple
Separate the catalog by type. The type is a list of string that match the label of the catalog. the type is the name of the class.
- Parameters:
type_mask (List[str]) – a list of string that match the label of the catalog.
- Returns:
two CatalogRepartition with the masked data and the remaining data.
- Return type:
tuple