Development of a Machine Learning Model to Predict the Color of Extruded Thermoplastic Resins

The conventional method for the color-matching process involves the compounding of polymers with pigments and then preparing plaques by using injection molding before measuring the color by an offline spectrophotometer. If the color fails to meet the L*, a*, and b* standards, the color-matching process must be repeated. In this study, the aim is to develop a machine learning model that is capable of predicting offline color using data from inline color measurements, thereby significantly reducing the time that is required for the color-matching process. The inline color data were measured using an inline process spectrophotometer, while the offline color data were measured using a bench-top spectrophotometer. The results showed that the Bagging with Decision Tree Regression and Random Forest Regression can predict the offline color data with aggregated color differences (dE) of 10.87 and 10.75. Compared to other machine learning methods, Bagging with Decision Tree Regression and Random Forest Regression excel due to their robustness, ability to handle nonlinear relationships, and provision of insights into feature importance. This study offers valuable guidance for achieving Bagging with Decision Tree Regression and Random Forest Regression to correlate inline and offline color data, potentially reducing time and material waste in color matching. Furthermore, it facilitates timely corrections in the event of color discrepancies being observed via inline measurements.


Introduction
Color analysis stands as a crucial tool with a myriad of applications.Color analysis plays a pivotal role in determining tolerances for automotive coatings, ensuring the ultimate satisfaction of the end products.This becomes particularly crucial as automobiles are composed of a diverse range of materials.It is essential to verify that the color coating maintains a consistent and uniform appearance when applied to different materials with varying textures [1].Additionally, Ariño et al. explored the impact of a plastic texture on color perception.Their conclusion highlighted the noteworthy influence that the texture of plastic exerts on color perception [2].
To create a standard for color communication during color analysis, the red/green coordinate, and b* is the yellow/blue coordinate.The positive a* axis points roughly towards red color stimuli, the negative axis points approximately towards green stimuli, the positive b* axis points approximately towards yellow stimuli, and the negative b* axis points approximately towards blue stimuli.L* is associated with the luminance of the stimulus, making it a basic indicator of lightness [4].The differences in L*, a *, and b* between two specimens, which are also referred to as Delta Values, are calculated using Equations ( 1)-(3).
Historically, the measurement of color has typically been carried out via offline color measurements using offline bench-top spectrophotometers [5].To achieve this, the materials must undergo molding into plates after the extrusion process.However, the preparation of samples for offline color measurement is a labor-intensive and time-consuming task, resulting in delayed measurement reports.This delay carries a significant risk of producing products that may not meet specifications during the waiting period [6].
An offline bench-top spectrophotometer serves as a specialized instrument, tailored for conducting color measurements and analyses in a laboratory or controlled environment.In contrast to inline spectrophotometers that are seamlessly integrated into production lines for real-time polymer melt flow measurements, the offline bench-top variant excels in delivering precise and accurate color measurements within a stationary setting.
The offline bench-top spectrophotometer incorporates a spherical interior.The design strategically obstructs the light source, directing it from the color chip and reflecting it at an 8-degree angle from the specimen.This configuration ensures that the reflected light is effectively captured by the detector, enabling precise and accurate color measurements.Two commonly employed measurement geometries in offline bench-top spectrophotometers are SCI and SCE [7].
Specular Component Included (SCI): In SCI measurements, the spectrophotometer captures all reflected light, including both specular and diffuse components.This effectively eliminates the impact of specular reflection from the surface, allowing the measurement to focus solely on color rather than appearance.As a result, SCI is universally adopted by companies for formulating color recipes.
Specular Component Excluded (SCE): In SCE measurements, the spectrophotometer selectively records only the diffuse reflection of light from the material's surface, excluding specular reflection.This approach incorporates the surface appearance into the measurement.Consequently, SCE proves more valuable for quality control in the production process, especially when a balance between color and appearance is crucial.
Figure 1 shows the working principle of an offline bench-top spectrophotometer with (a) Specular Component Excluded geometry and (b) Specular Component Included geometry.towards red color stimuli, the negative axis points approximately towards green stimuli, the positive b* axis points approximately towards yellow stimuli, and the negative b* axis points approximately towards blue stimuli.L* is associated with the luminance of the stimulus, making it a basic indicator of lightness [4].The differences in L*, a *, and b* between two specimens, which are also referred to as Delta Values, are calculated using Equations ( 1)-(3).
Historically, the measurement of color has typically been carried out via offline color measurements using offline bench-top spectrophotometers [5].To achieve this, the materials must undergo molding into plates after the extrusion process.However, the preparation of samples for offline color measurement is a labor-intensive and time-consuming task, resulting in delayed measurement reports.This delay carries a significant risk of producing products that may not meet specifications during the waiting period [6].
An offline bench-top spectrophotometer serves as a specialized instrument, tailored for conducting color measurements and analyses in a laboratory or controlled environment.In contrast to inline spectrophotometers that are seamlessly integrated into production lines for real-time polymer melt flow measurements, the offline bench-top variant excels in delivering precise and accurate color measurements within a stationary setting.
The offline bench-top spectrophotometer incorporates a spherical interior.The design strategically obstructs the light source, directing it from the color chip and reflecting it at an 8-degree angle from the specimen.This configuration ensures that the reflected light is effectively captured by the detector, enabling precise and accurate color measurements.Two commonly employed measurement geometries in offline bench-top spectrophotometers are SCI and SCE [7].
Specular Component Included (SCI): In SCI measurements, the spectrophotometer captures all reflected light, including both specular and diffuse components.This effectively eliminates the impact of specular reflection from the surface, allowing the measurement to focus solely on color rather than appearance.As a result, SCI is universally adopted by companies for formulating color recipes.
Specular Component Excluded (SCE): In SCE measurements, the spectrophotometer selectively records only the diffuse reflection of light from the material's surface, excluding specular reflection.This approach incorporates the surface appearance into the measurement.Consequently, SCE proves more valuable for quality control in the production process, especially when a balance between color and appearance is crucial.
Figure 1   Conversely, an inline color measurement involves conducting direct color measurements on the polymer melt, which is already pigmented, preferably within the compound extruder itself [5], by using an inline process spectrophotometer (IPS).This allows operators to examine the polymer during production [8], and they are alerted as soon as the color begins to deviate out-of-spec so that corrections can be made immediately to minimize product rejects and wastage.
The IPS works by illuminating the molten polymer within the die using light from the source at Angle 2, which travels through the fiber optics and a Reflection Polymer Melt Probe (RPMP).The reflected signal from the polymer melt is then captured at Angle 1 and transported back to the IPS.[9] Angle 1 aims to closely approximate the sphere measurement (commonly referred to as diffuse/8 • ) of a bench-top spectrophotometer, which is set at 8 degrees.However, owing to equipment constraints, the optimal angle that it can attain is Angle 1. Figure 2 shows the working principle of the inline process spectrophotometer.Conversely, an inline color measurement involves conducting direct color measurements on the polymer melt, which is already pigmented, preferably within the compound extruder itself [5], by using an inline process spectrophotometer (IPS).This allows operators to examine the polymer during production [8], and they are alerted as soon as the color begins to deviate out-of-spec so that corrections can be made immediately to minimize product rejects and wastage.
The IPS works by illuminating the molten polymer within the die using light from the source at Angle 2, which travels through the fiber optics and a Reflection Polymer Melt Probe (RPMP).The reflected signal from the polymer melt is then captured at Angle 1 and transported back to the IPS.[9] Angle 1 aims to closely approximate the sphere measurement (commonly referred to as diffuse/8°) of a bench-top spectrophotometer, which is set at 8 degrees.However, owing to equipment constraints, the optimal angle that it can attain is Angle 1. Figure 2 shows the working principle of the inline process spectrophotometer.However, in previous research, it was observed that the scale of the colors of inline and offline color measurements are distinctly different [10].Specifically, the color change in inline measurements is minimal, whereas it registers as significantly more pronounced in offline measurements.This discrepancy emphasizes the need for refined approaches in handling data from these two distinct measurement methods.Addressing this incongruity will facilitate the prediction of the CIE L*, a*, and b* values for the output solid polymer based on the inline color measurement, enabling corrections in case of any detected deviations and averting the rejection of the entire production batch.
In recent times, there has been a discernible shift towards the application of machine learning algorithms and artificial intelligence to model and optimize the relationship between input and output variables.Illustrating this trend is Lee's study, where an Artificial Neural Network (ANN) was implemented.The ANN was specifically designed to predict product properties such as mass, diameter, and height [11].Shams-Nateri's study also demonstrated an application of Neural Networks to relate the color of fibers in the mentioned directions [12].Jeon constructed machine learning models to predict the melting temperature after plasticization [13].Joo devised three models to predict the physical properties of PP composites, employing three distinct machine learning (ML) methods: Multiple Linear Regression (MLR), Deep Neural Network (DNN), and Random Forest (RF) [14].
The utilization of machine learning algorithms to develop predictive models from training data demonstrates significant potential for enhancing product quality and minimizing waste and downtime in the polymer processing industries [15].However, a common drawback that has been observed in many of the machine learning approaches and highlighted in the literature is the opaque nature of these algorithms.Often, it becomes challenging to discern the reasons behind the model's accurate predictions, as they provide little insight into the underlying process factors and relationships influencing the output [16].However, in previous research, it was observed that the scale of the colors of inline and offline color measurements are distinctly different [10].Specifically, the color change in inline measurements is minimal, whereas it registers as significantly more pronounced in offline measurements.This discrepancy emphasizes the need for refined approaches in handling data from these two distinct measurement methods.Addressing this incongruity will facilitate the prediction of the CIE L*, a*, and b* values for the output solid polymer based on the inline color measurement, enabling corrections in case of any detected deviations and averting the rejection of the entire production batch.
In recent times, there has been a discernible shift towards the application of machine learning algorithms and artificial intelligence to model and optimize the relationship between input and output variables.Illustrating this trend is Lee's study, where an Artificial Neural Network (ANN) was implemented.The ANN was specifically designed to predict product properties such as mass, diameter, and height [11].Shams-Nateri's study also demonstrated an application of Neural Networks to relate the color of fibers in the mentioned directions [12].Jeon constructed machine learning models to predict the melting temperature after plasticization [13].Joo devised three models to predict the physical properties of PP composites, employing three distinct machine learning (ML) methods: Multiple Linear Regression (MLR), Deep Neural Network (DNN), and Random Forest (RF) [14].
The utilization of machine learning algorithms to develop predictive models from training data demonstrates significant potential for enhancing product quality and minimizing waste and downtime in the polymer processing industries [15].However, a common drawback that has been observed in many of the machine learning approaches and highlighted in the literature is the opaque nature of these algorithms.Often, it becomes challenging to discern the reasons behind the model's accurate predictions, as they provide little insight into the underlying process factors and relationships influencing the output [16].
The objective of this study is to design a machine learning model to predict the offline color measurement data using the inline color measurement and material dosage as input parameters.To achieve this, Bagging with Decision Tree Regression, Deep Neural Network, Multiple Linear Regression, and Random Forest Regression are used as the machine learning model.The performance of the model will be evaluated using aggregated dE, which is similar to the root mean square error (RMSE).The insights gained from this study will facilitate the real-time monitoring and prediction of offline color data during compounding through the utilization of inline color data.This approach enables timely corrections to be implemented in the event of any detected deviations.

