src.model.deeplearn.handle.dl_model_reporter
Classes
Class to handle plots and reports for deep learning models. |
- class src.model.deeplearn.handle.dl_model_reporter.DLModelReporter
Class to handle plots and reports for deep learning models. Note that the plots and reports that are responsibility of this handler are those involved in the operations directly handled by a
DLModelHandleror any derived class like theSimpleDLModelHandler.- __init__()
- handle_model_summary_report(mh)
Write the model’s summary and also print it through logging system.
This method requires that the model has been compiled so the summary is available.
- Parameters:
mh – The model handler whose model’s summary must be reported.
- Returns:
Nothing at all.
- static export_training_history(history, training_history_dir, out_prefix=None)
Export training history as a CSV report and plots.
- Parameters:
history (
keras.callbacks.History) – Keras training history object.training_history_dir (str) – Directory where the report and plots will be written.
out_prefix (str or None) – Output prefix for
*path expansion (optional).
- handle_history_plots_and_reports(mh)
Handle the generation of plots and reports from the training history of the given model handler.
Delegates to
export_training_history().- Parameters:
mh – The model handler whose training history must be handled.
- handle_receptive_fields_plots_and_reports(mh, X_rf, X=None, y=None)
Handle the plot and reports related to receptive fields including the decision on whether they must be plotted. This method also computes the necessary data (e.g., the model’s probabilities). Note that this method must only be called during fit. To plot and report the data of the receptive fields call the
DLModelReporter.do_receptive_fields_plots_and_reports()method directly.- Parameters:
mh (
DLModelHandler) – The model handler whose receptive fields’ plots and reports must be done.X_rf – The input for the model as computed by the model’s pre-processor.
X – The structure space representing the original point cloud (not the receptive fields).
y (
np.ndarray) – The vector of expected labels, the ground-truth from the supervised training perspective.
- Returns:
Nothing at all.
- do_receptive_fields_plots_and_reports(mh, X_rf, zhat_rf, X=None, y=None, training=False)
Do any plot and reports related to the receptive fields when handling a deep learning model.
- Parameters:
mh (
DLModelHandler) – The model handler whose receptive fields’ plots and reports must be done.X_rf (
np.ndarray) – The receptive fields such that X_rf[i] is the matrix of coordinates representing the points in the i-th receptive field.zhat_rf (
np.ndarray) – The output from the neural network for each receptive field.X (
np.ndarrayor None) – The structure space representing the original input point cloud (i.e., not each receptive field). It is not always used, but sometimes it is necessary, e.g., to reduce labels when using aSpConv3DPwiseClassifarchitecture.y (
np.ndarray) – The expected class for each point (considering original points, i.e., not the receptive fields).training (bool) – Whether the considered receptive fields are those used for training (True) or not (False).
- Returns:
Nothing at all but the plots and reports are exported to the corresponding files.
- static prepare_receptive_fields(mh, X_rf)
Prepare the receptive fields for the generation of plots and reports (see
DLModelReporter.do_receptive_fields_plots_and_reports()) depending on the underlying model.- Parameters:
mh – The model handler.
X_rf – The original receptive field data.
- Returns:
The prepared receptive field data as a tuple where the first element gives the structure space (point-wise coordinates) and the second gives the feature space (point-wise features).
- Return type:
tuple