You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/fundamentals/data_container.ipynb
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -715,7 +715,7 @@
715
715
"cell_type": "markdown",
716
716
"metadata": {},
717
717
"source": [
718
-
"In this next model, we create a `pm.Data` container to hold the observations, and pass this container to the `observed`. We also make a `pm.Data` container to hold the `x` data:"
718
+
"In this next model, we create a {class}`pymc.Data` container to hold the observations, and pass this container to the `observed`. We also make a {class}`pymc.Data` container to hold the `x` data:"
719
719
]
720
720
},
721
721
{
@@ -793,7 +793,7 @@
793
793
"cell_type": "markdown",
794
794
"metadata": {},
795
795
"source": [
796
-
"Because we used a `pm.Data` container, the data now appears in our probabilistic graph. It is downstream from `obs` (since the `obs` variable \"causes\" the data), shaded in gray (because it is observed), and has a special rounded square shape to emphasize that it is data. We also see that `x_data` has been added to the graph."
796
+
"Because we used a {class}`pymc.Data` container, the data now appears in our probabilistic graph. It is downstream from `obs` (since the `obs` variable \"causes\" the data), shaded in gray (because it is observed), and has a special rounded square shape to emphasize that it is data. We also see that `x_data` has been added to the graph."
797
797
]
798
798
},
799
799
{
@@ -1509,7 +1509,7 @@
1509
1509
"cell_type": "markdown",
1510
1510
"metadata": {},
1511
1511
"source": [
1512
-
"As noted above, `pm.Data` gives you the ability to give named labels to the dimensions of your data. This is done by passing a dictionary of `dimension: coordinate` key-value pairs to the `coords` argument of {class}`pymc.Model` when you create your model.\n",
1512
+
"As noted above, {class}`pymc.Data` gives you the ability to give named labels to the dimensions of your data. This is done by passing a dictionary of `dimension: coordinate` key-value pairs to the `coords` argument of {class}`pymc.Model` when you create your model.\n",
1513
1513
"\n",
1514
1514
"For more explanation about dimensions, coordinates and their big benefits, we encourage you to take a look at the {ref}`ArviZ documentation <arviz:xarray_for_arviz>`.\n",
1515
1515
"\n",
@@ -1826,7 +1826,7 @@
1826
1826
"cell_type": "markdown",
1827
1827
"metadata": {},
1828
1828
"source": [
1829
-
"When we use `pm.Data`, the data are internally represented as a pytensor {class}`pytensor.tensor.sharedvar.TensorSharedVariable`."
1829
+
"When we use {class}`pymc.Data`, the data are internally represented as a pytensor {class}`pytensor.tensor.sharedvar.TensorSharedVariable`."
1830
1830
]
1831
1831
},
1832
1832
{
@@ -2527,7 +2527,7 @@
2527
2527
"\n",
2528
2528
"One small detail to pay attention to in this case is that the shapes of the input data (`x`) and output data (`obs`) must be the same. When we make out-of-sample predictions, we typically change only the input data, the shape of which may not be the same as the training observations. Naively changing only one will result in a shape error. There are two solutions:\n",
2529
2529
"\n",
2530
-
"1. Use a `pm.Data` for the `x` data and the `y` data, and use `pm.set_data` to change `y` to something of the same shape as the test inputs. \n",
2530
+
"1. Use a {class}`pymc.Data` for the `x` data and the `y` data, and use `pm.set_data` to change `y` to something of the same shape as the test inputs. \n",
2531
2531
"2. Tell PyMC that the shape of the `obs` should always be the shape of the input data.\n",
2532
2532
"\n",
2533
2533
"In the next model, we use option 2. This way, we don't need to pass dummy data to `y` every time we want to change `x`."
Copy file name to clipboardExpand all lines: examples/fundamentals/data_container.myst.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,7 +95,7 @@ Furthermore, inside `idata`, PyMC has automatically saved the observed (endogeno
95
95
idata.observed_data
96
96
```
97
97
98
-
In this next model, we create a `pm.Data` container to hold the observations, and pass this container to the `observed`. We also make a `pm.Data` container to hold the `x` data:
98
+
In this next model, we create a {class}`pymc.Data` container to hold the observations, and pass this container to the `observed`. We also make a {class}`pymc.Data` container to hold the `x` data:
99
99
100
100
```{code-cell} ipython3
101
101
with pm.Model() as no_data_model:
@@ -108,7 +108,7 @@ with pm.Model() as no_data_model:
108
108
idata = pm.sample(random_seed=RANDOM_SEED)
109
109
```
110
110
111
-
Because we used a `pm.Data` container, the data now appears in our probabilistic graph. It is downstream from `obs` (since the `obs` variable "causes" the data), shaded in gray (because it is observed), and has a special rounded square shape to emphasize that it is data. We also see that `x_data` has been added to the graph.
111
+
Because we used a {class}`pymc.Data` container, the data now appears in our probabilistic graph. It is downstream from `obs` (since the `obs` variable "causes" the data), shaded in gray (because it is observed), and has a special rounded square shape to emphasize that it is data. We also see that `x_data` has been added to the graph.
112
112
113
113
```{code-cell} ipython3
114
114
pm.model_to_graphviz(no_data_model)
@@ -138,7 +138,7 @@ df_data.index.name = "date"
138
138
df_data.head()
139
139
```
140
140
141
-
As noted above, `pm.Data` gives you the ability to give named labels to the dimensions of your data. This is done by passing a dictionary of `dimension: coordinate` key-value pairs to the `coords` argument of {class}`pymc.Model` when you create your model.
141
+
As noted above, {class}`pymc.Data` gives you the ability to give named labels to the dimensions of your data. This is done by passing a dictionary of `dimension: coordinate` key-value pairs to the `coords` argument of {class}`pymc.Model` when you create your model.
142
142
143
143
For more explanation about dimensions, coordinates and their big benefits, we encourage you to take a look at the {ref}`ArviZ documentation <arviz:xarray_for_arviz>`.
144
144
@@ -193,7 +193,7 @@ Coordinates are also used by `arviz` when making plots. Here we pass `legend=Tru
When we use `pm.Data`, the data are internally represented as a pytensor {class}`pytensor.tensor.sharedvar.TensorSharedVariable`.
196
+
When we use {class}`pymc.Data`, the data are internally represented as a pytensor {class}`pytensor.tensor.sharedvar.TensorSharedVariable`.
197
197
198
198
```{code-cell} ipython3
199
199
type(data)
@@ -277,7 +277,7 @@ A common task in machine learning is to predict values for unseen data, and the
277
277
278
278
One small detail to pay attention to in this case is that the shapes of the input data (`x`) and output data (`obs`) must be the same. When we make out-of-sample predictions, we typically change only the input data, the shape of which may not be the same as the training observations. Naively changing only one will result in a shape error. There are two solutions:
279
279
280
-
1. Use a `pm.Data` for the `x` data and the `y` data, and use `pm.set_data` to change `y` to something of the same shape as the test inputs.
280
+
1. Use a {class}`pymc.Data` for the `x` data and the `y` data, and use `pm.set_data` to change `y` to something of the same shape as the test inputs.
281
281
2. Tell PyMC that the shape of the `obs` should always be the shape of the input data.
282
282
283
283
In the next model, we use option 2. This way, we don't need to pass dummy data to `y` every time we want to change `x`.
0 commit comments