Materials
In this study, a compounding process, followed by an injection molding process, was conducted to gather a well-diversified set of data for training the machine learning models.The materials employed in this study include polycarbonate resin, dispersing agent, and pigments.Polycarbonate (PC) (Makrolon ® 2807) was supplied by Covestro, Singapore.PC Makrolon 2807 has a density of 1.20 g/cm 3 and a melt flow rate (MFR) of 10 g/10 min (measured at 300 • C/1.2 kg).Polycarbonate was chosen for its high usage in engineering plastic manufacturing.Ethylene Bis Stearamide (EBS) L-205F dispersing agent was supplied by DP Chemicals Pte Ltd., Singapore.Pigments, which included Tiona 288, Raven 1010, Heliogen Green K8730, Ultramarine Blue 05, Solvent Yellow 114, and Plast Red 8355, were supplied by Hexachem (M) Sdn.Bhd, Selangor, Malaysia, and DP Chemicals Pte Ltd., Singapore.
Formulations crafted for PC experiments are tabulated in Table 1.The components in each formulation were first manually hand-tumbled to ensure uniformity before feeding them into the extruder.

Compounding Equipment
Compounding was performed by using an intermeshing co-rotating twin screw extruder (Coperion GmbH, Stuttgart, Germany).It has a 26 mm screw diameter, an L-to-D ratio of 44, is powered by a 27-kW motor, and features 11 heating zones for the barrel along with one for the die.The barrel temperatures were set at 260-280 • C for PC, with a screw speed of 230 rpm.Upon exiting the die, the extrudate was quenched in cold water, dried using air, and then converted into pellets via a pelletizer.The pellets were then molded via injection molding (Sumitomo C250, Singapore) with a clamp tonnage of 100 tons into a cuboid color chip (95 mm by 55 mm by 2 mm), as shown in Figure 3.The dimension of the color chip was selected based on the industrial standard in the polymer compounding industry.The injection barrel temperature was set at 260-280 • C at an injection speed of 120 mm/s, with mold temperatures of 100

