# Teaching Design of Mathematics Application Based on Naive Bayes

Authors: Huanzhang Ling
Journal: Mathematical Problems in Engineering
 (2022)

---

## Abstract

There is a huge amount of mathematical information in the world, and mathematics is everywhere and nowhere. Bayesian theory is based on a process of statistical inference that requires the calculation of general and prior information to obtain a posteriori information. Its main features are the use of probabilities to represent all forms of uncertainty and the use of probabilistic rules to enable learning and inference, estimating the probability of future occurrences by calculating the probability of a past time. In order to bring mathematics closer to life, this paper explores the teaching of mathematical applications in terms of material selection, teaching arrangement, and professional integration. At the same time, in order to better realize mathematics application teaching, effectively improve the classroom effect of mathematics application teaching, and make students better accept mathematical knowledge and apply it to practical applications, the design of mathematics application teaching in this paper is also based on Naive Bayes.


---

## Body

## 1. Introduction

The focus on the development of students’ abilities and application awareness, and the internalization of the teaching process from teacher instruction to the development of students’ abilities, is an issue of concern in applied mathematics teaching [1]. Owhadi [2] said the following: “Education can only be effective and truly educational through life.” Therefore, mathematics itself is not just “number symbols,” and mathematics teaching is not only about making students do mathematical problems but also about making students learn mathematics with certain logical thinking skills and using mathematical methods to solve problems they encounter. Mathematics has its rich connotation; it originates from life and serves life.What role does mathematics play in human life? Dogan and Aydin [3] divide the role of mathematics into three levels. The first level provides language, concepts, ideas, theories, and methods for other disciplines. The natural sciences and social sciences such as economics and management cannot be developed without mathematics. The second level is the direct application to engineering and production activities, of which there are many examples [4]. The third level is as a culture that plays a subtle role for all members of society. The level of mathematical training of a nation has a great influence on the civilization of this nation [5].Mathematics is an important basic course for many majors in colleges and universities and plays an important role in the education of higher technical and application-oriented specialists for the first line of production [6, 7]. Therefore, the traditional mathematics education can no longer adapt to and meet the needs of talent training mode, and the application of mathematics teaching has become an important issue that many institutions urgently need to solve [8].


## 2. Mathematics Application Teaching Exploration

Mathematical problems in life often involve different fields; although not as systematic as mathematical theories, they are logically connected, and when solving mathematical problems, you can properly organize the relevant content, according to the order of the shallow to the deep rational arrangement of teaching. Let us look at three examples; they seem unrelated, but they are logically linked [9–13].A mathematical problem is fragmented if it is not supported by theory. When solving practical problems, we link the teaching of problem solving and theory to emphasize the mathematical ideas and theories used in the process of problem solving, so that we can achieve the effect of learning from one to three [14, 15]. This not only cultivates students’ ability to solve practical problems but also deepens their understanding of mathematical theories.For example, consider the population increment problem. It is known that the population into years is No, the growth rate of the population is proportional to the total number of people, and other factors are ignored for the time being, so how does the number of people change? Before solving this problem, we can ask students to go back to the theory of differential equations, such as the initial conditions of differential equations, general solutions, special solutions, and other concepts, for students to review the solution of differential equations, and then we can suggest that the rate of change in mathematics is expressed by the derivative. If the symbol Nt is used to represent the number of people as a function of time t and k represents the ratio of the population growth rate to the total population, an equation is obtained as follows: dNt/dt=kNt. The initial condition is Nto=No, and then the solution by separating the variables gives Ntoet−tot≥to.For the school, mathematics is a basic course and is the basis for learning other professional courses. With the emphasis on the requirement of “moderate enough” and the reduction of the number of mathematics hours, some problems related to the profession should be selected in a targeted way [16]. For example, for marketing majors, they can be introduced to the problem of optimizing the purchase of goods; when the demand is random, what ordering scheme can maximize the total profit. In addition, for logistics students, you can introduce them to some examples of graph theory, such as the seven bridges problem, the merchant crossing the river problem, and so on, so that students can understand the basic ideas of graph theory and lay the foundation for their future professional knowledge [17]. For example, when introducing the concept of derivative, different examples can be introduced according to different majors, such as the concept of margin for economics and management majors and rate and linear density for electromechanics majors.On the one hand, be good at finding out some problems that enhance students’ thinking. Use these problems to liven up the classroom atmosphere. Here are a few interesting mathematical problems. “What is the probability that a couple will sit together when 15 couples attend a party, but the person who arranges the seats does not know the 30 people?” Someone says something like “I’m wrong about this,” so is what he said right or wrong? “Ifn people attend a party and no one is known to know all of them, ask if there are two people who know as many people?”On the other hand, step-by-step questions provoke students’ thinking. When using mathematical methods to solve real-world problems, students do not think in one step, so you can use questions to prompt students, stimulate their thinking, and develop their ability to think independently [18].When teaching, introduce students to the content of the history of mathematics. For example, when we talk about infinitesimals in advanced mathematics, we can add the arguments about infinitesimals to students; when we talk about some paradoxes in mathematics, we can introduce the mathematical crisis caused by mathematical paradoxes [19, 20].


