intprim
Public Member Functions | Public Attributes | List of all members
intprim.basis.polynomial_model.PolynomialModel Class Reference

The PolynomialModel class implements a basis model consisting of Polynomial basis functions. More...

Inheritance diagram for intprim.basis.polynomial_model.PolynomialModel:
intprim.basis.basis_model.BasisModel intprim.basis.basis_model.BasisModel

Public Member Functions

def __init__ (self, degree, observed_dof_names, start_phase=0.0, end_phase=1.01)
 Initializer method for PolynomialModel. More...
 
def get_basis_functions (self, x, degree=None)
 Gets the basis function evaluations for the given phase value(s). More...
 
def get_basis_function_derivatives (self, x, degree=None)
 Gets the evaluations for the derivative of the basis functions for the given phase value(s). More...
 
def __init__ (self, degree, observed_dof_names, start_phase=0.0, end_phase=1.01)
 Initializer method for PolynomialModel. More...
 
def get_basis_functions (self, x, degree=None)
 Gets the basis function evaluations for the given phase value(s). More...
 
def get_basis_function_derivatives (self, x, degree=None)
 Gets the evaluations for the derivative of the basis functions for the given phase value(s). More...
 
- Public Member Functions inherited from intprim.basis.basis_model.BasisModel
def __init__ (self, degree, observed_dof_names)
 Initialization method for the BasisModel class. More...
 
def get_block_diagonal_basis_matrix (self, x, out_array=None, start_row=0, start_col=0)
 Gets the block diagonal basis matrix for the given phase value(s). More...
 
def get_block_diagonal_basis_matrix_derivative (self, x, out_array=None, start_row=0, start_col=0)
 Gets the block diagonal basis derivative matrix for the given phase value(s). More...
 
def get_weighted_vector_derivative (self, x, weights, out_array=None, start_row=0, start_col=0)
 Gets the weighted vector derivatives corresponding to this basis model for the given basis state. More...
 
def fit_basis_functions_linear_closed_form (self, x, y)
 Fits the given trajectory to this basis model via least squares. More...
 
def apply_coefficients (self, x, coefficients, deriv=False)
 Applies the given weights to this basis model. More...
 
def plot (self)
 
def plot_derivative (self)
 
def plot_weighted (self, coefficients, coefficient_names)
 
def observed_to_state_indices (self, observed_indices)
 
def observed_indices_related (self, observed_indices)
 
def __init__ (self, degree, observed_dof_names)
 Initialization method for the BasisModel class. More...
 
def get_block_diagonal_basis_matrix (self, x, out_array=None, start_row=0, start_col=0)
 Gets the block diagonal basis matrix for the given phase value(s). More...
 
def get_block_diagonal_basis_matrix_derivative (self, x, out_array=None, start_row=0, start_col=0)
 Gets the block diagonal basis derivative matrix for the given phase value(s). More...
 
def get_weighted_vector_derivative (self, x, weights, out_array=None, start_row=0, start_col=0)
 Gets the weighted vector derivatives corresponding to this basis model for the given basis state. More...
 
def fit_basis_functions_linear_closed_form (self, x, y)
 Fits the given trajectory to this basis model via least squares. More...
 
def apply_coefficients (self, x, coefficients, deriv=False)
 Applies the given weights to this basis model. More...
 
def plot (self)
 
def plot_derivative (self)
 
def plot_weighted (self, coefficients, coefficient_names)
 
def observed_to_state_indices (self, observed_indices)
 
def observed_indices_related (self, observed_indices)
 

Public Attributes

 scale
 
- Public Attributes inherited from intprim.basis.basis_model.BasisModel
 observed_dof_names
 
 num_observed_dof
 
 block_prototype
 

Detailed Description

The PolynomialModel class implements a basis model consisting of Polynomial basis functions.

Constructor & Destructor Documentation

def intprim.basis.polynomial_model.PolynomialModel.__init__ (   self,
  degree,
  observed_dof_names,
  start_phase = 0.0,
  end_phase = 1.01 
)

Initializer method for PolynomialModel.

Parameters
degreeint The number of Sigmoid basis functions which will be uniformly distributed throughout the space.
observed_dof_namesarray-like, shape (num_observed_dof, ). The names of all observed degrees of freedom.
start_phasefloat The starting value from which the basis functions are uniformly distributed. The centers are calculated with linspace(start_phase, end_phase, degree).
end_phasefloat The ending value from which the basis functions are uniformly distributed. The centers are calculated with linspace(start_phase, end_phase, degree).
def intprim.basis.polynomial_model.PolynomialModel.__init__ (   self,
  degree,
  observed_dof_names,
  start_phase = 0.0,
  end_phase = 1.01 
)