Compounding Equipment
Compounding was performed by using an intermeshing co-rotating twin screw extruder (Coperion GmbH, Stuttgart, Germany).It has a 26 mm screw diameter, an L-to-D ratio of 44, is powered by a 27-kW motor, and features 11 heating zones for the barrel along with one for the die.The barrel temperatures were set at 260-280 °C for PC, with a screw speed of 230 rpm.Upon exiting the die, the extrudate was quenched in cold water, dried using air, and then converted into pellets via a pelletizer.The pellets were then molded via injection molding (Sumitomo C250, Singapore) with a clamp tonnage of 100 tons into a cuboid color chip (95 mm by 55 mm by 2 mm), as shown in Figure 3.The dimension of the color chip was selected based on the industrial standard in the polymer compounding industry.The injection barrel temperature was set at 260-280 °C at an injection speed of 120 mm/sec, with mold temperatures of 100 °C.The specimen was conditioned at 23 ± 2 °C for 24 h before color measurements.

Color Measurement
In our experiment, the color measurement of the polymer melt was conducted using Equitech's EQUISPEC™ Inline Process Spectrophotometer (IPS) (Equitech, Charlotte, NC, USA), along with a Reflection Polymer Melt Probe (RPMP).The RPMP was mounted at the die head of the extruder and ensured that there was ample shear force to consistently cause the new polymer melt to shear across the RPMP.
The data acquisition rate of the color measurement of polymer melts was set at every 2 s.The CIE L* a* b* color reading [3] from the spectrophotometer was recorded as the inline measurement by using D65 as the standard illuminant [17] and a standard observer angle of 10 degrees.IPS has a measurement uncertainty of 0.01 unit for CIE L* a* b* color reading.The mean data were only collected after 5 min when the reading is stabilized and shown in Table A1.The measurement period was 5 min.
For offline color measurement, we used an X-Rite Ci7800 bench-top Spectrophotometer [18] (X-Rite-Southeast Asia and Pacific, Singapore) with a 400 mm UV filter, equipped with Color iMatch professional software (Version 10.7.2).A 10° supplementary standard observer and D65 illuminant [17] were used, coupled with SCI mode.Given that

