plot
startorch.plot.matplotlib ¶
Contain functions to plot the generated data with matplotlib
.
startorch.plot.matplotlib.hist_feature ¶
hist_feature(
features: Tensor | ndarray,
feature_names: Sequence[str] | None = None,
ncols: int = 2,
figsize: tuple[float, float] = (6, 4),
**kwargs: Any
) -> Figure
Plot the distribution of each feature.
If the input has n
features, this function returns a figure
with n
histograms: one for each features.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
features |
Tensor | ndarray
|
The features. It must be a tensor of shape
|
required |
feature_names |
Sequence[str] | None
|
The feature names. If |
None
|
ncols |
int
|
The number of columns. |
2
|
figsize |
tuple[float, float]
|
The individual figure size in pixels. The first dimension is the width and the second is the height. |
(6, 4)
|
**kwargs |
Any
|
Additional keyword arguments for |
{}
|
Returns:
Type | Description |
---|---|
Figure
|
|
Raises:
Type | Description |
---|---|
RuntimeError
|
if the |
RuntimeError
|
if |
Example usage:
>>> from startorch.plot.matplotlib import hist_feature
>>> import numpy as np
>>> fig = hist_feature(np.random.rand(10, 5))
startorch.plot.matplotlib.hist_sequence ¶
hist_sequence(
sequence: BaseSequenceGenerator,
bins: int = 500,
seq_len: int = 1000,
batch_size: int = 10000,
num_batches: int = 1,
rng: int | Generator = 13683624337160779813,
figsize: tuple[float, float] = (16, 5),
scale: str = "identity",
**kwargs: Any
) -> Figure
Plot the distribution from a sequence generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
BaseSequenceGenerator
|
The sequence generator. |
required |
bins |
int
|
The number of histogram bins. |
500
|
seq_len |
int
|
The sequence length. |
1000
|
batch_size |
int
|
The batch size. |
10000
|
num_batches |
int
|
The number of batches to generate. |
1
|
rng |
int | Generator
|
A random number generator or a random seed. |
13683624337160779813
|
figsize |
tuple[float, float]
|
The figure size. |
(16, 5)
|
scale |
str
|
The transformation scale of the features. |
'identity'
|
**kwargs |
Any
|
Additional keyword arguments for |
{}
|
Returns:
Type | Description |
---|---|
Figure
|
The generated figure. |
Example usage:
>>> from startorch.plot.matplotlib import hist_sequence
>>> from startorch.sequence import RandUniform
>>> fig = hist_sequence(RandUniform(low=-5, high=5))
startorch.plot.matplotlib.plot_sequence ¶
plot_sequence(
sequence: BaseSequenceGenerator,
seq_len: int = 128,
batch_size: int = 1,
num_batches: int = 1,
rng: int | Generator = 13683624337160779813,
figsize: tuple[float, float] = (16, 5),
xscale: str = "linear",
yscale: str = "linear",
**kwargs: Any
) -> Figure
Plot some sequences generated from a sequence generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
BaseSequenceGenerator
|
The sequence generator. |
required |
seq_len |
int
|
The sequence length. |
128
|
batch_size |
int
|
The batch size. |
1
|
num_batches |
int
|
The number of batches. |
1
|
rng |
int | Generator
|
A random number generator or a random seed. |
13683624337160779813
|
figsize |
tuple[float, float]
|
The figure size. |
(16, 5)
|
xscale |
str
|
The x-axis scale. |
'linear'
|
yscale |
str
|
The y-axis scale. |
'linear'
|
**kwargs |
Any
|
Additional keyword arguments for |
{}
|
Returns:
Type | Description |
---|---|
Figure
|
The generated figure. |
Example usage:
>>> from startorch.plot.matplotlib import plot_sequence
>>> from startorch.sequence import RandUniform
>>> fig = plot_sequence(RandUniform(low=-5, high=5), batch_size=4)
startorch.plot.plotly ¶
Contain functions to plot the generated data with plotly
.
startorch.plot.plotly.hist_feature ¶
hist_feature(
features: Tensor | ndarray,
feature_names: Sequence[str] | None = None,
ncols: int = 2,
figsize: tuple[int, int] = (250, 200),
**kwargs: Any
) -> Figure
Plot the distribution of each feature.
If the input has n
features, this function returns a figure
with n
histograms: one for each feature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
features |
Tensor | ndarray
|
The features. It must be a tensor of shape
|
required |
feature_names |
Sequence[str] | None
|
The feature names. If |
None
|
ncols |
int
|
The number of columns. |
2
|
figsize |
tuple[int, int]
|
The individual figure size in pixels. The first dimension is the width and the second is the height. |
(250, 200)
|
**kwargs |
Any
|
Additional keyword arguments for
|
{}
|
Returns:
Type | Description |
---|---|
Figure
|
The generated figure. |
Raises:
Type | Description |
---|---|
RuntimeError
|
if the |
RuntimeError
|
if |
Example usage:
>>> from startorch.plot.plotly import hist_feature
>>> import numpy as np
>>> fig = hist_feature(np.random.rand(10, 5))
startorch.plot.plotly.hist_sequence ¶
hist_sequence(
sequence: BaseSequenceGenerator,
bins: int = 500,
seq_len: int = 1000,
batch_size: int = 10000,
num_batches: int = 1,
rng: int | Generator = 13683624337160779813,
figsize: tuple[int, int] = (800, 600),
scale: str = "identity",
**kwargs: Any
) -> Figure
Plot the distribution from a sequence generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
BaseSequenceGenerator
|
The sequence generator. |
required |
bins |
int
|
The number of histogram bins. |
500
|
seq_len |
int
|
The sequence length. |
1000
|
batch_size |
int
|
The batch size. |
10000
|
num_batches |
int
|
The number of batches to generate. |
1
|
rng |
int | Generator
|
A random number generator or a random seed. |
13683624337160779813
|
figsize |
tuple[int, int]
|
The figure size. |
(800, 600)
|
scale |
str
|
A scale transformation of the features. |
'identity'
|
**kwargs |
Any
|
Additional keyword arguments for
|
{}
|
Returns:
Type | Description |
---|---|
Figure
|
The generated figure. |
Example usage:
>>> from startorch.plot.plotly import hist_sequence
>>> from startorch.sequence import RandUniform
>>> fig = hist_sequence(RandUniform(low=-5, high=5))
startorch.plot.plotly.plot_sequence ¶
plot_sequence(
sequence: BaseSequenceGenerator,
seq_len: int = 128,
batch_size: int = 1,
num_batches: int = 1,
rng: int | Generator = 13683624337160779813,
**kwargs: Any
) -> Figure
Plot some sequences generated from a sequence generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
BaseSequenceGenerator
|
The sequence generator. |
required |
seq_len |
int
|
The sequence length. |
128
|
batch_size |
int
|
The batch size. |
1
|
num_batches |
int
|
The number of batches. |
1
|
rng |
int | Generator
|
A random number generator or a random seed. |
13683624337160779813
|
**kwargs |
Any
|
Additional keyword arguments for |
{}
|
Returns:
Type | Description |
---|---|
Figure
|
The generated figure. |
Example usage:
>>> from startorch.plot.plotly import plot_sequence
>>> from startorch.sequence import RandUniform
>>> fig = plot_sequence(RandUniform(low=-5, high=5), batch_size=4)