## 3. Method

Bayesian theory is based on a statistical inference process that requires the calculation of general and prior information to obtain a posteriori information. Its main features are the use of probabilities to represent all forms of uncertainty and the use of probabilistic rules to enable learning and inference by calculating the probability of occurrence at a past time to estimate the probability of future occurrence.Bayesian classifier is a simple probabilistic classifier based on the application of Bayesian independence assumption theory. The relationship between conditional and inverse conditional probabilities in Bayes’ theorem can be expressed as(1)PY|X=PY|XPX,where PY is the prior or marginal probability of Y, i.e., the probability that does not take into account any information about X. PY|X is the conditional probability of Y given X, whose value is derived from or depends on the value of X. When constructing posterior probabilities, in many cases, it is necessary to find the conditional probability PE|D in the dataset E, given data D. Assuming that the maximum value e is contained in E, any hypothesis of maximum probability is called the maximum a posteriori hypothesis and is labeled as EMAP, i.e.,(2)PE|DEMAP=argmaxe∈E,PE|D=argmaxe∈EPD|EPEPD.


### 3.1. Naive Bayesian Principle

LetU = {X, C} be a finite set of random variables, where X=X1,…,Xn is the set of attribute variables and C is a class variable taking values in the range c1,…,cl, and xi is the value of attribute Xi. The probability that sample xi=x1,…,xn belongs to ci can be expressed by Bayes’ theorem as(3)PC=cjX=xi=Pcj·Px1,…,xn/cjPx1,…,xn=α⋅Pcj·Px1,…,xncj,where α is the regularization factor, Pcj is the prior probability of class cj, and Px1,…,xn/cj is the likelihood of class cj with respect to Xi.By the chain rule of probability, equation (3) can be expressed as(4)pcjcjPcj|x1,…,xn=α⋅Pcj⋅∏i=1nPxi|x1,…,xi−1,cj.Given a training sample setD=u1,…,uN, the goal of the classification task is to analyze the training sample set D and determine a mapping function f: x1,…,xn⟶C, such that the class label can be labeled for any instance xi=x1,…,xn of an unknown class. According to the Bayesian maximum posterior criterion, given a certain instance and xi=x1,…,xn, the Bayesian classification model selects the class with the largest posterior probability Pcj|x1,…,xn as the class label for that instance.Using Bayesian networks as a classification tool is actually solving equation (4) with Bayesian networks, and it is possible to find Pxi|x1,…,xi−1,cj and determine the category from equation (4) according to the Bayesian maximum posterior criterion.


### 3.2. Bayesian Networks

A Bayesian network is a jointU=X1,…,Xn, coding of probability distributions consisting of a collection of random variables. Formally a pair of binary groups B=G,Θ⋅G is a directed acyclic graph (DAG) whose nodes correspond to random variables X1,…,Xn and whose directed edges represent the dependencies between variables, and the structure G of the graph encodes the independence assumption that given the parent of each node, the node is independent of its non-self-derived children; the second part of the binary, i.e., Θ, represents the set of conditional probability distributions for each variable of this network, and each element of the set represents the probability corresponding to Xi taking the value xi under the paxi∈PaXi condition, where PaXi is the set of Xi, the parent variables in G, and PaXi is a composition of PaXi. B defines on U the unique joint probability distribution:(5)PBX1,…,Xn=∏i=1nPBXi|PaXi.Learning Bayesian networks from data can be formulated as follows: given a training sample setD=u1,…,uN defined on U, find the network B that best matches D. The usual approach is to introduce a scoring function to compute every possible network on this training set and find the optimal one. General Bayesian network classifier (GBN) treats class nodes and attribute nodes as network nodes of equal status and trains Bayesian networks based on the selected scoring function and sample data, which are directly used as classification models. Since the structure learning of Bayesian networks is itself an NP-complete problem, it is impossible to search the entire network structure space under the current conditions, so this paper is limited to studying a special Bayesian classification model, i.e., the tree-enhanced Naive Bayesian classification model.


### 3.3. Tree Augmented Naive Bayesian Classification Model