Color Measurement
In our experiment, the color measurement of the polymer melt was conducted using Equitech's EQUISPEC™ Inline Process Spectrophotometer (IPS) (Equitech, Charlotte, NC, USA), along with a Reflection Polymer Melt Probe (RPMP).The RPMP was mounted at the die head of the extruder and ensured that there was ample shear force to consistently cause the new polymer melt to shear across the RPMP.
The data acquisition rate of the color measurement of polymer melts was set at every 2 s.The CIE L* a* b* color reading [3] from the spectrophotometer was recorded as the inline measurement by using D65 as the standard illuminant [17] and a standard observer angle of 10 degrees.IPS has a measurement uncertainty of 0.01 unit for CIE L* a* b* color reading.The mean data were only collected after 5 min when the reading is stabilized and shown in Table A1.The measurement period was 5 min.
For offline color measurement, we used an X-Rite Ci7800 bench-top Spectrophotometer [18] (X-Rite-Southeast Asia and Pacific, Singapore) with a 400 mm UV filter, equipped with Color iMatch professional software (Version 10.7.2).A 10 • supplementary standard observer and D65 illuminant [17] were used, coupled with SCI mode.Given that the surface texture can induce diffusion and scattering of light, influencing color appearance [19], the SCI mode was exclusively preferred for assessing color rather than appearance.The CIE L* a* b* color readings from the spectrophotometer were documented as offline measurements.The bench-top spectrophotometer used in this study has a measurement uncertainty of 0.01 unit for CIE L* a* b*.The mean data were calculated based on the average reading of 10 pieces of color chips for each dosage and shown in Table A1.

Machine Learning Architectures
In this paper, four machine learning models were employed for predictions: Bagging with Decision Tree Regression, Deep Neural Network, Multiple Linear Regression, and Random Forest Regression.

