Manager
DataManager
- class DataManager.DataManager(pipeline: Any, database_config: Optional[BaseDatabaseConfig] = None, environment_config: Optional[BaseEnvironmentConfig] = None, session: str = 'sessions/default', new_session: bool = True, produce_data: bool = True, batch_size: int = 1)[source]
-
- connect_handler(handler: DatabaseHandler) None [source]
Add a new DatabaseHandler to the list of handlers of the DatabaseManager.
- Parameters
handler – New handler to register.
- get_data(epoch: int = 0, animate: bool = True, load_samples: bool = True) None [source]
Fetch data from the EnvironmentManager or the DatabaseManager according to the context.
- Parameters
epoch – Current epoch number.
animate – Allow EnvironmentManager to trigger a step itself in order to generate a new sample.
load_samples – If True, trigger a sample loading from the Database.
- get_prediction(instance_id: int) None [source]
Get a Network prediction for the specified Environment instance.
- load_sample() List[int] [source]
Load a sample from the Database.
- Returns
Index of the loaded line.
DatabaseManager
- class DatabaseManager.DatabaseManager(database_config: Optional[BaseDatabaseConfig] = None, data_manager: Optional[Any] = None, pipeline: str = '', session: str = 'sessions/default', new_session: bool = True, produce_data: bool = True)[source]
- add_data(data_lines: Optional[List[int]] = None) None [source]
Manage new lines adding in the Database.
- Parameters
data_lines – Indices of the newly added lines.
- change_mode(mode: str) None [source]
Change the current Database mode.
- Parameters
mode – Name of the Database mode.
- compute_normalization() Dict[str, List[float]] [source]
Compute the mean and the standard deviation of all the training samples for each data field.
- connect_handler(handler: DatabaseHandler) None [source]
Add and init a new DatabaseHandler to the list.
- Parameters
handler – New DatabaseHandler.
- get_data(batch_size: int) List[List[int]] [source]
Select a batch of indices to read in the Database.
- Parameters
batch_size – Number of sample in a single batch.
- get_database_architecture() Dict[str, List[str]] [source]
Get the Tables and Fields structure of the Database.
- get_partition_names() List[List[str]] [source]
Get the list of partition paths of the Database for the current mode.
- get_partition_objects() List[Database] [source]
Get the list of partitions of the Database for the current mode.
- index_samples() None [source]
Create a new indexing list of samples. Samples are identified by [partition_id, line_id].
- load_directory(rename_partitions: bool = False) None [source]
Get the Database information from the json file (partitions, samples, etc). Load all the partitions or create one if necessary.
- Parameters
rename_partitions – If True, the existing partitions should be renamed to match the session name.
- static load_partitions_fields(partition: Database, fields: List[str]) Dict[str, ndarray] [source]
Load all the samples from a Field of a Table in the Database.
- Parameters
partition – Database partition to load.
fields – Data Fields to get.
EnvironmentManager
NetworkManager
- class NetworkManager.NetworkManager(network_config: BaseNetworkConfig, pipeline: str = '', session: str = 'sessions/default', new_session: bool = True)[source]
-
- compute_online_prediction(instance_id: int, normalization: Optional[Dict[str, List[float]]] = None) None [source]
Make a prediction with the data passed as argument.
- Parameters
instance_id – Index of the Environment instance to provide a prediction.
normalization – Normalization coefficients.
- compute_prediction_and_loss(optimize: bool, data_lines: List[List[int]], normalization: Optional[Dict[str, List[float]]] = None) Dict[str, float] [source]
Make a prediction with the data passed as argument, optimize or not the network
- Parameters
optimize – If true, run a backward propagation.
data_lines – Batch of indices of samples in the Database.
normalization – Normalization coefficients.
- Returns
The prediction and the associated loss value
- link_clients(nb_clients: Optional[int] = None) None [source]
Update the data Exchange Database with a new line for each TcpIpClient.
- Parameters
nb_clients – Number of Clients to connect.
- load_network(which_network: int = -1) None [source]
Load an existing set of parameters of the Network.
- Parameters
which_network – If several sets of parameters were saved, specify which one to load.
- classmethod normalize_data(data: ndarray, normalization: List[float], reverse: bool = False) ndarray [source]
Apply or unapply normalization following current standard score.
- Parameters
data – Data to normalize.
normalization – Normalization coefficients.
reverse – If True, apply normalization; if False, unapply normalization.
- Returns
Data with applied or misapplied normalization.
StatsManager
- class StatsManager.StatsManager(session: str, keep_losses: bool = False)[source]
- add_3D_mesh(tag: str, vertices: ndarray, colors: Optional[ndarray] = None, faces: Optional[ndarray] = None, b_n_3: bool = False, config_dict: Optional[Dict[Any, Any]] = None) None [source]
Add 3D Mesh cloud to tensorboard framework.
- Parameters
tag (str) – Data identifier
vertices (ndarray) – List of the 3D coordinates of vertices.
colors (Optional[ndarray]) – Colors for each vertex
faces (Optional[ndarray]) – Indices of vertices within each triangle.
b_n_3 (bool) – Data is in the format [batch_size, number_of_nodes, 3]
config_dict (Optional[Dict[Any, Any]]) – Dictionary with ThreeJS classes names and configuration.
- add_3D_point_cloud(tag: str, vertices: ndarray, colors: Optional[ndarray] = None, b_n_3: bool = False, config_dict: Optional[Dict[Any, Any]] = None) None [source]
Add 3D point cloud to tensorboard framework
- Parameters
tag (str) – Data identifier
vertices (DataContainer) – List of the 3D coordinates of vertices.
colors (DataContainer) – Colors for each vertex
b_n_3 (bool) – Data is in the format [batch_size, number_of_nodes, 3]
config_dict (Optional[Dict[Any, Any]]) – Dictionary with ThreeJS classes names and configuration.
- add_custom_scalar(tag: str, value: float, count: int) None [source]
Add a custom scalar to tensorboard framework.
- add_custom_scalar_full(tag: str, value: float, count: int) None [source]
Add a custom scalar to tensorboard framework. Also compute mean and variance.
- add_network_weight_grad(network: Any, count: int, save_weights: bool = False, save_gradients: bool = True) None [source]
Add network weights and gradiant if specified to tensorboard framework.
- Parameters
network (BaseNetwork) – Network you want to display
count (int) – ID of the sample
save_weights (bool) – If True will save weights to tensorboard
save_gradients (bool) – If True will save gradient to tensorboard
- add_test_loss(value: float, count: int) None [source]
Add test loss to tensorboard framework. Also compute mean and variance.
- add_test_loss_OOB(value: float, count: int) None [source]
Add out of bound test loss to tensorboard framework. Also compute mean and variance.
- add_train_batch_loss(value: float, count: int) None [source]
Add batch loss to tensorboard framework. Also compute mean and variance.
- add_train_epoch_loss(value: float, count: int) None [source]
Add epoch loss to tensorboard framework. Also compute mean and variance.
- add_train_test_batch_loss(train_value: float, test_value: float, count: int) None [source]
Add train and test batch loss to tensorboard framework.
- add_values_multi_plot(graph_name: str, tags: Iterable, values: Iterable, counts: Iterable) None [source]
Plot multiples value on the same graph
- Parameters
graph_name (str) – Name of the graph
tags (Iterable) – Iterable containing the names of the values
values (Iterable) – Iterable containing the value
counts (Iterable) – ID of the plots