Pan-artifact Removing with Deep Learning, on ISEs

This paper presents a signal-processing method to remove pan-artifact on ISEs with artificial neural networks. An Ion Selective Electrode is used to investigate the concentration of a specific ion from aqueous solution, by measuring the Nernst potential along the glass membrane. However, Application of ISE on a multi-ion solution has problem. First problem is a chemicophysical artifact which is called ion interference effect. Electrically charged particles interact with each other and flows through the glass membrane of different ISEs. Second problem is that movement of liquid directly interfere the glass membrane, causing inaccurate voltage measurement. When multiple ISEs are dipped into same solution, a sensor's signal emission interference voltage measurement of other sensors. Therefore, an ISE is recommended to applied on single-ion solution, without any other sensors applied at the same time. Deep learning approach can remove both artifacts at the same time. The proposed method is designed to remove complex artifacts with one-shot calculation, with MAPE less than 1.8%, and R2 as 0.997. A randomly chosen value of AI-predicted value has MAPE less than 5% (p-value 0.016).


I. INTRODUCTION
Convergence of IT with horticulture is not surprising anymore.Propagation of farming technology is the main trend of agricultural industry around the world.The first approach trend was to precise control of farming environment.It started from basic IoT systems in 10 years ago, but AI based facility control is not special today.[1] The trend of automation of human labors is now changing into automation of knowledge and information.Traditional cultivation methods highly depend on the experience of a farmer.Nowadays, the replacement of experience based know-how is main trend of Farm-tech area.[2,3] On fertilization area, the hottest application is hydroponics aqua culture).Open hydroponic system does not recycle the nutrient solution while closed hydroponic system does.Closed system is very popular around the world today [4], because opened system has the possibility of pollution such as eutrophication.
Recently, many researchers have suggested an ISE based hydroponic approaches in order to measure individual ion concentrations rather than EC or TDS.[5][6][7] An ISE measures concentration of a specific ion by acquisition of membrane voltage, induced by target ions.The Nernst potential E along a thin membrane is defined as equation

⁄ ln( [𝑖𝑜𝑛 𝑜𝑢𝑡 ] [𝑖𝑜𝑛 𝑖𝑛 ] ⁄
), where R is gas constant, T is temperature, z is the number of ions which pass through the membrane, and F is faraday constant.This nature of an ion selective electrode causes 3 kinds of artifacts.

A. Ion Interference Effect
Nernst potential is induced by ion-exchange through the glass membrane with small hole which is designed for a specific target ion.This phenomenon is interfered by other ions.This artifact is described with Nikolsky-Eisenman Equation [8], provided as equation (1), where a is the thermodynamic activity of ion, ki is the selectivity coefficient and zi is the exchange of interfering ion i through glass membranes.
We need to know the thermodynamic activity parameter ai and selectivity coefficient ki for every ion involved in the solution to predict the magnitude of this artifact.Parameter a is defined as equation ( 2), where  is molar chemical potential,   is the chemical potential under some standard condition.
The activity value changes along temperature.Therefore, measurements of molar chemical potential in not-standard condition for all individual ions are required to predict the magnitude of ion interference effect, with equation (1).This is not feasible in agricultural applications because most solutions used in crop cultivation area contains a variety of ions.For example, Yamazaki's solution, which is the simplest nutrient solution for leafy vegetable, has 23 different ions.[9] And the total ion composition of water used to make fertilizer should be known.

B. Kinetic Artifacts
Movement of solution physically interferes the glass membrane of electrode.Therefore, ISEs are recommended to be applied on a non-flowing solution and to wait around 1~10 minutes before measurement to make electrode stable.Even a drop of water make inaccurate measurement.

C. Electrode Interference
If two or more ISEs are applied on the same solution, an electrode's electrical signal may interfere other sensors.This artifact is a problem of real-time measurement.
Liberti et al. provided readjustment method with Gran's plots to remove ion interference effect but it also require prior knowledge of ions.[10] We suggested a machine learning approach to remove the ion interference effect performing 91.5~97.8%accuracy on test cases [11], but failed to remove the artifact from movement of solution.A distorted signal caused by drop of water made the regression fail.Recently, Woo-jae Cho et al. suggested a deep learning approach to calibrate ISE signal which showed better performance than traditional 3 pointed calibration.[4] However, the experiment was conducted with living plant whose nutrient solution is thin.Our previous work was performed from that concentration, to 10 times thicker solution.As the ion interference effect becomes greater in higher concentration, Cho's work need additional verification on thicker solution.

II. ISE MEASUREMENT
An experiment with an array of ISEs was performed to acquire training/test data and to figure out the magnitude of ion interference effect.

A. Equipments
Vernier's Go Direct® ISE series were used to measure the concentration of ions.K + , Ca ++ , NO3 -, NH4 + ions are measured with corresponding ion selective electrodes.The sensors were dipped into the same solution at the same time and connected to same computer, sharing same power source to remove artifacts from electricity supply.

B. Chemical Solutions
We used Yamazaki's nutrient solution for lettuce [9] because it is very popular around the world and its chemical phenomenon and interactions of every solvent are fully understood.[2] But We did not applied some ions whose population is very little.KNO3, Ca(NO3)2-4H2O and NH4H2PO4 were used to make the nutrient solution.HxPO4 3-x families builds complex sediments reactions but not measurable with ISEs.
We prepared the solution with 10 different concentrations.We set the concentration of the original Yamazaki's solution as 1.The experiment condition is described on Table 1.

