Data Science in a Bakery: Is Standardization Necessary in Process Modeling?
Standardisation is one of the methods of processing raw data prepared to be introduced into econometric models.
The purpose of this processing is to match the data to one common scale.
As defined, standardisation consists of the processing of the entire population in order to obtain harmonised statistical parameters,
means the mean of the population of 0 and the standard deviation of 1.
We standardize the input data to the model so that all variables have similar statistical characteristics.
And here there are two mistakes made usually by beginners.
W-MOSZCZYNSKI-2024-1-34Values of variables may exceed threshold 1 and -1
First, if the standard deviation is equal to one, it does not mean that the scale of the variables stops at values 1 and -1.
This means that variables can have different values from 0.1 even after -2 but the sum of deviations will be 1.
This error is due to the similarity of the standardisation process to the popular standardisation process.
Standardisation is the process of processing input variables so that the values of variables are between 0 and 1 or otherwise from -1 to 1.
When standardization is not allowed, the variable exceeds the absolute value threshold 1.
In the case of standardization, variables may freely exceed the value tests, but the sum of deviations shall not deviate significantly from the value 1.
The distribution of the probability of standardised data does not need to be similar to normal distribution
Each beginner data analyst knows that the typical feature of normal distribution is the statistical characteristics described as mean of zero and standard deviation equal to 1.
It so happens that the same parameters have the population after standardization.
Hence the likely thought error that after standardization we will get a beautiful normal distribution of probability density.
The standardization is described by a linear function. If we substitute a number to a linear function, we get a multiple of this value.
If we multiply all the values from the population by 2 or add 7 then we have the same structure of values.
For example, when we have a data collection consisting of a specific weight of one kind of bread.
We're doing a preliminary analysis that says that 20% of the bread is too heavy compared to the established standard, and 45% of the bread is underweight.
Now, if we divide this data by the number 15, then we'll have the bread weight structure preserved according to the accepted characteristics: 20/35/45.
The standardization function is linear and is written as: z = (x − μ) / σ, where μ is the population mean and σ is the population standard deviation before standardization.
Example
Let's assume that we are carrying out a project aimed at improving the satisfaction of the bakery's final customers.
We need to improve the baking process so that our customers are more satisfied.
The baking process has many types of variables that can be useful for modeling production.
So we collect time series describing the temperature inside the furnace, where the temperature range is 90 to 300°C,
humidity in the range of 20-60% (recorded in data as 0,2 to 0,6) and pressure inside the pipes supplying hot oil to the furnace in the range of 0,6-3 bar.
For our analysis, it is also important to have a number of temperature outside the furnace in the range of 15-25°C. We also have a number of time values of gas consumption in the range 0,005-0,01 m?/min.
This diversity of nominal variables is not good for the modelling process,
because some model algorithms favor the variables with the highest values and neglect the values relatively low.
This is a typical feature of e.g. regression of Ridge and many other algorithms.
In our case, based on our own guesses, we suspect that the highest impact on bread quality is the temperature outside the furnace chamber.
When extracting bread from the oven, the temperature difference may result in a characteristic skin that may be crucial for final customers.
I think everyone likes the skin, only the one on the bread must be suitable, not cracked, not too thin.
The temperature outside the furnace has a relatively low value for the algorithm of the mentioned regression of Ridge compared to the temperature inside the furnace.
The model can therefore treat this key skin temperature as a negligible factor.
In order to avoid this situation, all collected data should be standardised to the same range of nominal value. This is what standardisation is for.
Clarification of the reasons for such an approach is no longer as obvious as the case
and more frequent potential process errors
standardisation.
The mistake is that some researchers follow one attack standardize everything and then divide the population into a test set and a training set. It's obviously a mistake.
The population should be divided first, and then standardized separately the test set and the training set.
Why? Because the common standardization of these harvests makes them similar,
and yet there is no such situation when the model takes true data when it is already normally working after implementation.
The common standardization of test and training data leads to a specific data leak.
The standardized test set is then somehow related to the standardized training set.
Although this relation is statistically insignificant, the sum of many minor errors leads to a serious error.
So we should do everything we can to avoid minor mistakes.
There are five reasons why we use standardization in our work with modelling or grouping.
1. Comparability of scale
As I explained in the example at the beginning, it is not good for modeling if individual features differ significantly from each other.
This is particularly damaging to some distance based algorithms, such as Support Vector Machine (SVM).
A common scale of characteristics should be achieved within a defined value range.
The limitation of all values to strict statistical characteristics means that all these data will be reduced in proportion.
So if the population distribution was asymmetrical, the standardization will retain this asymmetricality.
Standardisation processes data from the initial value to the normalized value, taking into account the position of these values relative to the average of this characteristic population.
So the temperature inside the furnace and the temperature outside the device after standardization for the layman can be very similar,
However, they remain identical from the point of view of probability density.
This harmonised value characteristics ensures that models will treat all process characteristics in a similar way.
It is worth mentioning that if we put standardised data in the model, also dependent variables, we can expect to receive standardised final results.
This is often a nightmare for beginners. Since standardisation is a linear function, we can perform the reverse standardisation process.
We can also refrain from standardising input output data, i.e. dependent variables.
2. Accelerate the search for convergence
Optimization algorithms are usually based on extreme areas or vector intersection points. Standardisation accelerates the operation of such algorithms.
The surface of the search after standardization is more spherical, making the algorithms easier to find the contact point.
Without standardisation, hypersurfaces are far from each other, which is an obstacle to computing.
3. Standardization reduces the effect of outliers
Using standardization, we reduce the effect of outlying values. For example, if we have two characteristics of independent variables,
with a similar range of values entered in the linear regression model, and one of the characteristics has several deviation values, the result value may be distorted.
In this case, a classical researcher will have to manually eliminate the remaining values.
If we decide to standardise or normalize both indicators, it may not lead to elimination of the non-delaying values.
4. It is necessary to standardise distance-based algorithms
Distance-based algorithms are some algorithms for searching for similarities, for example K-mean algorithm for grouping and K-Nearest Neighbors model (K-NN),
used for classification or regression applications. If we have a very large distance between the average value of variables,
model algorithms have difficulty adjusting the distances that reflect the resulting quality of the calculation. This problem also concerns the grouping of the K-means algorithm.
5. Standardisation helps interpret the magnitude of the influence of individual characteristics on the outcome value
As I wrote at the beginning, some models treat certain variables better if their nominal value is high.
This makes certain features of greater value more important for the modeled process than in the real process. This is often the dysfunction of models.
The continuation of this misinterpretation is wrong business decisions.
Let's go back to our example where we have a high temperature inside the furnace and a low temperature outside the oven.
The validity algorithm of features, e.g. the Shapley model, assessing the importance of independent variables in regression results, will identify,
that e.g. temperature inside the furnace is the most important to improve customer satisfaction.
We remember that the model might think that way, because this variable is nominally the highest of all variables.
We know it's not true, we know that the outside temperature of the oven, or the difference between the outside temperatures and the middle of the oven plays a key role in the quality of the bread crust.
So without standardisation, we make a systematic mistake. If we come to a wrong conclusion, we will not improve the quality of bread and our efforts will fail.
Wojciech Moszczyński — graduate of the Department of Econometrics and Statistics of Nicolaus Copernicus University in Toruń; specialist in econometrics, finance, data science, and management accounting. He specializes in the optimization of production and logistics processes. He conducts research in the area of the development and application of artificial intelligence. For years he has been engaged in the popularization of machine learning and data science in business environments.

Dodaj komentarz