Discriminant Analysis
local graph
Chapter 9 — Discriminant Analysis
Section titled “Chapter 9 — Discriminant Analysis”In the previous chapter, we discussed discrete regression models, including classification using logistic regression. In this chapter, we will begin with an overview of probability, expanding into conditional and independent probability. We then discuss how these two approaches to understanding the laws of probability form the basis for Bayes’ Theorem, which is used directly to expand an approach called Bayesian statistics. Following this topic, we dive into Linear Discriminant Analysis (LDA) and Quadratic Discriminant Analysis (QDA), two powerful classifiers that model data using the Bayesian approach to probability modeling.
In this chapter we’re going to cover the following main topics:
- Bayes’ Theorem
- LDA
- QDA
Bayes’ theorem
Section titled “Bayes’ theorem”In this section, we will discuss Bayes’ Theorem, which is used in the classification models described later in this chapter. We will start the chapter by discussing the basics of probability. Then, we will take a look at dependent events and discuss how Bayes’ Theorem is related to dependent events.
Probability
Section titled “Probability”Probability is a measurement of the likelihood that an event occurs or a certain outcome occurs. Generally, we can group events into two types of events: independent events and dependent events. The distinction between the types of events is in the name. An independent event is an event that is not affected or influenced by the occurrences of other events, while a dependent event is affected or influenced by the occurrences of other events.
Let’s think about some examples of these events. For the first example, think about a fair coin toss. A coin toss can result in one of two states: heads and tails. If the coin is fair, there is a one-in-two chance that the toss will result in heads or tails. That means that the probability of heads or tails is 0.5 in a fair coin toss. We can calculate probability using the following formula when events are countable:
Here, is the probability of the desired outcome. In the coin-toss example, the desired outcome is either heads or tails, each of which can only occur once per coin toss. Thus, for the coin toss, the count of desired events is one. The total number of outcomes is two because there are two possible states from a coin toss. Putting these numbers in the preceding equation yields 0.5 for heads and 0.5 for tails. Now, putting your experience to work, does a previous coin toss give you any knowledge about the next toss of the same coin? It does not because each coin toss is independent of every other coin toss; it is an independent event.
Now, let’s consider another example. Say we have a bag with three red marbles and five blue marbles. Let’s calculate the probability of selecting a red marble from the bag:. There are eight total marbles, which is the total number of outcomes in the equation. We want to select a red marble, which means the count of desired outcomes is three. This means that the probability of selecting red marble from the bag is. Now, let’s calculate the probability of selecting a blue marble from the bag:. There are five blue marbles and eight total marbles, so the probability of selecting a blue marble from the bag is. Notice that the sum of the two probabilities is one:. This brings up an important property of probabilities: the total probability must be equal to one. This, of course, means that once we calculated the probability of selecting a red marble, we could have calculated the probability of selecting a blue marble by subtracting the probability of selecting a red marble from one. The property of probabilities is very useful and is used commonly in statistics and machine learning (ML).
Coming back to the example with red and blue marbles, let’s think about the type of event represented by this example. We select a marble from the bag. Now, there are two possible options next: (1) we replace the selected marble and select a marble from the bag again, and (2) we do not replace the marble and select a new marble from the remaining seven marbles in the bag. The first case is called selection with replacement. Selection with replacement is an independent event because the bag is reset before each draw from the bag. The second case is called selection without replacement. Selection without replacement is where you find dependent events. The first time you select a marble, the probability is the same as described previously (an independent event). However, if the marble is not replaced, the state of the bag has changed, and the probability of the next marble selection depends on which one was selected from the bag in the previous draw. Then, in selection without replacement, each subsequent marble draw is a dependent event. When discussing dependent events, it is useful to describe events using conditional probability. Let’s discuss conditional probability now.
Conditional probability
Section titled “Conditional probability”Let’s start with a formal definition. When we have dependent events, we may be interested in the probability of Event B given Event A, which means we want to know the probability of Event B after Event A occurred. This is called the conditional probability of Event B given Event A and is denoted. This can be thought of as “the probability of Event B on the condition that Event A has already occurred.” This may feel a bit vague, so let’s look at conditional probability in terms of our last example.
Let’s say Event A is drawn a red marble and Event B is drawn a blue marble. We want to find the conditional probability of drawing a blue marble given that we have already drawn a red marble and can denote this as. Let’s work through this example. After drawing the first red marble from the bag, there are seven marbles remaining: two red marbles and five blue marbles. We calculate the probability of selecting a blue marble from the new set using the same equation, which gives us the probability of. This means that the conditional probability of drawing a blue marble, given this a red marble was already drawn, is.
Now that we have discussed conditional probability, let’s look at the probability of making two draws from the bag. Formally, we want to calculate the probability of Event A and Event B. Continuing to follow our example, let’s calculate the probability of drawing a red marble and then drawing a blue marble. We can describe the probability of two sequential events with the following equation:
In words, the probability of A followed by B is the probability of Event A times the probability of Event B given Event A. In our example, we have calculated and. We can use those values to calculate the probability of drawing a red marble and then a blue marble, as follows:
Performing the calculation, we find that is about 0.27.
Now, out of interest, let’s make the calculations again, but exchanging the order of the colors; the probability of drawing a blue marble and then drawing a red marble or. Following the same logic as shown in the previous example, we will find that and. Thus, the equation looks like this:
Notice that and have the same probability. This is no coincidence. This is known as Bayes’ Theorem, which we will discuss next.
Discussing Bayes’ Theorem
Section titled “Discussing Bayes’ Theorem”In the previous section on conditional probability, we happened across Bayes’ Theorem in the example of drawing marbles from a bag. Let’s discuss Bayes’ Theorem in more detail.
Bayes’ Theorem is a basis of a field of statistics known as Bayesian statistics. The central idea of Bayesian statistics is that given a prior probability, we have used new information to update probability estimates. While a full description of Bayesian statistics is beyond the scope of this book, we will discuss Bayes’ Theorem as it relates to the concepts discussed in this book. We generally describe Bayes’ Theorem with the following equation:
In Bayesian terminology, is called the prior and is called the posterior. The posterior gives us an update given another event. Let’s make use of the Theorem in a real-world example.
Let’s say that we want to determine whether someone has a disease based on the results of a test. We would present this in Bayes’ Theorem as follows:
Here, is the probability of having the disease, is the probability of getting a positive test result, and is the conditional probability of a positive test result when the patient tested is sick (also known as the accuracy of the test).
For this example, we will assume the probability of having the disease is 0.2 and the test has an accuracy of 0.95 and a false positive rate of 0.3. The prior probability in this example is. We can improve our knowledge of whether someone has the disease with the test. We want to find the posterior:.
Since we know the accuracy of the test is 0.95 and the prior, we already know the values of the terms in the nominator of the equation. To find, we need to consider all cases where we can get a positive test result, which could be a true positive or a false positive. We calculate the probability of the positive test result as follows:
Recall that the total probability of possible states must equal one:. With this in mind, we can calculate:
Given one test result, we see that the likeliness of the patient being sick has increased from 0.2 to 0.44 with the additional information. 0.44 is not a particularly convincing result. This is due to the relatively high false positive rate of 0.3, even though the test has high accuracy. If we are not convinced, we can run the test again using 0.44 as the new prior. Assuming the second test is positive, we would get the following result:
A second positive test provides a more convincing result of 0.71. We could continue to iteratively improve the probability estimation that a patient is sick by incorporating the results from additional tests. This incremental improvement of probability estimation is the basic idea of Bayesian statistics.
This section contained an introduction to probability. We covered independent and dependent events and then provided more details on dependent events, which led to the introduction of Bayes’ Theorem. In the next section, we will discuss a type of classification model that uses Bayes’ Theorem.
Linear Discriminant Analysis
Section titled “Linear Discriminant Analysis”In the previous chapter, we discussed logistic regression as a classification model leveraging linear regression to model directly the probability of a target distribution given an input distribution. One alternative to this approach is LDA. LDA models the probability of target distribution class memberships given input variable distributions corresponding to each class using decision boundaries constructed using Bayes’ Theorem, which we discussed previously. Where we have k classes, using Bayes’ Theorem, we have the probability density function for LDA class membership simply as for any discrete random variable, X. This relies on the posterior probability that an observation x in variable X belongs to the k th class.
Before proceeding, we must first make note that LDA makes three pertinent assumptions:
- Each input variable is normally distributed.
- Across all target classes, there is equal covariance among the predictors. In other words, the shared variance of all input variables is uniform. For this reason, it is useful to standardize each input variable to have a mean of 0 and scale to unit variance (standard deviation of 1).
- Samples are assumed to be independent; random sampling is highly important to avoid complications resulting from serial or cluster effects.
With these assumptions met, we can make the assumption that the class probability density function is Gaussian (normal), and thus, in a one-dimensional form (one input variable), we have the following density function:
Here, is the k th class mean and is the k th class variance. In the multivariate case, the normal probability density function is this:
Here, D is the covariance matrix of the input variables, p is the number of input variables (or parameters), and π is the prior probability. The univariate calculation of the posterior probability is shown here (where k corresponds to the k th class and K corresponds to the number of classes):
And for the multivariate case, the calculation looks like this:
The univariate linear discriminant function,, can be written as follows:
Here, the class with the largest value of has its label assigned to the given observation. This uses the Bayesian decision boundary for K classes:
For the multivariate case, the linear discriminant function, which follows the same Bayesian decision boundary, looks like this:
Now that we have identified the probability density functions, calculations for class membership posterior probabilities, the Bayesian decision boundary, and linear discriminant functions, we can understand how the required assumptions for LDA are very important. While transformations can be used to make data fit the required assumptions, these transformations must also be adaptable across future datasets. Therefore, if the data changes frequently and heavy transformations are needed to meet the parametric assumptions required of LDA to produce useful results across training and testing, this may not be the proper method of classification for the task (something such as QDA may be more useful). However, if these assumptions can be met at the researcher’s comfort, and with fair subject-matter knowledge to confirm this, LDA is an outstanding algorithm that is capable of producing highly reliable and stable results across very large datasets, as defined by both large feature space and high observation count. LDA also performs well on smaller datasets.
Let’s look at an example in practice. Let’s load the affairs dataset from statsmodels so we can check class imbalance:
import statsmodels.api as smdf_affairs = sm.datasets.fair.load().datatotal_count = df_affairs.shape[0]positive_count = df_affairs.loc[df_affairs['affairs'] > 0].shape[0]positive_pct = positive_count / total_countnegative_pct = 1 - positive_pctprint("Class 1 Balance: {}%".format(round(positive_pct*100, 2)))print("Class 2 Balance: {}%".format(round(negative_pct*100, 2)))Here we can see the class imbalance as follows:
Class 1 Balance: 32.25%
Class 2 Balance: 67.75%
We can see the class imbalance is 67.75/32.25. Class imbalance doesn’t often become a large concern until it approaches around 90/10, so we’ll leave this as-is without any additional work, such as upsampling or downsampling. We’ll recode any affairs value greater than 0 to 1 to make this a binary classification problem:
df_affairs['affairs'] = np.where(df_affairs['affairs'] > 0, 1, 0)Let’s select the features we want to use:
X=df_affairs[['rate_marriage','age','yrs_married','children','religious','educ','occupation','occupation_husb']]y=df_affairs['affairs']Recall that input feature standard deviations must be the same across both classes for LDA to effectively produce a linear separation boundary. Using the method shown next, we can see all input features share the same standard deviation across both target classes with the exception of rate_marriage. The standard deviation here has a difference of about 20%. Considering we have eight input features and all features in the model will be scaled, this likely won’t present an issue. If the model underperforms, based on this information, we can reasonably assume it isn’t the algorithm’s fault as the required assumptions are met. Rather, it would more likely be that we don’t have enough features or observations to fully explain the target. We exclude affairs because that’s the target variable and occupation and occupation_husb because they’re categorical encodings that will be one-hot encoded since we are not considering them to be ordinal based on our analysis scope:
df_affairs_sd = pd.concat([X, y], axis=1)for col in df_affairs_sd.columns: if col not in ['affairs','occupation','occupation_husb']: print('Affairs = 0, Feature = {}, Standard Deviation = {}'.format(col, round(np.std(df_affairs_sd.loc[df_affairs_sd['affairs'] == 0, col]), 2))) print('Affairs = 1, Feature = {}, Standard Deviation = {}'.format(col, round(np.std(df_affairs_sd.loc[df_affairs_sd['affairs'] == 1, col]), 2)))Affairs = 0, Feature = rate_marriage, Standard Deviation = 0.82
Affairs = 1, Feature = rate_marriage, Standard Deviation = 1.07
Affairs = 0, Feature = age, Standard Deviation = 6.81
Affairs = 1, Feature = age, Standard Deviation = 6.7
Affairs = 0, Feature = yrs_married, Standard Deviation = 7.1
Affairs = 1, Feature = yrs_married, Standard Deviation = 7.18
Affairs = 0, Feature = children, Standard Deviation = 1.42
Affairs = 1, Feature = children, Standard Deviation = 1.41
Affairs = 0, Feature = religious, Standard Deviation = 0.89
Affairs = 1, Feature = religious, Standard Deviation = 0.84
Affairs = 0, Feature = educ, Standard Deviation = 2.21
Affairs = 1, Feature = educ, Standard Deviation = 2.09
In the previous chapter, we identified that occupation and occupation_husb do not capture much difference in explaining affairs so we will drop occupation_husb from the dataset to minimize the volume of one-hot encodes, as follows:
import pandas as pdpd.options.mode.chained_assignment = NoneX['occupation'] = X['occupation'].map({1:'Occupation_One', 2:'Occupation_Two', 3:'Occupation_Three', 4:'Occupation_Four', 5:'Occupation_Five', 6:'Occupation_Six'})X = pd.get_dummies(X, columns=['occupation'])X.drop('occupation_husb', axis=1, inplace=True)Let’s build a train/test split with a test size of 33% of the overall data:
from sklearn.model_selection import train_test_splitX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)We want to retain a copy of the original data, but as noted earlier, we also need to center and scale the data for LDA to have an optimal chance of success. Therefore, we’ll take copies of the X data and scale them. Note, however, we do not want to scale the one-hot encoded data since one-hot encodes cannot be scaled and retain their meaning. Therefore, we will use scikit-learn’s ColumnTransformer() pipeline function to apply StandardScaler() to all but the one-hot-encoded columns, like so:
from sklearn.compose import ColumnTransformerfrom sklearn.preprocessing import StandardScalerX_train_sc = X_train.copy()X_test_sc = X_test.copy()ct = ColumnTransformer([ ('', StandardScaler(), ['rate_marriage','age','yrs_married','children','religious','educ'])], remainder='passthrough')X_train_sc = ct.fit_transform(X_train_sc)ct = ColumnTransformer([ ('', StandardScaler(), ['rate_marriage','age','yrs_married','children','religious','educ'])], remainder='passthrough')X_test_sc = ct.fit_transform(X_test_sc)Now, let’s fit the LDA model to the training data. We fit the model to the training data and then use that to predict the training data to get a performance benchmark. Then, we will use the model to predict the testing data to see how well the model can generalize on unseen data.
Fit the data, like so:
from sklearn.discriminant_analysis import LinearDiscriminantAnalysislda = LinearDiscriminantAnalysis()lda.fit(X_train_sc, y_train)Here, we build functions to measure precision and recall. Precision is a measure that basically tells you how well a model is at finding only the positive values of the target (affairs = 1) and none of the others (affairs = 0). Recall is a measure that practically tells you how well the model performs at finding all positive values of the target, regardless of how many of the others it finds. The ideal scenario is both of these metrics are very high. However, this may not be possible. If neither is very high, the use case should determine which metric is more important:
def precision_score(true_positives:int, false_positives:int): precision = true_positives / (true_positives + false_positives) return precision;def recall_score(true_positives:int, false_negatives:int): recall = true_positives / (true_positives + false_negatives) return recall;Let’s now run the model and verify performance:
from sklearn.metrics import confusion_matriximport seaborn as snsy_train_pred = lda.predict(X_train_sc)cf_train = confusion_matrix(y_train, y_train_pred, labels=[0,1])tn_train, fp_train, fn_train, tp_train = cf_train.ravel()cf_matrix = sns.heatmap(cf_train, annot=True, fmt='g', cbar=False)cf_matrix.set(xlabel='Predicted', ylabel='Actual', title='Confusion Matrix - Train');print('Precision on Train: ', round(precision_score(tp_train, fp_train), 4))print('Recall on Train: ', round(recall_score(tp_train, fn_train), 4))Here we can see our model results on the training data:
Precision on Train: ``0.6252
Recall on Train: ``0.3444
Here, we can visualize performance using a confusion matrix to compare actual target values against the predicted values on the training data:

