Python libraries for building a decision system
In this section, we explore some Python libraries to build our decision system. I focus on Bayesian and fuzzy logic models for implementing the decision system.
Bayesian
We can implement Bayesian probability using Python. For our demo, we generate output values from two independent variables, x1 and x2. The output model is defined as follows:
c is a random value. We define α, β1, β2, and σ as 0.5, 1, 2.5, and 0.5.
These independent variables are generated using a random object from the NumPy library. After that, we compute the model with these variables.
We can implement this case with the following scripts:
import matplotlib matplotlib.use('Agg') import numpy as np import matplotlib.pyplot as plt # initialization np.random.seed(100) alpha, sigma = 0.5, 0.5 beta = [1, 2.5] size = 100 # Predictor variable X1 = np.random.randn(size) X2 = np.random.randn(size) * 0.37 # Simulate outcome variable Y = alpha + beta[0]*X1 + beta[1]*X2 + np.random.randn...