Bagging with Decision Tree Regression
The Bagging with Decision Tree Regression model is a combination of Bagging Regression and Decision Tree Regression.
A Decision Tree Regression is a predictive model that maps features of an input to make decisions or predictions [20].In the context of regression, it is used to predict a continuous outcome based on input features [21].The tree structure consists of nodes representing decisions based on features and leaves representing the predicted outcomes [22].Figure 4 shows an example of the Decision Tree Regression that was generated in this study.The decision tree starts with a root condition of Solvent Yellow 114 with a dosage under 0.005, where it best splits the data to minimize the mean squared error (MSE).It then creates a condition for splitting the data, aiming to reduce the variance in the predicted values which is inline a* ≤ 3.78 and Raven 1010 ≤ 0.013.The recursive splitting process continues, forming a binary tree structure.The goal is to iteratively partition the data into subsets that exhibit lower variance in the target variable.As the tree grows, leaf nodes contain the predicted values for the target variable, which might be the mean or median of the target values in the leaf.During the prediction phase, a new data point traverses the tree, following the path of decisions until it reaches a leaf node.The predicted value is then determined by the value that is associated with that leaf.
the surface texture can induce diffusion and scattering of light, influencing color appearance [19], the SCI mode was exclusively preferred for assessing color rather than appearance.The CIE L* a* b* color readings from the spectrophotometer were documented as offline measurements.The bench-top spectrophotometer used in this study has a measurement uncertainty of 0.01 unit for CIE L* a* b*.The mean data were calculated based on the average reading of 10 pieces of color chips for each dosage and shown in Table A1.

Machine Learning Architectures
In this paper, four machine learning models were employed for predictions: Bagging with Decision Tree Regression, Deep Neural Network, Multiple Linear Regression, and Random Forest Regression.

Bagging with Decision Tree Regression
The Bagging with Decision Tree Regression model is a combination of Bagging Regression and Decision Tree Regression.
A Decision Tree Regression is a predictive model that maps features of an input to make decisions or predictions [20].In the context of regression, it is used to predict a continuous outcome based on input features [21].The tree structure consists of nodes representing decisions based on features and leaves representing the predicted outcomes [22].Figure 4 shows an example of the Decision Tree Regression that was generated in this study.The decision tree starts with a root condition of Solvent Yellow 114 with a dosage under 0.005, where it best splits the data to minimize the mean squared error (MSE).It then creates a condition for splitting the data, aiming to reduce the variance in the predicted values which is inline a* ≤ 3.78 and Raven 1010 ≤ 0.013.The recursive splitting process continues, forming a binary tree structure.The goal is to iteratively partition the data into subsets that exhibit lower variance in the target variable.As the tree grows, leaf nodes contain the predicted values for the target variable, which might be the mean or median of the target values in the leaf.During the prediction phase, a new data point traverses the tree, following the path of decisions until it reaches a leaf node.The predicted value is then determined by the value that is associated with that leaf.Bagging Regression is an ensemble learning technique that involves training multiple decision trees with different feature orders [23].Figure 5 shows the working principle of Bagging Regression.In this process, features are randomly selected and arranged to Polymers 2024, 16, 481 8 of 19 create decision trees.This is repeated multiple times (1000 times in this paper), resulting in a collection of diverse decision trees.When making predictions for new data, the Bagging Regression aggregates the outputs of these individual trees, often by averaging, to provide a more robust and generalized prediction.The randomness introduced in feature selection and ordering helps reduce overfitting, making the model more effective and resilient.The parameters for Bagging with Decision Tree Regression used in this paper are summarized in Table 2.
sion trees.This is repeated multiple times (1000 times in this paper), resulting in a collection of diverse decision trees.When making predictions for new data, the Bagging Regression aggregates the outputs of these individual trees, often by averaging, to provide a more robust and generalized prediction.The randomness introduced in feature selection and ordering helps reduce overfitting, making the model more effective and resilient.The parameters for Bagging with Decision Tree Regression used in this paper are summarized in Table 2.

Deep Neural Network
A Deep Neural Network makes predictions through a process called forward propagation, which involves passing the input data through the network's layers of interconnected

Deep Neural Network
A Deep Neural Network makes predictions through a process called forward propagation, which involves passing the input data through the network's layers of interconnected neurons.Figure 6 shows the working principle of the Deep Neural Network.In this paper, the network is trained for 50 epochs, with each epoch processing batches of 32 samples  3.
Deep Neural Network is utilized to make predictions on new dataset features.The parameters for the Deep Neural Network in this paper are summarized in Table 3.

Multiple Linear Regression
Multiple Linear Regression makes predictions by combining the weighted sum of multiple input features with a constant term.In our paper, the input features are the material dosage and inline L* a* b*.The model learns these weights during training to minimize the difference between its predictions and the actual target values, allowing it to generalize and make accurate predictions on new data by considering multiple input features simultaneously.The parameters for Multiple Linear Regression in this paper are summarized in Table 4.

Multiple Linear Regression
Multiple Linear Regression makes predictions by combining the weighted sum of multiple input features with a constant term.In our paper, the input features are the material dosage and inline L* a* b*.The model learns these weights during training to minimize the difference between its predictions and the actual target values, allowing it to generalize and make accurate predictions on new data by considering multiple input features simultaneously.The parameters for Multiple Linear Regression in this paper are summarized in Table 4.