The tree augmented Naive Bayesian classifier (TAN) is a constrained Bayesian net defined onU∗=A1,…,An,C, where A is a discrete attribute variable and C is a class variable. The attributes PaC=∅ and PaAi of Bayesian network are shown in Figure 1. This type of model has been proved by Geiger and learned by Bayesian net algorithm with Chow and Liu learning tree structure. The TAN classification model constructed in this way has been widely used because it has been shown experimentally that it usually has good classification accuracy at a small cost. However, TAN requires variables to be discrete, and credit assessment problems often involve mixed variables (attribute variables that contain both discrete and continuous variables), so if TAN is used directly in credit assessment, the attributes containing continuous variables need to be pre-dissociated, which loses the information contained in continuous variables and increases the computational effort itself (the size of the cardinality is also difficult to determine in advance). Moreover, too many discrete values will increase the computational complexity by increasing the storage space required by the algorithm, so it is necessary to consider the case of continuous attributes.Figure 1
Structure of tree-enhanced Naive Bayesian network.


### 3.4. Constructing a Naive Bayesian Network Mathematics Application Teaching Model

Regarding the construction method of the model conditional probability distribution, it is as follows. The establishment of a Bayesian network classification model for teaching mathematics applications mainly requires consideration of two aspects: first, determining the structure of the network; second, learning the conditional probability distributions of the attribute variables and determining the class prior probabilities. For the case where the attribute variables are all discrete, the learning can be done according to the conditional probability distribution table, and the learning method also adopts the method of great likelihood estimation, which is estimated by the empirical frequency of the training samples [21, 22].There are many parametric probability models to express the distribution of continuous variables, and in this paper, we assume Gaussian distribution. There are three cases in ETAN.(1)
Only class variables are parents of continuous variablesXi: for each value of C, C=k corresponds to a one-dimensional Gaussian distribution with mean μk=EXi|C=k and variance σk2=EXi2|C=k−E2Xi|C=k.(2)
The class variable C and a discrete variableAj, which is the parent of the continuous variable Xi: for each value of c and AjC=k, Aj=l corresponds to a one-dimensional Gaussian distribution with a mean of μk,l=EXi|C=k,Aj=l and a variance of σk,l2=EXi2|C=k,Aj=l−E2Xi|C=k,Aj=l.(3)
With class attributec and continuous variables Xi as parents: for each C = k after setting Xi,Xj the joint distribution function to be a binary Gaussian distribution, the conditional distribution of Xi given C=k,Xj=xj is a normal distribution with mean αijk+xjβijk and variance σijk2, where(6)βijk=EXiXj|C=k−EXi|C=kEXj|C=kEXj2|C=k−E2Xi|C=kαijk=EXi|C=k−βij×EXj|C=kσijk2=EXi2|C=k−E2Xi|C=k−XiXj|C=k−EXi|C=kEXj|C=k2EXj2|C=k−E2Xj|C=k.(4)
For a conditional probability distribution where the other parent variable is continuous and the child variables are discrete, in addition to the class variables, the following variant is used. LetAi be the discrete variable, Xj be the continuous variable, fxj:C=k,Ai=l be the distribution density function of Xj under C=k,Ai=l conditions, and gxj:C=k be the distribution density function of xj under C=k conditions. For any fixed ε>0 and for any xj, considering the following conditional probabilities, we have(7)PAi=l|xj<Xj≤xj+ε,C=k=PAi=l,xj<Xj≤xj+ε|C=kPxj<Xj≤xj+ε|C=k=Pxj<Xj≤xj+ε|Ai=li,C=kPAi=l|C=kPxj<Xj≤xj+ε|C=k=∫xjxj+εfxj:C=k,Ai=ldxjPAi=l|C=k∫xjxj+εgxj:C=kdxj.Theorem 1.
Iffx,gx is continuous on a,b, gx≠0, and x∈a,b, then there exists at least one point ξ in a,b such that(8)∫abfxdx∫abgxdx=fξgξa<ξ<b.From Theorem1 and gxj:C=k>0gxj:C=k, which are normal density functions, we have(9)PAi=l|xj<Xi≤xj+ε,C=k=fξ:C=k,Ai=lPAi=l|C=kgξ:C=kxj<ξ<xj+ε.Whenε⟶0, then(10)limε⟶0PAi=l|xj<Xj≤xj+ε,C=k=fxj:C=k,Ai=lPAi=l|C=kgxj:C=k.The prior probability of each category, which can be specified based on expert knowledge, must be guaranteed (∑PC=cj=1) and can be estimated as the proportion of each category in the training sample if there is no reliable experience [23–25].The complete design process for teaching mathematical applications based on Naive Bayes is shown in Figure2.Figure 2
Teaching design process of mathematical application based on Naive Bayes.


## 3.1. Naive Bayesian Principle

LetU = {X, C} be a finite set of random variables, where X=X1,…,Xn is the set of attribute variables and C is a class variable taking values in the range c1,…,cl, and xi is the value of attribute Xi. The probability that sample xi=x1,…,xn belongs to ci can be expressed by Bayes’ theorem as(3)PC=cjX=xi=Pcj·Px1,…,xn/cjPx1,…,xn=α⋅Pcj·Px1,…,xncj,where α is the regularization factor, Pcj is the prior probability of class cj, and Px1,…,xn/cj is the likelihood of class cj with respect to Xi.By the chain rule of probability, equation (3) can be expressed as(4)pcjcjPcj|x1,…,xn=α⋅Pcj⋅∏i=1nPxi|x1,…,xi−1,cj.Given a training sample setD=u1,…,uN, the goal of the classification task is to analyze the training sample set D and determine a mapping function f: x1,…,xn⟶C, such that the class label can be labeled for any instance xi=x1,…,xn of an unknown class. According to the Bayesian maximum posterior criterion, given a certain instance and xi=x1,…,xn, the Bayesian classification model selects the class with the largest posterior probability Pcj|x1,…,xn as the class label for that instance.Using Bayesian networks as a classification tool is actually solving equation (4) with Bayesian networks, and it is possible to find Pxi|x1,…,xi−1,cj and determine the category from equation (4) according to the Bayesian maximum posterior criterion.


## 3.2. Bayesian Networks

A Bayesian network is a jointU=X1,…,Xn, coding of probability distributions consisting of a collection of random variables. Formally a pair of binary groups B=G,Θ⋅G is a directed acyclic graph (DAG) whose nodes correspond to random variables X1,…,Xn and whose directed edges represent the dependencies between variables, and the structure G of the graph encodes the independence assumption that given the parent of each node, the node is independent of its non-self-derived children; the second part of the binary, i.e., Θ, represents the set of conditional probability distributions for each variable of this network, and each element of the set represents the probability corresponding to Xi taking the value xi under the paxi∈PaXi condition, where PaXi is the set of Xi, the parent variables in G, and PaXi is a composition of PaXi. B defines on U the unique joint probability distribution:(5)PBX1,…,Xn=∏i=1nPBXi|PaXi.Learning Bayesian networks from data can be formulated as follows: given a training sample setD=u1,…,uN defined on U, find the network B that best matches D. The usual approach is to introduce a scoring function to compute every possible network on this training set and find the optimal one. General Bayesian network classifier (GBN) treats class nodes and attribute nodes as network nodes of equal status and trains Bayesian networks based on the selected scoring function and sample data, which are directly used as classification models. Since the structure learning of Bayesian networks is itself an NP-complete problem, it is impossible to search the entire network structure space under the current conditions, so this paper is limited to studying a special Bayesian classification model, i.e., the tree-enhanced Naive Bayesian classification model.


## 3.3. Tree Augmented Naive Bayesian Classification Model

The tree augmented Naive Bayesian classifier (TAN) is a constrained Bayesian net defined onU∗=A1,…,An,C, where A is a discrete attribute variable and C is a class variable. The attributes PaC=∅ and PaAi of Bayesian network are shown in Figure 1. This type of model has been proved by Geiger and learned by Bayesian net algorithm with Chow and Liu learning tree structure. The TAN classification model constructed in this way has been widely used because it has been shown experimentally that it usually has good classification accuracy at a small cost. However, TAN requires variables to be discrete, and credit assessment problems often involve mixed variables (attribute variables that contain both discrete and continuous variables), so if TAN is used directly in credit assessment, the attributes containing continuous variables need to be pre-dissociated, which loses the information contained in continuous variables and increases the computational effort itself (the size of the cardinality is also difficult to determine in advance). Moreover, too many discrete values will increase the computational complexity by increasing the storage space required by the algorithm, so it is necessary to consider the case of continuous attributes.Figure 1
Structure of tree-enhanced Naive Bayesian network.


## 3.4. Constructing a Naive Bayesian Network Mathematics Application Teaching Model

