bsmplutils module¶
A Matplotlib utility program:
ax_text
: annotate anax
with text.bs_mpl_plot_dcm_fit
: generates a boxplot of the predicted probas for a discrete choice model
ax_text(ax, str_txt, x, y)
¶
Annotate an ax
with text in Matplotlib.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ax |
Axes
|
the axis we want to annotate |
required |
str_txt |
str
|
a string of text |
required |
x |
float
|
position in fraction of horizontal axis |
required |
y |
float
|
position in fraction of vertical axis |
required |
Returns:
Type | Description |
---|---|
Axes
|
the nnotated |
Source code in bs_python_utils/bsmplutils.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
bs_mpl_plot_dcm_fit(y_true, probhat, max_cols=4, save_to=None)
¶
generates a boxplot of the predicted probas for a discrete choice model by the actual value of the variable \(y\).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y_true |
ndarray
|
an |
required |
probhat |
ndarray
|
the predicted probas for the values of \(y\) |
required |
max_cols |
int
|
the maximum number of columns in the plot. Defaults to 4. |
4
|
save_to |
str | None
|
(maybe) where we save the plot, with |
None
|
Returns:
Type | Description |
---|---|
None
|
nothing. |
Source code in bs_python_utils/bsmplutils.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|