Skip to content

Commit c424185

Browse files
authored
Normalize some tags and fix typos (#772)
* Normalize tags * Fix typos
1 parent c8bbca4 commit c424185

File tree

80 files changed

+244
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+244
-244
lines changed

examples/bart/bart_categorical_hawks.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@
14731473
"source": [
14741474
"So far we have a very good result concerning the classification of the species based on the 5 covariables. However, if we want to select a subset of covariable to perform future classifications is not very clear which of them to select. Maybe something sure is that `Tail` could be eliminated. At the beginning when we plot the distribution of each covariable we said that the most important variables to make the classification could be `Wing`, `Weight` and, `Culmen`, nevertheless after running the model we saw that `Hallux`, `Culmen` and, `Wing`, proved to be the most important ones.\n",
14751475
"\n",
1476-
"Unfortunatelly, the partial dependence plots show a very wide dispersion, making results look suspicious. One way to reduce this variability is adjusting independent trees, below we will see how to do this and get a more accurate result. "
1476+
"Unfortunately, the partial dependence plots show a very wide dispersion, making results look suspicious. One way to reduce this variability is adjusting independent trees, below we will see how to do this and get a more accurate result. "
14771477
]
14781478
},
14791479
{

examples/bart/bart_categorical_hawks.myst.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ all
195195

196196
So far we have a very good result concerning the classification of the species based on the 5 covariables. However, if we want to select a subset of covariable to perform future classifications is not very clear which of them to select. Maybe something sure is that `Tail` could be eliminated. At the beginning when we plot the distribution of each covariable we said that the most important variables to make the classification could be `Wing`, `Weight` and, `Culmen`, nevertheless after running the model we saw that `Hallux`, `Culmen` and, `Wing`, proved to be the most important ones.
197197

198-
Unfortunatelly, the partial dependence plots show a very wide dispersion, making results look suspicious. One way to reduce this variability is adjusting independent trees, below we will see how to do this and get a more accurate result.
198+
Unfortunately, the partial dependence plots show a very wide dispersion, making results look suspicious. One way to reduce this variability is adjusting independent trees, below we will see how to do this and get a more accurate result.
199199

200200
+++
201201

examples/bart/bart_introduction.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"(BART_introduction)=\n",
99
"# Bayesian Additive Regression Trees: Introduction\n",
1010
":::{post} Dec 21, 2021\n",
11-
":tags: BART, non-parametric, regression \n",
11+
":tags: BART, nonparametric, regression \n",
1212
":category: intermediate, explanation\n",
1313
":author: Osvaldo Martin\n",
1414
":::"
@@ -210,7 +210,7 @@
210210
"id": "7eb4c307",
211211
"metadata": {},
212212
"source": [
213-
"Before checking the result, we need to discuss one more detail, the BART variable always samples over the real line, meaning that in principle we can get values that go from $-\\infty$ to $\\infty$. Thus, we may need to transform their values as we would do for standard Generalized Linear Models, for example in the `model_coal` we computed `pm.math.exp(μ_)` because the Poisson distribution is expecting values that go from 0 to $\\infty$. This is business as usual, the novelty is that we may need to apply the inverse transformation to the values of `Y`, as we did in the previous model where we took $\\log(Y)$. The main reason to do this is that the values of `Y` are used to get a reasonable initial value for the sum of trees and also the variance of the leaf nodes. Thus, applying the inverse transformation is a simple way to improve the efficiency and accuracy of the result. Should we do this for every possible likelihood? Well, no. If we are using BART for the location parameter of distributions like Normal, StudentT, or AssymetricLaplace, we don't need to do anything as the support of these parameters is also the real line. A nontrivial exception is the Bernoulli likelihood (or Binomial with n=1), in that case, we need to apply the logistic function to the BART variable, but there is no need to apply its inverse to transform `Y`, PyMC-BART already takes care of that particular case.\n",
213+
"Before checking the result, we need to discuss one more detail, the BART variable always samples over the real line, meaning that in principle we can get values that go from $-\\infty$ to $\\infty$. Thus, we may need to transform their values as we would do for standard Generalized Linear Models, for example in the `model_coal` we computed `pm.math.exp(μ_)` because the Poisson distribution is expecting values that go from 0 to $\\infty$. This is business as usual, the novelty is that we may need to apply the inverse transformation to the values of `Y`, as we did in the previous model where we took $\\log(Y)$. The main reason to do this is that the values of `Y` are used to get a reasonable initial value for the sum of trees and also the variance of the leaf nodes. Thus, applying the inverse transformation is a simple way to improve the efficiency and accuracy of the result. Should we do this for every possible likelihood? Well, no. If we are using BART for the location parameter of distributions like Normal, StudentT, or AsymmetricLaplace, we don't need to do anything as the support of these parameters is also the real line. A nontrivial exception is the Bernoulli likelihood (or Binomial with n=1), in that case, we need to apply the logistic function to the BART variable, but there is no need to apply its inverse to transform `Y`, PyMC-BART already takes care of that particular case.\n",
214214
"\n",
215215
"OK, now let's see the result of `model_coal`."
216216
]

examples/bart/bart_introduction.myst.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ kernelspec:
1414
(BART_introduction)=
1515
# Bayesian Additive Regression Trees: Introduction
1616
:::{post} Dec 21, 2021
17-
:tags: BART, non-parametric, regression
17+
:tags: BART, nonparametric, regression
1818
:category: intermediate, explanation
1919
:author: Osvaldo Martin
2020
:::
@@ -98,7 +98,7 @@ with pm.Model() as model_coal:
9898
idata_coal = pm.sample(random_seed=RANDOM_SEED)
9999
```
100100

101-
Before checking the result, we need to discuss one more detail, the BART variable always samples over the real line, meaning that in principle we can get values that go from $-\infty$ to $\infty$. Thus, we may need to transform their values as we would do for standard Generalized Linear Models, for example in the `model_coal` we computed `pm.math.exp(μ_)` because the Poisson distribution is expecting values that go from 0 to $\infty$. This is business as usual, the novelty is that we may need to apply the inverse transformation to the values of `Y`, as we did in the previous model where we took $\log(Y)$. The main reason to do this is that the values of `Y` are used to get a reasonable initial value for the sum of trees and also the variance of the leaf nodes. Thus, applying the inverse transformation is a simple way to improve the efficiency and accuracy of the result. Should we do this for every possible likelihood? Well, no. If we are using BART for the location parameter of distributions like Normal, StudentT, or AssymetricLaplace, we don't need to do anything as the support of these parameters is also the real line. A nontrivial exception is the Bernoulli likelihood (or Binomial with n=1), in that case, we need to apply the logistic function to the BART variable, but there is no need to apply its inverse to transform `Y`, PyMC-BART already takes care of that particular case.
101+
Before checking the result, we need to discuss one more detail, the BART variable always samples over the real line, meaning that in principle we can get values that go from $-\infty$ to $\infty$. Thus, we may need to transform their values as we would do for standard Generalized Linear Models, for example in the `model_coal` we computed `pm.math.exp(μ_)` because the Poisson distribution is expecting values that go from 0 to $\infty$. This is business as usual, the novelty is that we may need to apply the inverse transformation to the values of `Y`, as we did in the previous model where we took $\log(Y)$. The main reason to do this is that the values of `Y` are used to get a reasonable initial value for the sum of trees and also the variance of the leaf nodes. Thus, applying the inverse transformation is a simple way to improve the efficiency and accuracy of the result. Should we do this for every possible likelihood? Well, no. If we are using BART for the location parameter of distributions like Normal, StudentT, or AsymmetricLaplace, we don't need to do anything as the support of these parameters is also the real line. A nontrivial exception is the Bernoulli likelihood (or Binomial with n=1), in that case, we need to apply the logistic function to the BART variable, but there is no need to apply its inverse to transform `Y`, PyMC-BART already takes care of that particular case.
102102

103103
OK, now let's see the result of `model_coal`.
104104

examples/bart/bart_quantile_regression.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"(BART_quantile)=\n",
99
"# Quantile Regression with BART\n",
1010
":::{post} Jan 25, 2023\n",
11-
":tags: BART, non-parametric, quantile, regression \n",
11+
":tags: BART, nonparametric, quantile, regression \n",
1212
":category: intermediate, explanation\n",
1313
":author: Osvaldo Martin\n",
1414
":::"
@@ -468,7 +468,7 @@
468468
"id": "8e963637",
469469
"metadata": {},
470470
"source": [
471-
"We can see that when we use a Normal likelihood, and from that fit we compute the quantiles, the quantiles q=0.1 and q=0.9 are symetrical with respect to q=0.5, also the shape of the curves is essentially the same just shifted up or down. Additionally the Asymmetric Laplace family allows the model to account for the increased variability in BMI as the age increases, while for the Gaussian family that variability always stays the same."
471+
"We can see that when we use a Normal likelihood, and from that fit we compute the quantiles, the quantiles q=0.1 and q=0.9 are symmetrical with respect to q=0.5, also the shape of the curves is essentially the same just shifted up or down. Additionally the Asymmetric Laplace family allows the model to account for the increased variability in BMI as the age increases, while for the Gaussian family that variability always stays the same."
472472
]
473473
},
474474
{

examples/bart/bart_quantile_regression.myst.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ kernelspec:
1414
(BART_quantile)=
1515
# Quantile Regression with BART
1616
:::{post} Jan 25, 2023
17-
:tags: BART, non-parametric, quantile, regression
17+
:tags: BART, nonparametric, quantile, regression
1818
:category: intermediate, explanation
1919
:author: Osvaldo Martin
2020
:::
@@ -141,7 +141,7 @@ plt.xlabel("Age")
141141
plt.ylabel("BMI");
142142
```
143143

144-
We can see that when we use a Normal likelihood, and from that fit we compute the quantiles, the quantiles q=0.1 and q=0.9 are symetrical with respect to q=0.5, also the shape of the curves is essentially the same just shifted up or down. Additionally the Asymmetric Laplace family allows the model to account for the increased variability in BMI as the age increases, while for the Gaussian family that variability always stays the same.
144+
We can see that when we use a Normal likelihood, and from that fit we compute the quantiles, the quantiles q=0.1 and q=0.9 are symmetrical with respect to q=0.5, also the shape of the curves is essentially the same just shifted up or down. Additionally the Asymmetric Laplace family allows the model to account for the increased variability in BMI as the age increases, while for the Gaussian family that variability always stays the same.
145145

146146
+++
147147

examples/case_studies/CFA_SEM.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -4019,7 +4019,7 @@
40194019
"source": [
40204020
"### Intermediate Cross-Loading Model\n",
40214021
"\n",
4022-
"The idea of a measurment model is maybe a little opaque when we only see models that fit well. Instead we want to briefly show how an in-apt measurement model gets reflected in the estimated parameters for the factor loadings. Here we specify a measurement model which attempts to couple the `se_social` and `sup_parents` indicators and bundle them into the same factor. "
4022+
"The idea of a measurement model is maybe a little opaque when we only see models that fit well. Instead we want to briefly show how an in-apt measurement model gets reflected in the estimated parameters for the factor loadings. Here we specify a measurement model which attempts to couple the `se_social` and `sup_parents` indicators and bundle them into the same factor. "
40234023
]
40244024
},
40254025
{
@@ -7890,7 +7890,7 @@
78907890
"source": [
78917891
"# Conclusion\n",
78927892
"\n",
7893-
"We've just seen how we can go from thinking about the measurment of abstract psychometric constructs, through the evaluation of complex patterns of correlation and covariances among these latent constructs to evaluating hypothetical causal structures amongst the latent factors. This is a bit of whirlwind tour of psychometric models and the expressive power of SEM and CFA models, which we're ending by linking them to the realm of causal inference! This is not an accident, but rather evidence that causal concerns sit at the heart of most modeling endeavours. When we're interested in any kind of complex joint-distribution of variables, we're likely interested in the causal structure of the system - how are the realised values of some observed metrics dependent on or related to others? Importantly, we need to understand how these observations are realised without confusing simple correlation for cause through naive or confounded inference.\n",
7893+
"We've just seen how we can go from thinking about the measurement of abstract psychometric constructs, through the evaluation of complex patterns of correlation and covariances among these latent constructs to evaluating hypothetical causal structures amongst the latent factors. This is a bit of whirlwind tour of psychometric models and the expressive power of SEM and CFA models, which we're ending by linking them to the realm of causal inference! This is not an accident, but rather evidence that causal concerns sit at the heart of most modeling endeavours. When we're interested in any kind of complex joint-distribution of variables, we're likely interested in the causal structure of the system - how are the realised values of some observed metrics dependent on or related to others? Importantly, we need to understand how these observations are realised without confusing simple correlation for cause through naive or confounded inference.\n",
78947894
"\n",
78957895
"Mislevy and Levy highlight this connection by focusing on the role of De Finetti's theorem in the recovery of exchangeablility through Bayesian inference. By De Finetti’s theorem a distribution of exchangeable sequence of variables be expressed as mixture of conditional independent variables.\n",
78967896
"\n",

examples/case_studies/CFA_SEM.myst.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ Which shows a relatively sound recovery of the observed data.
282282

283283
### Intermediate Cross-Loading Model
284284

285-
The idea of a measurment model is maybe a little opaque when we only see models that fit well. Instead we want to briefly show how an in-apt measurement model gets reflected in the estimated parameters for the factor loadings. Here we specify a measurement model which attempts to couple the `se_social` and `sup_parents` indicators and bundle them into the same factor.
285+
The idea of a measurement model is maybe a little opaque when we only see models that fit well. Instead we want to briefly show how an in-apt measurement model gets reflected in the estimated parameters for the factor loadings. Here we specify a measurement model which attempts to couple the `se_social` and `sup_parents` indicators and bundle them into the same factor.
286286

287287
```{code-cell} ipython3
288288
coords = {
@@ -1035,7 +1035,7 @@ compare_df
10351035

10361036
# Conclusion
10371037

1038-
We've just seen how we can go from thinking about the measurment of abstract psychometric constructs, through the evaluation of complex patterns of correlation and covariances among these latent constructs to evaluating hypothetical causal structures amongst the latent factors. This is a bit of whirlwind tour of psychometric models and the expressive power of SEM and CFA models, which we're ending by linking them to the realm of causal inference! This is not an accident, but rather evidence that causal concerns sit at the heart of most modeling endeavours. When we're interested in any kind of complex joint-distribution of variables, we're likely interested in the causal structure of the system - how are the realised values of some observed metrics dependent on or related to others? Importantly, we need to understand how these observations are realised without confusing simple correlation for cause through naive or confounded inference.
1038+
We've just seen how we can go from thinking about the measurement of abstract psychometric constructs, through the evaluation of complex patterns of correlation and covariances among these latent constructs to evaluating hypothetical causal structures amongst the latent factors. This is a bit of whirlwind tour of psychometric models and the expressive power of SEM and CFA models, which we're ending by linking them to the realm of causal inference! This is not an accident, but rather evidence that causal concerns sit at the heart of most modeling endeavours. When we're interested in any kind of complex joint-distribution of variables, we're likely interested in the causal structure of the system - how are the realised values of some observed metrics dependent on or related to others? Importantly, we need to understand how these observations are realised without confusing simple correlation for cause through naive or confounded inference.
10391039

10401040
Mislevy and Levy highlight this connection by focusing on the role of De Finetti's theorem in the recovery of exchangeablility through Bayesian inference. By De Finetti’s theorem a distribution of exchangeable sequence of variables be expressed as mixture of conditional independent variables.
10411041

examples/case_studies/GEV.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
"cell_type": "markdown",
128128
"metadata": {},
129129
"source": [
130-
"And now set up the model using priors estimated from a quick review of the historgram above:\n",
130+
"And now set up the model using priors estimated from a quick review of the histogram above:\n",
131131
"\n",
132132
"- $\\mu$: there is no real basis for considering anything other than a `Normal` distribution with a standard deviation limiting negative outcomes;\n",
133133
"- $\\sigma$: this must be positive, and has a small value, so use `HalfNormal` with a unit standard deviation;\n",

examples/case_studies/GEV.myst.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Consider then, the 10-year return period, for which $p = 1/10$:
8585
p = 1 / 10
8686
```
8787

88-
And now set up the model using priors estimated from a quick review of the historgram above:
88+
And now set up the model using priors estimated from a quick review of the histogram above:
8989

9090
- $\mu$: there is no real basis for considering anything other than a `Normal` distribution with a standard deviation limiting negative outcomes;
9191
- $\sigma$: this must be positive, and has a small value, so use `HalfNormal` with a unit standard deviation;

0 commit comments

Comments
 (0)