Figure 9.1 – Confusion matrix for LDA training data
Let’s repeat the process on the test data:
y_test_pred = lda.predict(X_test_sc)cf_test = confusion_matrix(y_test, y_test_pred, labels=[0,1])tn_test, fp_test, fn_test, tp_test = cf_test.ravel()cf_matrix = sns.heatmap(cf_test, annot=True, fmt='g', cbar=False)cf_matrix.set(xlabel='Predicted', ylabel='Actual', title='Confusion Matrix - Test');print('Precision on Test: ', round(precision_score(tp_test, fp_test), 4))print('Recall on Test: ', round(recall_score(tp_test, fn_test), 4))Here we can see our model results on the test data:
Precision on Test: ``0.6615
Recall on Test: ``0.3673
Here, we can visualize performance using a confusion matrix to compare actual target values against the predicted values on the test data:

Figure 9.2 – Confusion matrix for LDA test data
From these results, we can see the scores are consistent for precision and recall across both training and test sets using the model we built on the training data, so we can conclude the model generalizes well on unseen data compared to the benchmark (training) performance. However, the performance is not great. The issue may be that our target encoding is not very useful (perhaps the discretization of affairs is not useful and a statistical approach should be taken to discretize the values). However, it is also possible the features do not explain enough of the variance in the response variable to build a model that is of much use (it’s also possible affairs cannot be predicted at all and there is too much random noise to model). However, for the intent of the chapter, we were able to demonstrate how a model using LDA could be constructed and tested in addition to the preprocessing steps that must be taken before data can be modeled.
Supervised dimension reduction
Section titled “Supervised dimension reduction”Unlike PCA, which can be used to perform unsupervised dimension reduction, LDA can be leveraged to perform supervised dimension reduction. That is, upon training the model to learn the input variance in relation to the output target, a derived set of features can be obtained. The differences are illustrated in the following diagram:

Figure 9.3 – Dimension reduction: LDA versus PCA
Suppose our data produced a good result when using LDA for classification. We could then confidently use the same data to build a supervised dimension reduction technique. To perform this, we would run the following code using fit_transform() to transform the input data with respect to the target (rather than the fit() function we used to fit a classifier earlier). As with the classifier, the data should still conform to the assumptions of the LDA model. Data is reduced according to the number of classes in the response variable. Where the number of classes is C, the number of reduced features will be C-1. Because we have only two classes in our target variable, y, LDA reduces the input features to a dimension of 1:
from sklearn.discriminant_analysis import LinearDiscriminantAnalysislda = LinearDiscriminantAnalysis()X_reduced = lda.fit_transform(X_train_sc, y_train)We can see the data has now been reduced to a one-dimensional feature:
print('Input data dimensions: ', X_train_sc.shape)print('Transformed data dimensions: ', X_reduced.shape)Here, we can see our data is reduced from 12 features to 1:
Input data dimensions: (``4265, 12)
Transformed data dimensions: (``4265, 1)
Quadratic Discriminant Analysis
Section titled “Quadratic Discriminant Analysis”In the last section, we discussed LDA. The data within each class needs to be drawn from a multivariate Gaussian distribution, and the covariance matrix is the same across different classes. In this section, we consider another type of discriminant analysis called QDA but the assumptions for QDA can be relaxed on the covariance matrix assumption. Here, we do not need the covariance matrix to be identical across different classes but only for each class to have its own covariance matrix. The multivariate Gaussian distribution with a class-specific mean vector within each class for observations is still required to conduct QDA. We assume that an observation from a class satisfies the following formula:
We’ll thus consider a generative classifier, as follows:
And then, its corresponding class posterior is this:
Here, is the prior probability of the class In literature, this is called Gaussian Discriminant Analysis (GDA). Then, the discriminant function is computed by taking the log posterior over classes, as follows:
Here, is a constant. Unlike in LDA, the quantity of appears as a quadratic function in the preceding formula and it is known as QDA. The choice between LDA or QDA is related to the bias-variance trade-off. If the assumption that shares the same covariance matrix over classes is not good, then a high bias can be significant in LDA. In other words, LDA is used when a boundary between classes is linear, and QDA is performed better in the case of a nonlinear boundary between classes.
Now, we consider an example using the same Iris dataset that we studied in the last chapter. To perform QDA, an option is to use QuadraticDiscriminantAnalysis in sklearn. As in the last chapter, we use a train_test_split function to create a training and a test set (80% versus 20%), and then we fit a QDA model on the training set and use this model for prediction:
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis# fit the model using sklearnmodel_qda = QuadraticDiscriminantAnalysis(store_covariance=True)model_qda.fit(X_train, y_train)y_hat_qda = model_qda.predict(X_test)pred_qda = list(map(round, y_hat_qda))The confusion matrix related to the test set is shown here:

Figure 9.4 – QDA confusion matrix
The accuracy is 100% for this dataset. This analysis is based on all variables (sepal_length (cm), sepal_width (cm), petal_length (cm), petal_width (cm)), and for three dependent variables (targets): setosa, versicolor, and virginica. For visualization educational purposes, we will only consider the analysis in two dimensions using sepal_length and sepal_width as the independent variables:

Figure 9.5 – sepal_length and sepal_width
The visualization in two dimensions between sepal_length and sepal_width can be reproduced using the following Python code:
import matplotlib.pyplot as pltFIGSIZE = (8,8)Xax= np.array(df1["sepal_length"])Yax= np.array(df1["sepal_width"])labels= np.array(df1["target"])cdict={0:'red',1:'green', 2 :'blue'}labl={0:'setosa',1:'versicolor', 2: 'virginica'}marker={0:'*',1:'o', 2:'p'}alpha={0:.3, 1:.5, 2:.3}fig,ax=plt.subplots(figsize=FIGSIZE)fig.patch.set_facecolor('white')for l in np.unique(labels): ix=np.where(labels==l) ax.scatter(Xax[ix],Yax[ix],c=cdict[l],s=40, label=labl[l],marker=marker[l],alpha=alpha[l])plt.xlabel("Sepal Length",fontsize=14)plt.ylabel("Sepal Width",fontsize=14)plt.legend()plt.show()The visualization is as follows:

Figure 9.6 – Iris flower species scatterplot
Observing that there is no linear separation between the classes (setosa, versicolor, and virginica), a QDA would be a better approach than an LDA.
The min and max values are (4.3, 7.9) for sepal_length and (2.0, 4.4) for sepal_width:

Figure 9.7 – sepal_length and sepal_width min and max values
We train a new QDA model using only these two variables, sepal_length and sepal_width, on all observations in the Iris dataset, as follows:
df1['species'] = df1['target']df1['species'] = df1['species'].apply(lambda x: 'setosa' if x==0 else('versicolor' if x==1 else 'virginica'))X = df1.drop(['target','species'], axis=1)y = df1['target']model_qda = QuadraticDiscriminantAnalysis(store_covariance=True)model_qda.fit(X,y)Then, we create a generic dataset with 500 observations for sepal_length and sepal_width within the min and max range of each variable for a prediction:
sepal_length = np.linspace(4, 8, 500)sepal_width = np.linspace(1.5, 4.5, 500)sepal_length,sepal_width = np.meshgrid(sepal_length, sepal_width)prediction = np.array([model_qda.predict( np.array([[x,y]])) for x,y in zip(np.ravel(sepal_length), np.ravel(sepal_width)) ]).reshape(sepal_length.shape)The following Python code is executed for the visualization of boundary separation between classes:
fig = sns.FacetGrid(df1, hue="species", size=8, palette = 'colorblind').map(plt.scatter, "sepal_length", "sepal_width").add_legend()figax = fig.axfigax.contourf(sepal_length,sepal_width, prediction, 2, alpha = .1, colors = ('red','green','blue'))figax.contour(sepal_length,sepal_width, prediction, 2, alpha = 1, colors = ('red','green','blue'))figax.set_xlabel('Sepal Length')figax.set_ylabel('Sepal Width')figax.set_title('QDA Visualization')plt.show()We get the resulting plot as follows:

Figure 9.8 – QDA decision boundaries for Iris dataset
There is a good separation between setosa and these other two classes but not between the versicolor and virginica classes. The separation between classes will be better in higher dimensions, which means that in this example, we consider all four independent variables: sepal_length, sepal_width, petal_length, and petal_width. In other words, this analysis is better conducted in four dimensions, but it is not possible to have a four-dimensional visualization for human beings.
Summary
Section titled “Summary”In this chapter, we began with an overview of probability. We covered the differences between conditional and independent probability and how Bayes’ Theorem leverages these concepts to provide a unique approach to probability modeling. Next, we discussed LDA, its assumptions, and how the algorithm can be used to apply Bayesian statistics to both perform classification modeling and supervised dimension reduction. Finally, we covered QDA, an alternative to LDA when linear decision boundaries are not effective.
In the next chapter, we will introduce the fundamentals of time-series analysis, including an overview of the depths and limitations of this approach to answering statistical questions.