Initializer method for PolynomialModel.

Parameters
degreeint The number of Sigmoid basis functions which will be uniformly distributed throughout the space.
observed_dof_namesarray-like, shape (num_observed_dof, ). The names of all observed degrees of freedom.
start_phasefloat The starting value from which the basis functions are uniformly distributed. The centers are calculated with linspace(start_phase, end_phase, degree).
end_phasefloat The ending value from which the basis functions are uniformly distributed. The centers are calculated with linspace(start_phase, end_phase, degree).

Member Function Documentation

def intprim.basis.polynomial_model.PolynomialModel.get_basis_function_derivatives (   self,
  x,
  degree = None 
)

Gets the evaluations for the derivative of the basis functions for the given phase value(s).

This is necessary for the computation of the Jacobian matrix in the EKF filter. Unlike get_basis_functions, this function does not (currently) implement a hash map internally and so re-computes values everytime. Since the basis decompositions are simple linear combinations, the partial derivative of the combination with respect to each weight is simply the partial derivative of a single basis function due to the sum rule.

This is the first order partial derivative with respect to x! It is used to compute the Jacobian matrix for filtering linear dynamical systems. Verified using wolfram alpha: d/dx a*(x-(1-x))^0 + b*(x-(1-x))^1 + c*(x-(1-x))^2 and d/dx a*(2x-1)^n

Parameters
xarray-like, shape(num_phase_values, ) or float. If array, a list of phase values for which to compute basis derivative values. Otherwise, a single scalar phase value.
degreeint. Degree of this basis model.
Returns
values array-like, shape(degree, num_phase_values) or array-like, shape(degree, ) if x is a scalar. The evaluated Polynomial basis function derivatives for the given phase value.
def intprim.basis.polynomial_model.PolynomialModel.get_basis_function_derivatives (   self,
  x,
  degree = None 
)

Gets the evaluations for the derivative of the basis functions for the given phase value(s).

This is necessary for the computation of the Jacobian matrix in the EKF filter. Unlike get_basis_functions, this function does not (currently) implement a hash map internally and so re-computes values everytime. Since the basis decompositions are simple linear combinations, the partial derivative of the combination with respect to each weight is simply the partial derivative of a single basis function due to the sum rule.

This is the first order partial derivative with respect to x! It is used to compute the Jacobian matrix for filtering linear dynamical systems. Verified using wolfram alpha: d/dx a*(x-(1-x))^0 + b*(x-(1-x))^1 + c*(x-(1-x))^2 and d/dx a*(2x-1)^n

Parameters
xarray-like, shape(num_phase_values, ) or float. If array, a list of phase values for which to compute basis derivative values. Otherwise, a single scalar phase value.
degreeint. Degree of this basis model.
Returns
values array-like, shape(degree, num_phase_values) or array-like, shape(degree, ) if x is a scalar. The evaluated Polynomial basis function derivatives for the given phase value.
def intprim.basis.polynomial_model.PolynomialModel.get_basis_functions (   self,
  x,
  degree = None 
)

Gets the basis function evaluations for the given phase value(s).

Essentially a vectorized wrapper to call get_basis_values for each phase value given.

Parameters
xarray-like, shape(num_phase_values, ) or float. If array, a list of phase values for which to compute basis values. Otherwise, a single scalar phase value.
degreeint. Degree of this basis model.
Returns
array-like, shape(degree, num_phase_values) or array-like, shape(degree, ) if x is a scalar. The evaluated Polynomial basis functions for the given phase value.
def intprim.basis.polynomial_model.PolynomialModel.get_basis_functions (   self,
  x,
  degree = None 
)

Gets the basis function evaluations for the given phase value(s).

Essentially a vectorized wrapper to call get_basis_values for each phase value given.

Parameters
xarray-like, shape(num_phase_values, ) or float. If array, a list of phase values for which to compute basis values. Otherwise, a single scalar phase value.
degreeint. Degree of this basis model.
Returns
array-like, shape(degree, num_phase_values) or array-like, shape(degree, ) if x is a scalar. The evaluated Polynomial basis functions for the given phase value.

The documentation for this class was generated from the following file: