pysensors.optimizers package

Module contents

class pysensors.optimizers.CCQR(sensor_costs=None)[source]

Bases: QR

Greedy cost-constrained QR optimizer for sensor selection. This algorithm augments the pivot selection criteria used in the QR algorithm (with householder reflectors) to take into account costs associated with each sensors. It is similar to the pysensors.optimizers.QR algorithm in that it returns an array of sensor locations ranked by importance, but with a definition of importance that takes sensor costs into account.

Parameters

sensor_costs (np.ndarray, shape [n_features,], optional (default None)) – Costs (weights) associated with each sensor. Positive values will encourage sensors to be avoided and negative values will cause them to be preferred. If None, costs will all be set to zero.

Attributes

pivots_ (np.ndarray, shape [n_features]) – Ranked list of sensor locations.

fit(basis_matrix)[source]
Parameters
  • basis_matrix (np.ndarray, shape [n_features, n_samples]) – Matrix whose columns are the basis vectors in which to represent the measurement data.

  • optimizer_kws (dictionary, optional) – Keyword arguments to be passed to the qr method.

Returns

self

Return type

a fitted pysensors.optimizers.CCQR instance

class pysensors.optimizers.QR[source]

Bases: BaseEstimator

Attributes

pivots_ (np.ndarray, shape [n_features]) – Ranked list of sensor locations.

fit(basis_matrix, **optimizer_kws)[source]
Parameters
  • basis_matrix (np.ndarray, shape [n_features, n_samples]) – Matrix whose columns are the basis vectors in which to represent the measurement data.

  • optimizer_kws (dictionary, optional) – Keyword arguments to be passed to the qr method.

get_sensors()[source]

Get ranked array of sensors.

Returns

sensors – Array of sensors ranked in descending order of importance. Note that if n_features exceeds n_samples, then only the first n_samples entries of sensors are guaranteed to be in ranked order.

Return type

np.ndarray, shape [n_features,]

class pysensors.optimizers.GQR[source]

Bases: QR

Attributes
  • pivots_ (np.ndarray, shape [n_features]) – Ranked list of sensor locations.

  • idx_constrained (np.ndarray, shape [No. of constrained locations]) – Column Indices of the sensors in the constrained locations.

  • n_sensors (integer,) – Total number of sensors

  • n_const_sensors (integer,) – Total number of sensors required by the user in the constrained region.

  • all_sensors (np.ndarray, shape [n_features]) – Optimally placed list of sensors obtained from QR pivoting algorithm.

  • constraint_option (string,) – max_n_const_sensors : The number of sensors in the constrained region should be less than or equal to n_const_sensors. exact_n_const_sensors : The number of sensors in the constrained region should be exactly equal to n_const_sensors.

fit(basis_matrix, **optimizer_kws)[source]
Parameters
  • basis_matrix (np.ndarray, shape [n_features, n_samples]) – Matrix whose columns are the basis vectors in which to represent the measurement data.

  • optimizer_kws (dictionary, optional) – Keyword arguments to be passed to the qr method.

Returns

self

Return type

a fitted pysensors.optimizers.GQR instance