Database

Module for the snapshots database collected during the Offline stage.

Database

Database class

Database.parameters

Database.snapshots

Database.__getitem__

This method returns a new Database with the selected parameters and snapshots.

Database.__len__

This method returns the number of snapshots.

Database.add

Add (by row) new sets of snapshots and parameters to the original database.

class Database(parameters=None, snapshots=None)[source]

Bases: object

Database class

Parameters
  • parameters (array_like) – the input parameters

  • snapshots (array_like) – the input snapshots

  • scaler_parameters (Scale) – the scaler for the parameters. Default is None meaning no scaling.

  • scaler_snapshots (Scale) – the scaler for the snapshots. Default is None meaning no scaling.

  • space (array_like) – the input spatial data

add(parameter, snapshot)[source]

Add (by row) new sets of snapshots and parameters to the original database.

Parameters
  • parameter (Parameter) – the parameter to add.

  • snapshot (Snapshot) – the snapshot to add.

property parameters_matrix

The matrix containing the input parameters (by row).

Return type

numpy.ndarray

property snapshots_matrix

The matrix containing the snapshots (by row).

Return type

numpy.ndarray

split(chunks, seed=None)[source]
>>> db = Database(...)
>>> train, test = db.split([0.8, 0.2]) # ratio
>>> train, test = db.split([80, 20])   # n snapshots