Data analysis module

File to analyze the reference trajectories.

pyrotor.data_analysis.add_derivatives(reference_trajectories, basis_dimension)

Compute derivatives of each state from a dataframe and append derivatives to initial dataframe.

Inputs:
  • reference_trajectories: list of DataFrame

    List of reference trajectories

  • basis_dimension: dict

    Give the number of basis functions for each state

Output:
reference_trajectories_deriv: list of DataFrame

List of reference trajectories with derivatives

pyrotor.data_analysis.compute_covariance(dataset)

Estimate covariance and precision matrices from data X.

Depending on samples number, use either EmpiricalCovariance or GraphicalLasso methods from scikit-learn.

Input:
dataset: ndarray

Dataset

Outputs:
covariance: ndarray

Estimated covariance matrix

precision: ndarray

Estimated precision matrix (i.e. pseudo-inverse of covariance)

pyrotor.data_analysis.compute_weights(trajectories_cost, weight_fonction=None)

Compute normalized weights associated with each trajectory.

Inputs:
  • trajectories_cost: ndarray

    Array containing the cost of the trajectories

  • weight_fonction: function, default=None

    Function used to compute weights from the costs - Default function is f(x) = exp(-x)

Output:
  • weights: ndarray

    Array containing normalized weights

pyrotor.data_analysis.nb_samples_is_sufficient(dataset)

Tell wether or not there is enough samples in the data set.

Input:
dataset: ndarray

Dataset

Output:
is_sufficient: boolean

Tell wether or not there are twice more observations than features

pyrotor.data_analysis.select_trajectories(trajectories, trajectories_cost, trajectories_nb)

Return the trajectories associated with the smallest costs.

Inputs:
  • trajectories: list of pd.DataFrame

    Each element of the list is a trajectory

  • trajectories_cost: ndarray

    Array containing the cost of the trajectories

  • trajectories_nb: int

    Number of trajectories to keep

Ouput:
  • best_trajectories: list of pd.DataFrame

    List containing the best trajectories