This assignment uses a linear programming routine to predict wine quality from chemical measurements.
Note that the files can be downloaded here.
- Dataset (winesinfo.csv): In each line, the first 11 columns contain the results from various chemical tests performed on the wine, and the last column is the evaluation of how good the wine is (a score between 0 and 10).
- Linear Model (Linear_Progamming): This matlab file contains a linear program described below.
Consider a model based on Linear programming. For wine sample , let us denote by its score and by its chemical properties. We will here construct a linear model to predict as a function of . That is, we want to find and such that
The quality of the model will be evaluated using the norm, i.e., we want to find a solution to this optimization problem:
Suppose that and . Notice that we can define a new variable to represent the values of in the objective function. Therefore, the optimization program can be rewritten as below:
The objective function is
with respect to the constraints:
for . Observe that we can also rewrite the constraints as
We can then define
Respectively, we can write
and the dashed line separates the two “types” of inequality constraints. Therefore, we can write the constraints as
The objective function then can be written as
Therefore, from the discussions above, we can rewrite the original system as
The formation is exactly the same as stated above in Matlab. One can check and test the files from here.
The result is displayed in the command window. It says that the optimal value is 0.4937, which is an error within an acceptable range.