C. Method
Two measurement experiments were conducted.For each experiment, ISEs are dipped into a 1 L beaker filled with distilled water at first.Then droplets of highly concentrated For single solvent experiment for ISE calibration, only one solvent such as KNO3 was taken into the solution to avoid ion interference effect and electrode interference.
During the ion mixture experiment, multiple ISEs measured the concentration at the same, taken into one beaker together, to induce ion interference effect.
Both processes were repeated 10 times.

D. Calibration
For each ions, exponential regression on whole data was performed to calibrate the sensors because the Nernst potential is induced by the log of concentration.Each ISE was calibrated with 10-theoretically different concentration, with data point more than 10 thousands.Calibration equation format is described as equation ( 3), where Ci is the ISE-measured concentration,  is the membrane voltage from ISE, and a and b are parameters for regression.The results of regressions are provided on Table 2.

E. Artifacts
Applying the calibration equation ( 3) with coefficients from Table 2, the result from ion mixture experiment were analyzed.Error between theoretical value and ISE-measured values are evaluated on Table 3. MAPE score is especially larger than other measurement.Kinetic artifacts measured from the experiment is described in Figure 1.

B. Data
Experiment data from mixture of ions is used.20% of the data was randomly selected to be used as test data, and the others are used as training data.
Just a scale normalization was done on the experimental data before feeding into the neural network.The whole data was divided with the maximum value of the data.That value was stored on the memory and multiplied on the output values of the neural networks.Any other normalization method is not applied to train a robust model.

C. Objective Function & Optimization
Mean absolute percentage error(MAPE) was used as loss function.MAPE is defined as equation ( 4).Ygt is ground truth data and Ypredict is model-predicted data.
We avoided squared error based approach such as mean squared error because the scale of error would become too small, yielding small gradient.
ADAM optimizer [12] was used to optimize the weight parameters.Initial learning rate was 1e-4 but we also applied learning rate decay as 1e-7 per epoch.Because the model seemed to converge fast at first but failed to find sophisticated convergence point.

D. Neural Network Models
The structures of models used for experiment is described on Table 4. MAPE values at convergence state are also provided.All layers are simple fully connected networks.ReLu function and batch normalization [13] are applied on every layer except the output layer.The activation function of output layer was sigmoid function because the training and test data are normalized into a value between 0 ~ 1.

IV. EXPERIMENT
The models were trained with minibatch size 64.After training, test data was directly fed into the model to make artifact-removed data.The weight variable and prediction result files are also provided with the source code, at the author's Github repository.

V. RESULT
Results are summarized on Table 5.
Our previous work with quadratic regression model [11] was applied on the experiment data for comparison.It failed to remove artifacts and even increased error dramatically.The value of MSE was 1.004e-3, R 2 was -5.092 and MAPE was 321.79%.Concerning the MAPE values on Table 4, models with higher variance with lower bias performed better regression result.It implies that quadratic model's variance was too small to regress the experimental data with 3 different artifacts.It worked well on static and stable condition, but the result shows that it is not appropriate for real-time measurement of chemical solutions which has kinetic artifacts.
Comparison between 10 point calibration result and suggested method are plotted on Figure 2. The MAPE score of suggested method is plotted on Figure 3.It showed mean 1.17881% with standard deviation 0.014943.The hypothesis that any randomly chosen value has MAPE less than 0.05 had p-value 0.016.

VI. CONCLUSION
A deep learning approach with MAPE loss to remove panartifact on ISEs was introduced.It successfully removed ion interference effect, kinetic artifact and electrode interference.Not only removing 3 artifacts, this model also performed a calibration to convert voltage into molarity.Previous method with quadratic regression model is not suitable to remove those 3 artifacts at the same time.We recommend to use it on a stable-state measurement with embedded computers for IoT, because it's time complexity is O(1).Although it fails on highly complex data, it's low time complexity is still attractive.
Proposed method removed pan-artifacts and restored the data with MAPE less than 1.8%.For a real-time measurement of complex solution, I recommend a high-variance model such as deep learning to remove multiple artifacts rather than simple models.We are grateful to all members of Imagination Garden Inc. for their trust on our project.

ACKNOWLEDGMENT (Heading 5)
This work was supported by Agriculture, Food and Rural Affairs Convergence Technologies Program for Educating Creative Global Leader funded by the Ministry of Agriculture, Food and Rural Affairs (MAFRA, Korea).[Project Number 1545020852].

Figure 2 .
Figure 2. MSE Box Plot Mean square errors between predicted values and theoretical values are measured.

Figure 3
Figure 3. MAPE Histogram with Fitting Line

Table 1 .
Experimental Conditionschemical solution is added to the beaker in order to induce the kinetic artifact.

Table 3 . Error analysis Figure 1. Kinetic Artifact The
kinetic artifact caused by droplet is measured.This picture is taken from a part of NH4 + ISE's measurement result.Purple line is measured voltage and pink line is theoretical value.The measured kinetic artifacts tended to distort the voltage graph similar to the transient response.