Mixins
Mixins to support the plotting and slicing of the distribution parameters. They are only required for creating new distributions or for understanding the internals.
ContinuousPlotDistMixin
Bases: PlotDistMixin
Functionality for plot_pdf method of continuous distributions.
Source code in conjugate/plot.py
plot_cdf(ax=None, **kwargs)
Plot the CDF of distribution
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax
|
Axes | None
|
matplotlib Axes, optional |
None
|
**kwargs
|
Additonal kwargs to pass to matplotlib |
{}
|
Returns:
Type | Description |
---|---|
Axes
|
new or modified Axes |
Raises:
Type | Description |
---|---|
ValueError
|
If the max_value is not set. |
Source code in conjugate/plot.py
plot_pdf(ax=None, **kwargs)
Plot the PDF of distribution
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax
|
Axes | None
|
matplotlib Axes, optional |
None
|
**kwargs
|
Additonal kwargs to pass to matplotlib |
{}
|
Returns:
Type | Description |
---|---|
Axes
|
new or modified Axes |
Raises:
Type | Description |
---|---|
ValueError
|
If the max_value is not set. |
Source code in conjugate/plot.py
DirichletPlotDistMixin
Bases: ContinuousPlotDistMixin
Plot the pdf using samples from the dirichlet distribution.
Source code in conjugate/plot.py
plot_pdf(ax=None, samples=1000, random_state=None, **kwargs)
Plots the pdf by sampling from the distribution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax
|
Axes | None
|
matplotlib Axes, optional |
None
|
samples
|
int
|
number of samples to take from the distribution |
1000
|
random_state
|
random state to use for sampling |
None
|
|
**kwargs
|
Additonal kwargs to pass to matplotlib |
{}
|
Returns:
Type | Description |
---|---|
Axes
|
new or modified Axes |
Source code in conjugate/plot.py
DiscretePlotMixin
Bases: PlotDistMixin
Adding the plot_pmf method to class.
Source code in conjugate/plot.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
|
plot_cdf(ax=None, mark='o-', conditional=False, **kwargs)
Plot the CDF of distribution
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax
|
Axes | None
|
matplotlib Axes, optional |
None
|
mark
|
str
|
matplotlib line style |
'o-'
|
conditional
|
bool
|
If True, plot the conditional probability given the bounds. |
False
|
**kwargs
|
Additonal kwargs to pass to matplotlib |
{}
|
Returns:
Type | Description |
---|---|
Axes
|
new or modified Axes |
Raises:
Type | Description |
---|---|
ValueError
|
If the max_value is not set. |
Source code in conjugate/plot.py
plot_pmf(ax=None, mark='o-', conditional=False, **kwargs)
Plot the PMF of distribution
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax
|
Axes | None
|
matplotlib Axes, optional |
None
|
mark
|
str
|
matplotlib line style |
'o-'
|
conditional
|
bool
|
If True, plot the conditional probability given the bounds. |
False
|
**kwargs
|
Additonal kwargs to pass to matplotlib |
{}
|
Returns:
Type | Description |
---|---|
Axes
|
new or modified Axes |
Raises:
Type | Description |
---|---|
ValueError
|
If the max_value is not set. |
Source code in conjugate/plot.py
PlotDistMixin
Base mixin in order to support plotting. Requires the dist attribute of the scipy distribution.
Source code in conjugate/plot.py
set_bounds(lower, upper)
resolve_label(label, yy)
https://stackoverflow.com/questions/73662931/matplotlib-plot-a-numpy-array-as-many-lines-with-a-single-label
Source code in conjugate/plot.py
SliceMixin
Mixin in order to slice the parameters