Regarding the construction method of the model conditional probability distribution, it is as follows. The establishment of a Bayesian network classification model for teaching mathematics applications mainly requires consideration of two aspects: first, determining the structure of the network; second, learning the conditional probability distributions of the attribute variables and determining the class prior probabilities. For the case where the attribute variables are all discrete, the learning can be done according to the conditional probability distribution table, and the learning method also adopts the method of great likelihood estimation, which is estimated by the empirical frequency of the training samples [21, 22].There are many parametric probability models to express the distribution of continuous variables, and in this paper, we assume Gaussian distribution. There are three cases in ETAN.(1)
Only class variables are parents of continuous variablesXi: for each value of C, C=k corresponds to a one-dimensional Gaussian distribution with mean μk=EXi|C=k and variance σk2=EXi2|C=k−E2Xi|C=k.(2)
The class variable C and a discrete variableAj, which is the parent of the continuous variable Xi: for each value of c and AjC=k, Aj=l corresponds to a one-dimensional Gaussian distribution with a mean of μk,l=EXi|C=k,Aj=l and a variance of σk,l2=EXi2|C=k,Aj=l−E2Xi|C=k,Aj=l.(3)
With class attributec and continuous variables Xi as parents: for each C = k after setting Xi,Xj the joint distribution function to be a binary Gaussian distribution, the conditional distribution of Xi given C=k,Xj=xj is a normal distribution with mean αijk+xjβijk and variance σijk2, where(6)βijk=EXiXj|C=k−EXi|C=kEXj|C=kEXj2|C=k−E2Xi|C=kαijk=EXi|C=k−βij×EXj|C=kσijk2=EXi2|C=k−E2Xi|C=k−XiXj|C=k−EXi|C=kEXj|C=k2EXj2|C=k−E2Xj|C=k.(4)
For a conditional probability distribution where the other parent variable is continuous and the child variables are discrete, in addition to the class variables, the following variant is used. LetAi be the discrete variable, Xj be the continuous variable, fxj:C=k,Ai=l be the distribution density function of Xj under C=k,Ai=l conditions, and gxj:C=k be the distribution density function of xj under C=k conditions. For any fixed ε>0 and for any xj, considering the following conditional probabilities, we have(7)PAi=l|xj<Xj≤xj+ε,C=k=PAi=l,xj<Xj≤xj+ε|C=kPxj<Xj≤xj+ε|C=k=Pxj<Xj≤xj+ε|Ai=li,C=kPAi=l|C=kPxj<Xj≤xj+ε|C=k=∫xjxj+εfxj:C=k,Ai=ldxjPAi=l|C=k∫xjxj+εgxj:C=kdxj.Theorem 1.
Iffx,gx is continuous on a,b, gx≠0, and x∈a,b, then there exists at least one point ξ in a,b such that(8)∫abfxdx∫abgxdx=fξgξa<ξ<b.From Theorem1 and gxj:C=k>0gxj:C=k, which are normal density functions, we have(9)PAi=l|xj<Xi≤xj+ε,C=k=fξ:C=k,Ai=lPAi=l|C=kgξ:C=kxj<ξ<xj+ε.Whenε⟶0, then(10)limε⟶0PAi=l|xj<Xj≤xj+ε,C=k=fxj:C=k,Ai=lPAi=l|C=kgxj:C=k.The prior probability of each category, which can be specified based on expert knowledge, must be guaranteed (∑PC=cj=1) and can be estimated as the proportion of each category in the training sample if there is no reliable experience [23–25].The complete design process for teaching mathematical applications based on Naive Bayes is shown in Figure2.Figure 2
Teaching design process of mathematical application based on Naive Bayes.


## 4. Case Study

Based on the mathematics application teaching course of a middle school, we evaluate the teaching design based on Naive Bayes. The specific experimental results are shown in Figure3.Figure 3
The results of students’ adaptation to mathematics application teaching.The assessment indexes commonly used in teaching mathematical applications are generally selected from three aspects: selection of materials, teaching arrangement, and professional integration. The results are shown in Figure4.Figure 4
The comparison of different students.The relationship between mathematics and various fields has become increasingly close, which has put forward newer and higher requirements for mathematics education, as shown in Figure5.Figure 5
The efficiency of different students in this method is different.


## 5. Conclusion

By guiding students to discover mathematical problems in their lives and cultivating their sense of application, we have changed the passive state of students in the learning process and encouraged them to explore more actively and proactively. When teaching, introduce students to the content of the history of mathematics. For example, when we talk about infinitesimals in advanced mathematics, we can add the arguments about infinitesimals to students; when we talk about some paradoxes in mathematics, we can introduce the mathematical crisis caused by mathematical paradoxes. It also enhances students’ interest in learning and confidence in learning mathematics; develops students’ ability to collect and process information; develops students’ sense of cooperation and ability to work together; and develops students’ ability to apply their knowledge to solve problems.



---

*Source: 7244001-2022-06-24.xml*