Random Forest Regression
Random Forest Regression, an ensemble learning technique, refines Bagging principles by introducing more randomization into the construction of individual decision trees.In contrast to Bagging with a Decision Tree Regression, Random Forest Regression selects only a random subset of features, not all, for splitting a node.This deliberate feature subset randomness aims to decrease correlations between trees, enhancing the overall robustness.However, it may potentially miss crucial features.The working principle of Random Forest Regression is illustrated in Figure 7, where a subset of features is randomly chosen for each tree's training.This process is iterated 1000 times.When given new data, the Random Forest Regression aggregates outputs from individual trees to provide a more robust prediction.The parameters for Random Forest Regression in this paper are summarized in Table 5.

Random Forest Regression
Random Forest Regression, an ensemble learning technique, refines Bagging principles by introducing more randomization into the construction of individual decision trees.In contrast to Bagging with a Decision Tree Regression, Random Forest Regression selects only a random subset of features, not all, for splitting a node.This deliberate feature subset randomness aims to decrease correlations between trees, enhancing the overall robustness.However, it may potentially miss crucial features.The working principle of Random Forest Regression is illustrated in Figure 7, where a subset of features is randomly chosen for each tree's training.This process is iterated 1000 times.When given new data, the Random Forest Regression aggregates outputs from individual trees to provide a more robust prediction.The parameters for Random Forest Regression in this paper are summarized in Table 5.

Data Exploration through the Pearson Correlation Coefficient
To enhance prediction accuracy, understanding the linear relationship between features-material dosage and inline color data and the target variables-and offline color data is crucial.The Pearson correlation coefficient (PCC) was employed for this purpose.The PCC measures the strength and direction of the linear relationship between two variables.The PCC was computed using Equation (4).
where X i and Y i are individual data points of the variables X and Y, and X and Y are the means of variables X and Y, respectively.This analysis was primarily undertaken to identify any linear relationships and the necessity of data augmentation for improved model performance.Moreover, the statistical significance of these correlations was assessed to ensure that the observed relationship is not due to random chance but reflects a genuine association in the data.
Table 6 illustrates the correlations between each material and the offline a* value.It is evident that materials that are strongly correlated with the offline a* value include the red pigment, indicating a positive linear relationship, and the blue pigment, indicating a negative linear relationship.This discovery piques interest, given that the a* value is typically impacted by the dosage of both red and green pigments.Nevertheless, the difference in correlation coefficients between green and blue pigments is not considerable.Therefore, it is reasonable to propose that the blue pigment tends to exhibit a greenish tone.7 illustrates the correlations between each material and the offline b* value.The yellow pigment (revealing a positive linear relationship) and blue pigment (revealing a negative linear relationship) exhibit strong correlations with the b* value.This aligns with the CIE L* a* b* color space, where the yellow pigment contributes a positive b* value, and the blue pigment contributes a negative b* value.8 presents the correlations between each material and the offline L* value.The results show that the white pigment (indicating a positive linear relationship), as well as the blue and black pigments (indicating a negative linear relationship), demonstrate strong correlations with the L* value.The positive association with the L* value aligns with the CIE L* a* b* color space, where the white pigment contributes to a positive L* value.It is noteworthy that, apart from the black pigment, the blue pigment also significantly contributes to the negative L* value.This observation suggests that the blue pigment could serve as an alternative to the black pigment in contributing to a negative L* value.
Table 9 displays the correlations between the inline and offline color data, revealing robust associations between the two.The results show that strong correlations between inline and offline color data affirm the potential of inline color data to predict offline color characteristics.These correlations between material dosage, inline L* a* b*, and offline L* a* b* values are critical for identifying relevant features in model training, guiding the approach towards more precise and reliable color prediction.In summary, these findings not only demonstrate significant linear relationships between the chemical components and color data but also adhere to the established principles of the CIE L* a* b* color space.This enhances the understanding of how different materials influence color properties, which is vital for developing more accurate machine learning models for color prediction.

Dataset Allocation
Out of the complete dataset that was generated from the color measurement, which comprises 83 color formulations as presented in Table 1, 74 datasets were designated for training, and the remaining 9 datasets were for testing to assess model performance.The order of the data was randomized before splitting to reduce overfitting and improve the generalization of the data.
Each dataset comprises 11 features and 3 target variables, as illustrated in

Evaluation Metric
The performance of each model was assessed using the aggregated dE, a domainspecific RMSE.RMSE is defined as the standard metric in regression analysis that measures the average magnitude of the errors between predicted and actual values.An aggregated dE gauges the average color difference between predicted and actual values of the test dataset, calculated using Equation (5).Equation (6) shows the equation for calculating RMSE.Lower dE values signify greater accuracy in the model prediction. is the number of samples.

