More plotting utilities
plot_history(history, to_file='training_history.png', to_folder=None, xlabel='Epochs', ylabel='Scores', title='Training history', grid=True, **kwargs)
Plots the training history of a program and saves it to a file.
Code Example:
Example:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
history
|
History
|
The training history. |
required |
to_file
|
str
|
The file path where the plot will be saved. Default to "training_history.png". |
'training_history.png'
|
xlabel
|
str
|
Optional. The label for the x-axis. Default to "Epochs". |
'Epochs'
|
ylabel
|
str
|
Optional. The label for the y-axis. Default to "Scores". |
'Scores'
|
title
|
str
|
Optional. The title of the plot. Default to "Training history". |
'Training history'
|
grid
|
bool
|
Whether to display the grid on the plot. Default to True. |
True
|
**kwargs
|
keyword arguments
|
Addtional keyword arguments
forwarded to |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
If there are unrecognized keyword arguments. |
Returns:
Type | Description |
---|---|
Image | Image | str
|
If running in a Jupyter notebook, returns an IPython Image object for inline display. If running in a Marimo notebook returns a marimo image. Otherwise returns the filepath where the image have been saved. |
Source code in synalinks/src/utils/plot_history.py
plot_metrics(metrics, to_file='evaluation_metrics.png', to_folder=None, xlabel='Metrics', ylabel='Scores', title='Evaluation metrics', grid=True, **kwargs)
Plots the evaluation metrics of a program and saves it to a file.
Code Example:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metrics
|
dict
|
The metrics from a program evaluation. |
required |
to_file
|
str
|
The file path where the plot will be saved. Default to "evaluation_metrics.png". |
'evaluation_metrics.png'
|
xlabel
|
str
|
Optional. The label for the x-axis. Default to "Metrics". |
'Metrics'
|
ylabel
|
str
|
Optional. The label for the y-axis. Default to "Scores". |
'Scores'
|
title
|
str
|
Optional. The title of the plot. Default to "Evaluation metrics". |
'Evaluation metrics'
|
grid
|
bool
|
Whether to display the grid on the plot. Default to True. |
True
|
**kwargs
|
keyword arguments
|
Addtional keyword arguments
forwarded to |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
If there are unrecognized keyword arguments. |
Returns:
Type | Description |
---|---|
Image | Image | str
|
If running in a Jupyter notebook, returns an IPython Image object for inline display. If running in a Marimo notebook returns a marimo image. Otherwise returns the filepath where the image have been saved. |