Skip to content

Commit 126d354

Browse files
committed
Some documentation fixes
1 parent d753b05 commit 126d354

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

bayesflow/diagnostics.py

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def plot_recovery(
6262
https://betanalpha.github.io/assets/case_studies/principled_bayesian_workflow.html
6363
6464
Important: Posterior aggregates play no special role in Bayesian inference and should only
65-
be used heuristically. For instanec, in the case of multi-modal posteriors, common point
65+
be used heuristically. For instance, in the case of multi-modal posteriors, common point
6666
estimates, such as mean, (geometric) median, or maximum a posteriori (MAP) mean nothing.
6767
6868
Parameters
@@ -95,7 +95,7 @@ def plot_recovery(
9595
add_r2 : bool, optional, default: True
9696
A flag for adding R^2 between true and estimates to the plot
9797
color : str, optional, default: '#8f2727'
98-
The color for the true vs. estimated scatter points and errobars
98+
The color for the true vs. estimated scatter points and error bars
9999
100100
Returns
101101
-------
@@ -253,7 +253,7 @@ def plot_z_score_contraction(
253253
Toward a principled Bayesian workflow in cognitive science.
254254
Psychological methods, 26(1), 103.
255255
256-
Also available at https://arxiv.org/abs/1904.12765
256+
Paper also available at https://arxiv.org/abs/1904.12765
257257
258258
Parameters
259259
----------
@@ -272,7 +272,7 @@ def plot_z_score_contraction(
272272
tick_fontsize : int, optional, default: 12
273273
The font size of the axis ticklabels
274274
color : str, optional, default: '#8f2727'
275-
The color for the true vs. estimated scatter points and errobars
275+
The color for the true vs. estimated scatter points and error bars
276276
277277
Returns
278278
-------
@@ -887,7 +887,7 @@ def plot_losses(
887887
lw=lw_val,
888888
label="Validation",
889889
)
890-
# Schmuck
890+
# Schmuck
891891
ax.set_xlabel("Training step #", fontsize=label_fontsize)
892892
ax.set_ylabel("Loss value", fontsize=label_fontsize)
893893
sns.despine(ax=ax)
@@ -901,7 +901,7 @@ def plot_losses(
901901

902902

903903
def plot_prior2d(prior, param_names=None, n_samples=2000, height=2.5, color="#8f2727", **kwargs):
904-
"""Creates pairplots for a given joint prior.
904+
"""Creates pair-plots for a given joint prior.
905905
906906
Parameters
907907
----------
@@ -913,7 +913,7 @@ def plot_prior2d(prior, param_names=None, n_samples=2000, height=2.5, color="#8f
913913
The number of random draws from the joint prior
914914
height : float, optional, default: 2.5
915915
The height of the pair plot
916-
color : str, optional, defailt : '#8f2727'
916+
color : str, optional, default : '#8f2727'
917917
The color of the plot
918918
**kwargs : dict, optional
919919
Additional keyword arguments passed to the sns.PairGrid constructor
@@ -943,7 +943,9 @@ def plot_prior2d(prior, param_names=None, n_samples=2000, height=2.5, color="#8f
943943
# Generate plots
944944
g = sns.PairGrid(data_to_plot, height=height, **kwargs)
945945
g.map_diag(sns.histplot, fill=True, color=color, alpha=0.9, kde=True)
946-
# Kernel density estimation (KDE) may not always be possible (e.g. with parameters whose correlation is close to 1 or -1).
946+
947+
# Kernel density estimation (KDE) may not always be possible
948+
# (e.g. with parameters whose correlation is close to 1 or -1).
947949
# In this scenario, a scatter-plot is generated instead.
948950
try:
949951
g.map_lower(sns.kdeplot, fill=True, color=color, alpha=0.9)
@@ -962,7 +964,7 @@ def plot_prior2d(prior, param_names=None, n_samples=2000, height=2.5, color="#8f
962964

963965
def plot_latent_space_2d(z_samples, height=2.5, color="#8f2727", **kwargs):
964966
"""Creates pairplots for the latent space learned by the inference network. Enables
965-
visual inspection of the the latent space and whether its structrue corresponds to the
967+
visual inspection of the latent space and whether its structure corresponds to the
966968
one enforced by the optimization criterion.
967969
968970
Parameters
@@ -971,7 +973,7 @@ def plot_latent_space_2d(z_samples, height=2.5, color="#8f2727", **kwargs):
971973
The latent samples computed through a forward pass of the inference network.
972974
height : float, optional, default: 2.5
973975
The height of the pair plot.
974-
color : str, optional, defailt : '#8f2727'
976+
color : str, optional, default : '#8f2727'
975977
The color of the plot
976978
**kwargs : dict, optional
977979
Additional keyword arguments passed to the sns.PairGrid constructor
@@ -1235,32 +1237,31 @@ def plot_mmd_hypothesis_test(
12351237
12361238
Parameters
12371239
----------
1238-
mmd_null: np.ndarray
1239-
samples from the MMD sampling distribution under the null hypothesis "the model is well-specified"
1240-
mmd_observed: float
1241-
observed MMD value
1242-
alpha_level: float
1243-
rejection probability (type I error)
1244-
null_color: color
1245-
color for the H0 sampling distribution
1246-
observed_color: color
1247-
color for the observed MMD
1248-
alpha_color: color
1249-
color for the rejection area
1240+
mmd_null : np.ndarray
1241+
The samples from the MMD sampling distribution under the null hypothesis "the model is well-specified"
1242+
mmd_observed : float
1243+
The observed MMD value
1244+
alpha_level : float
1245+
The rejection probability (type I error)
1246+
null_color : str or tuple
1247+
The color of the H0 sampling distribution
1248+
observed_color : str or tuple
1249+
The color of the observed MMD
1250+
alpha_color : str or tuple
1251+
The color of the rejection area
12501252
truncate_vlines_at_kde: bool
12511253
true: cut off the vlines at the kde
12521254
false: continue kde lines across the plot
1253-
xmin: float
1254-
lower x axis limit
1255-
xmax: float
1256-
upper x axis limit
1257-
bw_factor: float, default: 1.5
1255+
xmin : float
1256+
The lower x-axis limit
1257+
xmax : float
1258+
The upper x-axis limit
1259+
bw_factor : float, optional, default: 1.5
12581260
bandwidth (aka. smoothing parameter) of the kernel density estimate
12591261
12601262
Returns
12611263
-------
12621264
f : plt.Figure - the figure instance for optional saving
1263-
12641265
"""
12651266

12661267
def draw_vline_to_kde(x, kde_object, color, label=None, **kwargs):

0 commit comments

Comments
 (0)