Evaluation Metric
The performance of each model was assessed using the aggregated dE, a domainspecific RMSE.RMSE is defined as the standard metric in regression analysis that measures the average magnitude of the errors between predicted and actual values.An aggregated dE gauges the average color difference between predicted and actual values of the test dataset, calculated using Equation (5).Equation (6) shows the equation for calculating RMSE.Lower dE values signify greater accuracy in the model prediction.to its inability to capture complex, nonlinear relationships that are present in the dataset, limiting its predictive accuracy.In summary, Bagging with Decision Tree Regression and Random Forest Regression exhibit the lowest aggregated dE values.However, the observed color difference remains too high for practical production use.The impact of the sample size on reducing the color difference will be explored in the next section to assess the feasibility of achieving more satisfactory results.

Impact of Sample Size on Machine Learning Accuracy
To understand the effect of the sample size on model accuracy, a systematic analysis of how increasing sample sizes influence the aggregated dE for various models that are referenced in this paper was conducted.Each model architecture was trained and evaluated using various sample sizes.These samples were obtained as random subsets of the total training samples and selected without replacement, ensuring the uniqueness and variability of each sample set. Figure 9 illustrates the aggregated dE plotted against the number of samples for each model type.
In Figure 9a, a decline in the aggregated dE is observed for Bagging with Decision Tree Regression as the sample size increases.This trend suggests enhanced predictive accuracy, likely due to the model's exposure to a broader range of feature variations within the larger datasets.
Conversely, Figure 9b demonstrates a decrease in the aggregated dE for the Deep Neural Network model up to a sample size of 45.Beyond this point, the aggregated dE increases.There might be several explanations for this, but it is likely an overfitting issue, as the model learns the noise of the additional data instead of capturing the underlying patterns [24].
Figure 9c reveals an initial rise in the aggregated dE for Multiple Linear Regression with increasing sample sizes, followed by a decrease after reaching 45 samples.This pattern is consistent with findings in Knofczynski's research, underscoring the necessity of a minimum sample size for accurate predictions [25].Smaller sample sizes might result in misleading outcomes due to insufficient data representation.
Finally, Figure 9d shows that the Random Forest Regression exhibits a trend that is akin to Bagging with Decision Tree Regression.The aggregated dE decreases as more samples are introduced, which is expected given their common underlying mechanism based on Decision Tree Regression.
These observations suggest that the Bagging with Decision Tree Regression and Random Forest Regression provide the highest and most consistent returns (in terms of aggregated dE) for a given increase in the dataset compared to other models.
Table 11 highlights the pros and cons of our study compared with previous studies.
of how increasing sample sizes influence the aggregated dE for various models that are referenced in this paper was conducted.Each model architecture was trained and evaluated using various sample sizes.These samples were obtained as random subsets of the total training samples and selected without replacement, ensuring the uniqueness and variability of each sample set. Figure 9 illustrates the aggregated dE plotted against the number of samples for each model type.

Pros
Less probability of overfitting [20] Incorporated multi-task learning, where learning does not occur solely for one task [11] Fast calculation speed [14] Effective for learning with limited samples [26] Simple model [20] Able to implicitly detect complex nonlinear relationships between dependent and independent variables [27] Robust for learning with strong data error [26] Robust to the effect of noisy data [28] Feasible for nonlinear or approximately linear problems [26] Cons Uses significant computational complexity [29] Unexplained behaviors of the model [30] Assumes data are normally distributed, homogenous in variance, and independent of one another [31] Uses significant computational resources, as they require several splitting and evaluations of candidate splits [20] Loss of simplicity compared to a simple decision tree [29] The duration of training a Neural Network is unknown [30] There are no equations linking the variables with the predicted variable [32] Proneness to overfitting [ International Commission on Illumination (CIE) developed the CIE L* a* b* color space in 1976.The CIE 1976 L* a* b* color space is a three-dimensional, approximately uniform color space, produced by plotting in rectangular coordinates, L*, a*, and b* [3].L* indicates lightness, a* is Polymers 2024, 16, 481 2 of 19

Figure 1 .
Figure 1.Working principle of an offline bench-top spectrophotometer with (a) Specular Component Excluded and (b) Specular Component Included.

Figure 1 .
Figure 1.Working principle of an offline bench-top spectrophotometer with (a) Specular Component Excluded and (b) Specular Component Included.

Figure 2 .
Figure 2. Working principle of inline process spectrophotometer.

Figure 2 .
Figure 2. Working principle of inline process spectrophotometer.

Figure 3 .
Figure 3. Image of injection-molded color chip used in this study.

Figure 3 .
Figure 3. Image of injection-molded color chip used in this study.

Figure 4 .
Figure 4. Working principle of decision trees.Figure 4. Working principle of decision trees.

Figure 4 .
Figure 4. Working principle of decision trees.Figure 4. Working principle of decision trees.

Figure 5 .
Figure 5. Working principle of Bagging with Decision Tree Regression.

Figure 5 .
Figure 5. Working principle of Bagging with Decision Tree Regression.
, considering the small sample size.The Deep Neural Network comprises three layers: an input layer with 128 neurons using Rectified Linear Unit (ReLU) activation, a hidden layer with 64 neurons and ReLU activation, and an output layer with three neurons corresponding to the targets (offline L*, a*, b*).The network is compiled using the Adam optimizer and the mean squared error loss function, commonly chosen for regression problems.Once trained, the Deep Neural Network is utilized to make predictions on new dataset features.The parameters for the Deep Neural Network in this paper are summarized in Table

Figure 6 .
Figure 6.Working principle of Deep Neural Networks.

Figure 6 .
Figure 6.Working principle of Deep Neural Networks.

Figure 7 .
Figure 7. Working principle of Random Forest.Figure 7. Working principle of Random Forest.

Figure 7 .
Figure 7. Working principle of Random Forest.Figure 7. Working principle of Random Forest.

Figure 8 .
The features are categorized into two groups: the dosage of each material and inline L* a* b*.The target variables include offline L* a* b* values.These datasets will be employed for model training and performance evaluation.

Figure 8 .
Figure 8. Summary of features and target variables.

Figure 9 .
Figure 9. Plot of root mean square error against sample size for (a) Bagging with Decision Tree Regression, (b) Deep Neural Network, (c) Multiple Linear Regression, and (d) Random Forest Regression.Figure 9. Plot of root mean square error against sample size for (a) Bagging with Decision Tree Regression, (b) Deep Neural Network, (c) Multiple Linear Regression, and (d) Random Forest Regression.

Figure 9 .
Figure 9. Plot of root mean square error against sample size for (a) Bagging with Decision Tree Regression, (b) Deep Neural Network, (c) Multiple Linear Regression, and (d) Random Forest Regression.Figure 9. Plot of root mean square error against sample size for (a) Bagging with Decision Tree Regression, (b) Deep Neural Network, (c) Multiple Linear Regression, and (d) Random Forest Regression.

Table 1 .
Formulation of polycarbonate with different pigments to build the dataset.
• C. The specimen was conditioned at 23 ± 2 • C for 24 h before color measurements.

Table 2 .
Machine learning model architecture of Bagging with Decision Tree Regression.

Table 2 .
Machine learning model architecture of Bagging with Decision Tree Regression.

Table 3 .
Machine learning model architecture of Deep Neural Networks.

Table 3 .
Machine learning model architecture of Deep Neural Networks.

Table 4 .
Machine learning model architecture of Multiple Linear Regression.

Table 4 .
Machine learning model architecture of Multiple Linear Regression.

Table 5 .
Machine learning model architecture of Random Forest.

Table 5 .
Machine learning model architecture of Random Forest.

Table 6 .
Pearson correlation coefficients between chemical components and offline a* value.

Table 7 .
Pearson correlation coefficients between chemical components and offline b* value.

Table 8 .
Pearson correlation coefficients between chemical components and offline L* value.

Table 9 .
Pearson correlation coefficients between inline and offline color data.
is the number of samples.

Table 10
displays the aggregated dE of each model at a sample size of 83 and a test sample size of 9.Both Bagging with Decision Tree Regression and Random Forest exhibit the lowest aggregated dE values of 10.84 and 10.75, respectively.In contrast, the Deep Neural Network demonstrates a higher aggregated dE, indicating overfitting caused by the limited sample size.Multiple Linear Regression also exhibits a high aggregated dE

Table 10
displays the aggregated dE of each model at a sample size of 83 and a test sample size of 9.Both Bagging with Decision Tree Regression and Random Forest exhibit the lowest aggregated dE values of 10.84 and 10.75, respectively.In contrast, the Deep Neural Network demonstrates a higher aggregated dE, indicating overfitting caused by the limited sample size.Multiple Linear Regression also exhibits a high aggregated dE due

Table 10 .
Table of machine learning model and its aggregated dE values.

Table 11 .
Table of comparison of pros and cons between current and previous studies.