Biochemical reaction curve anomaly detection method and system based on artificial intelligence

Through artificial intelligence-based methods, including data preprocessing and analysis of multiple neural network models, the problems of low efficiency and poor accuracy of abnormal detection of biochemical reaction curves are solved, and automated and intelligent abnormal detection is realized, which improves detection efficiency and accuracy.

CN118937657AActive Publication Date: 2024-11-12GUIZHOU PROVINCIAL PEOPLES HOSPITAL
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410981553.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-11-12
Estimated Expiration
2044-07-22

AI Technical Summary

Technical Problem

In the prior art, biochemical reaction curve abnormal detection efficiency and poor accuracy, making it difficult to process complex nonlinear patterns and multi-dimensional, high-noise biochemical reaction data.

Method used

Using artificial intelligence-based methods, including obtaining biochemical reaction curve data, performing preprocessing and feature extraction, using models such as pulsed neural networks, long and short-term memory networks, one-dimensional convolutional neural networks, and random weighted neural networks for analysis, triggering multi-level Alarm mechanism.

Benefits of technology

The automation and intelligent abnormal detection of biochemical reaction curves is realized, which improves detection efficiency and accuracy, can effectively capture complex nonlinear patterns, enhances the robustness and generalization ability of the model, and realizes the refinement of abnormal situations. Manage and respond in a timely manner.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118937657A_ABST
    Figure CN118937657A_ABST
Patent Text Reader

Abstract

The invention discloses a biochemical reaction curve anomaly detection method and system based on artificial intelligence. The method comprises the following steps: acquiring biochemical reaction curve data; preprocessing the biochemical reaction curve data to obtain preprocessed data; analyzing the preprocessed data by using an artificial intelligence model, and identifying an abnormal reaction curve; and triggering a corresponding alarm mechanism based on an analysis result of the artificial intelligence model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and specifically to a method and system for detecting anomalies in biochemical reaction curves based on artificial intelligence. Background Art

[0002] Biochemical analyzers are important instruments widely used in clinical testing, and their detection principles are mainly based on colorimetry or turbidimetry. At present, clinical laboratories mainly rely on in-house quality control to judge the status of reagents and instruments, and only check the reaction curve when quality control is out of control or interference is suspected. However, the reaction curve contains rich information, which can not only be used to judge the status of the instrument and abnormal results, but also to monitor reaction interference, calculate high-concentration samples, and analyze reagent quality.

[0003] Traditional methods for detecting anomalies in biochemical reaction curves mainly rely on manual experience or simple statistical methods, which have the following defects:

[0004] Manual judgment is inefficient and cannot meet the real-time analysis needs of large amounts of data. Simple statistical methods have difficulty capturing complex nonlinear patterns, which can easily lead to missed detections or false alarms, and are difficult to process multi-dimensional, high-noise biochemical reaction data. Summary of the invention

[0005] In view of this, the present application provides a biochemical reaction curve anomaly detection method and system based on artificial intelligence, which solves the problems of low efficiency and poor accuracy of biochemical reaction curve anomaly detection in the prior art.

[0006] The embodiment of the present application provides a biochemical reaction curve anomaly detection method based on artificial intelligence, including: acquiring biochemical reaction curve data; preprocessing the biochemical reaction curve data to obtain preprocessed data; analyzing the preprocessed data using an artificial intelligence model to identify abnormal reaction curves; and triggering a corresponding alarm mechanism based on the analysis results of the artificial intelligence model.

[0007] The obtaining of biochemical reaction curve data includes: collecting reaction curve data from a biochemical analyzer in real time; and extracting stored reaction curve data from a historical database.

[0008] The preprocessing of the biochemical reaction curve data includes: removing noise and outliers; normalizing the biochemical reaction curve data; and performing data enhancement processing on the normalized biochemical reaction curve data, including superimposing random noise that obeys Gaussian distribution on the biochemical reaction curve data, or performing nonlinear transformation on the time axis to simulate changes in reaction speed.

[0009] Before using the artificial intelligence model to analyze the preprocessed data, the method also includes: extracting time series features, including slope and curvature; extracting frequency domain features, including main frequency and energy distribution; calculating relevant biochemical indicators, including reaction rate and substrate concentration.

[0010] The artificial intelligence model is a pulse neural network (SNN), and the method also includes: constructing a multi-layer SNN network structure, including an input layer, a hidden layer and an output layer; training the SNN using a training data set; performing compression and concealment on the SNN; and updating the parameters of the SNN.

[0011] The artificial intelligence model is a long short-term memory network LSTM, and the method also includes: constructing an LSTM network structure, including an input layer, an LSTM layer and an output layer; training the LSTM using a training data set; using a standard Monte Carlo method to perform a first parameter adjustment on the LSTM; and using a quasi-Monte Carlo method to perform a second parameter adjustment on the LSTM.

[0012] The artificial intelligence model is a one-dimensional convolutional neural network 1DCNN, and the method also includes: constructing a 1DCNN network structure, including a convolutional layer, a pooling layer and a fully connected layer; using a hybrid meta-heuristic algorithm to optimize the hyperparameters of the 1DCNN; using a training data set to train the 1DCNN, and using a machine learning model to assist in optimizing the training process of the 1DCNN.

[0013] The artificial intelligence model is a neural network with random weights and learning biases. The method also includes: constructing a random weight neural network structure, including an input layer, a random weight hidden layer and a learnable bias output layer; designing and optimizing learning biases, including initializing bias values ​​and updating strategies; and optimizing network parameters using an improved covariance matrix adaptive evolution strategy CMAES multimodal optimization algorithm.

[0014] The analysis results based on the artificial intelligence model trigger a corresponding alarm mechanism, including: setting multiple alarm levels corresponding to abnormal situations of different degrees; triggering alarms of corresponding levels according to the degree of abnormality; and sending alarm signals in a variety of ways, including system prompts, SMS notifications, and email alerts.

[0015] An embodiment of the present application also provides a computer device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned method for detecting anomalies in biochemical reaction curves based on artificial intelligence.

[0016] An embodiment of the present application also provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute the above-mentioned method for detecting anomalies in biochemical reaction curves based on artificial intelligence.

[0017] An embodiment of the present application also provides a computer program product, including computer instructions, characterized in that when the computer instructions are executed by a processor, the steps of the above-mentioned method for abnormal detection of biochemical reaction curves based on artificial intelligence are implemented.

[0018] This application has the following technical effects:

[0019] By introducing artificial intelligence models, we have achieved automated and intelligent anomaly detection of biochemical reaction curves, greatly improving detection efficiency and accuracy;

[0020] Adopting a variety of advanced artificial intelligence models, such as SNN, LSTM, 1DCNN and random weight neural network, it can effectively capture complex nonlinear patterns and improve the accuracy of anomaly detection;

[0021] Through data preprocessing and feature extraction, the robustness and generalization ability of the model are enhanced;

[0022] Introduced a variety of parameter optimization and model compression technologies to improve the performance and efficiency of the model;

[0023] A multi-level alarm mechanism has been designed to achieve refined management and timely response to abnormal situations. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the disclosed embodiments in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0025] Figure 1 A schematic diagram of a process for detecting anomalies in biochemical reaction curves based on artificial intelligence provided in an embodiment of the present application;

[0026] Figure 2a A schematic diagram of a biochemical reaction curve in an embodiment;

[0027] Figure 2b A schematic diagram of a biochemical reaction curve in another embodiment;

[0028] Figure 2c A schematic diagram of a biochemical reaction curve in another embodiment;

[0029] Figure 2d A schematic diagram of a biochemical reaction curve in another embodiment;

[0030] Figure 3 A schematic diagram of the architecture of a biochemical reaction curve anomaly detection system based on artificial intelligence provided by an embodiment;

[0031] Figure 4 A schematic diagram of the architecture of a computer device provided by an embodiment. DETAILED DESCRIPTION

[0032] The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.

[0033] It should be clear that the following embodiments of the present disclosure are described by specific specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other in the absence of conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.

[0034] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.

[0035] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The drawings only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0036] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.

[0037] Embodiment 1

[0038] like Figure 1 As shown, the embodiment of the present application provides a method for detecting abnormality of a biochemical reaction curve based on artificial intelligence, comprising:

[0039] S1: Obtain biochemical reaction curve data;

[0040] Obtaining biochemical reaction curve data is the starting point of the entire anomaly detection process. Biochemical reaction curve data reflects the changes of various parameters over time in the chemical reaction process and is the basis for anomaly detection.

[0041] S1.1: Real-time collection of reaction curve data from the biochemical analyzer;

[0042] By establishing a real-time data connection with the biochemical analyzer, a standardized communication protocol (such as ASTM, HL7 or a custom protocol) is used to obtain real-time reaction curve data. For example, using the RS-232 serial communication protocol, the reaction curve data is collected at a frequency of 10 data points per second, and the data format includes information such as timestamp, absorbance value and reaction temperature.

[0043] The reaction curve is Figure 2a and Figure 2b As shown, the horizontal axis represents time (minutes) and the vertical axis represents absorbance. Figure 2a and Figure 2b Different reaction reagents were added at different time periods (such as the 6th minute), which caused a sudden change in the absorbance value, showing a nonlinear relationship. If no mutation occurred at this time, it would prove that the biochemical reaction curve was abnormal.

[0044] S1.2: extracting stored reaction curve data from the historical database;

[0045] Through database query and data mining technology, relevant reaction curve data are extracted from the historical database to provide more reference samples and training data for anomaly detection.

[0046] The SQL query statement "SELECT FROM reaction_curves WHERE test_type = 'glucose' AND date > '2023-01-01' ORDER BY date DESC LIMIT 1000" can be used to extract the reaction curve data of the most recent 1000 glucose tests.

[0047] For example Figure 2c and Figure 2d , its horizontal and vertical axes and Figure 2a , Figure 2bThe results are the same, but the values ​​presented are different. Manual analysis of the graph alone cannot determine whether it is normal or abnormal. It is necessary to combine clinical trial scenarios and artificial intelligence analysis to infer whether it is abnormal.

[0048] For example, Table 1 is a numerical statistic of the absorbance values ​​of the main wavelength of blood glucose over a period of time.

[0049] Table 1

[0050]

[0051]

[0052] From the last two rows in Table 1, we can see that the main wavelength absorbance value of blood glucose 11.153 is higher than the absorbance value of 11.279. Therefore, there are many factors that may affect the absorbance, and more accurate conclusions need to be obtained through analysis of artificial intelligence models.

[0053] S2: Preprocess the biochemical reaction curve data to obtain preprocessed data

[0054] Preprocessing is a critical step to improve the accuracy of subsequent analysis by removing noise, standardizing data, and enhancing datasets to provide high-quality input for AI models.

[0055] S2.1: Removing noise and outliers

[0056] Use signal processing and statistical methods to identify and remove noise and outliers in data to improve data quality.

[0057] For example, a median filter is applied to remove impulse noise; a wavelet transform is used to remove multi-scale noise; an outlier detection algorithm based on a moving window is implemented; and a Hampel filter is used to identify and replace local outliers.

[0058] For a reaction curve containing 100 data points, a median filter with a length of 5 was used to remove high-frequency noise, and then the 3σ principle was applied to identify and eliminate outliers.

[0059] S2.2: Normalize the biochemical reaction curve data

[0060] By converting the data to a uniform scale range, the dimensional differences between different response curves are eliminated and the generalization ability of the model is improved.

[0061] You can use methods such as minimum-maximum normalization and Z-score normalization to select the most suitable normalization method based on the data distribution characteristics;

[0062] Specifically, min-max normalization is applied to the absorbance data to map the values ​​to the [0,1] interval: normalized_value = (value min_value) / (max_value min_value).

[0063] S2.3: Data enhancement processing of the normalized biochemical reaction curve data

[0064] Data augmentation is an effective means to improve the robustness and generalization ability of the model. By creating diverse training samples, the model can better cope with various situations in the actual environment.

[0065] S2.3.1: Superimpose Gaussian random noise on biochemical reaction curve data

[0066] Random noise is added to simulate the uncertainty in actual measurements and improve the model's tolerance to noise.

[0067] Specifically include:

[0068] 1. Implement a Gaussian noise generator with adjustable mean and standard deviation;

[0069] 2. Design a noise intensity adaptive mechanism to dynamically adjust the noise level according to the strength of the original signal;

[0070] 3. Realize the local noise addition function to simulate the noise characteristics of different reaction stages;

[0071] 4. Provide visualization tools for noise superposition to facilitate debugging and verification.

[0072] In one embodiment, Gaussian noise with a mean of 0 and a standard deviation of 0.01 is added to the normalized response curve data: noisy_data=original_data+np.random.normal(0,0.01,size=original_data.shape).

[0073] S2.3.2: Perform nonlinear transformation on the time axis to simulate the change of reaction speed

[0074] By performing nonlinear transformation on the time axis, the effects of different environmental conditions (such as temperature and pH value) on the reaction rate are simulated, thereby enhancing the model's ability to adapt to changes in reaction kinetics.

[0075] Specifically include:

[0076] 1. Realize a variety of nonlinear transformation functions, such as quadratic function, exponential function, logarithmic function, etc.;

[0077] 2. Design a random sampling strategy for transformation parameters to generate diverse timeline transformation effects;

[0078] 3. Ensure that the transformed time series is still monotonically increasing;

[0079] 4. Implement the inverse transformation function for interpretation and verification of the results.

[0080] For example, a quadratic function is used to transform the time axis: t_new=at^2+b t+c, where a, b, and c are randomly generated parameters that meet certain constraints to ensure the rationality of the transformation.

[0081] S3: Extract features and calculate metrics

[0082] Feature extraction and indicator calculation are the processes of transforming raw data into more representative and discriminative information, providing high-quality input for subsequent artificial intelligence model analysis.

[0083] S3.1: Extract time series features, including slope and curvature

[0084] By calculating the first-order derivative (slope) and second-order derivative (curvature) of the reaction curve at different time points, the changing characteristics of the reaction kinetics are captured.

[0085] Specifically include:

[0086] 1. Implement numerical differentiation algorithms, such as central difference method, five-point difference method, etc.;

[0087] 2. Using sliding window techniques, calculate local slope and curvature;

[0088] 3. Apply smoothing techniques (such as Savitzky-Golay filtering) to reduce noise amplification during the differentiation process;

[0089] 4. Implement adaptive step size selection to balance computational accuracy and efficiency.

[0090] Specifically, in the embodiment of the present invention, for a time series data point t[i], y[i]), the central difference method is used to calculate the slope:

[0091] slope[i]=y[i+1]-y[i-1]) / (t[i+1]-t[i-1]), i is from 1 to n-1.

[0092] S3.2: Extract frequency domain features, including main frequency and energy distribution

[0093] By converting the time domain signal into the frequency domain, the periodic characteristics and energy distribution of the response curve are extracted, which may reflect some abnormal patterns.

[0094] For example, implement the Fast Fourier Transform (FFT) algorithm to efficiently calculate the spectrum; apply window functions (such as the Hamming window) to reduce spectrum leakage; calculate the power spectral density (PSD) to analyze the distribution of signal energy at different frequencies; implement the main frequency extraction algorithm, such as peak detection or centroid method.

[0095] Specifically, you can use the FFT function of the NumPy library to calculate the spectrum: spectrum = np.fft.fft signal), and then find the non-zero frequency component with the largest amplitude as the main frequency.

[0096] S3.3: Calculate relevant biochemical indicators, including reaction rate, substrate concentration, absorbance, etc.

[0097] Based on reaction kinetics theory, key biochemical indicators are extracted from the reaction curve, which directly reflect the progress and efficiency of the reaction.

[0098] Implement reaction rate calculation algorithms, such as the initial rate method and the integral method; use nonlinear regression technology to fit the Michaelis-Menten equation to estimate kinetic parameters; implement a dynamic estimation algorithm for substrate concentration, taking into account the consumption of substrates during the reaction; design indicator anomaly detection rules, such as rate mutations and abnormal substrate consumption.

[0099] The reaction rate was calculated using the initial rate method, and the first 10% time period of the reaction curve was selected, and the slope was obtained by linear regression as the initial reaction rate.

[0100] S4: Use artificial intelligence models to analyze preprocessed data and identify abnormal response curves

[0101] This step is the core of the entire method. It analyzes the preprocessed data through a variety of advanced artificial intelligence models to achieve intelligent identification of abnormal reaction curves.

[0102] In one embodiment, S4 includes steps A1-A4:

[0103] Step A1: Dataset Division

[0104] Step A1.1: Divide the dataset into training set, validation set and test set in a ratio of 8:1:1

[0105] Step A1.2: Ensure that the ratio of normal samples to abnormal samples in each subset is consistent

[0106] Step A2: Select an appropriate artificial intelligence algorithm, such as a machine learning algorithm and / or a deep learning algorithm.

[0107] Step A2.1: Use classification algorithms such as Support Vector Machine (SVM) and Random Forest

[0108] Step A2.2: Build a deep learning model, such as a long short-term memory network (LSTM) or a one-dimensional convolutional neural network (1DCNN)

[0109] Step A3: Model training

[0110] Step AA1: Train the selected model using the training set

[0111] Step AA2: Tune model hyperparameters via cross-validation

[0112] Step A4: Model evaluation and optimization

[0113] Step A4.1: Evaluate model performance on the validation set and calculate indicators such as accuracy, precision, and recall

[0114] Step A4.2: Optimize model structure or parameters based on evaluation results

[0115] The specific instructions for steps A1-A4 are as follows:

[0116] A1 Dataset Division

[0117] A1.1 Training set, validation set and test set division

[0118] The dataset is divided into training set, validation set and test set in a ratio of 8:1:1. Stratified sampling method can be used to ensure the same ratio of normal samples and abnormal samples in each subset.

[0119] Implementation code example:

[0120] ```Python

[0121] from sklearn.model_selection import train_test_split

[0122] X_train_val,X_test,y_train_val,y_test=train_test_split(X,y,test_size=0.1,stratify=y,random_state=42)

[0123] X_train,

[0124] ```

[0125] A1.2 Data balancing process

[0126] Check the ratio of normal samples to abnormal samples in the training set

[0127] If there is a severe class imbalance, consider using one of the following methods:

[0128] 1. Oversampling technology (such as SMOTE)

[0129] 2. Undersampling techniques (such as random undersampling)

[0130] A Category Weight Adjustment

[0131] Implementation code example (using SMOTE):

[0132] ```Python

[0133] from imblearn.over_sampling import SMOTE

[0134] smote=SMOTE(random_state=42)

[0135] X_train_resampled,y_train_resampled=smote.fit_resample(X_train,y_train)

[0136] ```

[0137] A2 Choose the appropriate machine learning algorithm

[0138] A2.1 Algorithms Considered

[0139] 1. Support Vector Machine (SVM)

[0140] Advantages: Applicable to high-dimensional feature space, good effect on small sample data sets

[0141] Note: Feature scaling is required, and kernel function selection has a great impact on performance

[0142] 2. Random Forest

[0143] Advantages: can handle high-dimensional data, not prone to overfitting, can evaluate feature importance

[0144] Note: Relatively insensitive to hyperparameters, but still requires tuning

[0145] 3. Gradient boosted decision tree (GBDT), such as XGBoost or LightGBM

[0146] Strengths: Usually has good predictive performance and can handle different types of features

[0147] Note: It is easier to overfit than random forest and requires careful parameter adjustment

[0148] A2.2 Deep Learning Model Selection

[0149] 1. Long Short-Term Memory (LSTM)

[0150] Advantages: Suitable for processing sequence data and can capture long-term dependencies

[0151] Note: A larger dataset is required and the training time may be longer

[0152] 2. One-dimensional Convolutional Neural Network (1DCNN)

[0153] Advantages: suitable for extracting local features, high computational efficiency

[0154] Note: It is necessary to design a suitable network structure, which may require more experiments

[0155] A3 model training

[0156] A3.1 Basic model training

[0157] Perform initial training using default parameters or parameters based on experience

[0158] For each algorithm, implement the basic training process

[0159] Sample code (taking random forest as an example):

[0160] ```Python

[0161] from sklearn.ensemble import RandomForestClassifier

[0162] from sklearn.metrics import accuracy_score,classification_report

[0163] rf_model=RandomForestClassifier(random_state=42)

[0164] rf_model.fit(X_train,y_train)

[0165] y_pred=rf_model.predict(X_val)

[0166] print(f"Validation Accuracy:{accuracy_score(y_val,y_pred)}")

[0167] print(classification_report(y_val,y_pred))

[0168] ```

[0169] A2 Deep Learning Model Training

[0170] Design the network structure, including the number of layers, the number of neurons in each layer, etc.

[0171] Choose an appropriate optimizer and learning rate

[0172] Implement the training loop, including forward propagation, backpropagation, and parameter updates

[0173] Sample code (taking LSTM as an example):

[0174] ```Python

[0175] import torch

[0176] import torch.nn as nn

[0177] import torch.optim as optim

[0178] class LSTMModel(nn.Module):

[0179] def__init__(self,input_size,hidden_size,num_layers,output_size):

[0180] super(LSTMModel,self).__init__()

[0181] self.lstm=nn.LSTM(input_size,hidden_size,num_layers,batch_first=True)

[0182] self.fc=nn.Linear(hidden_size,output_size)

[0183] def forward(self,x):

[0184] out,_ = self.lstm(x)

[0185] out = self.fc(out[:, 1, :])

[0186] return out

[0187] model = LSTMModel(input_size = 18, hidden_size = 64, num_layers = 2, output_size = 1)

[0188] criterion = nn.BCEWithLogitsLoss()

[0189] optimizer = optim.Adam(model.parameters())

[0190] num_epochs = 100

[0191] for epoch in range(num_epochs):

[0192] model.train()

[0193] for batch_X, batch_y in train_loader:

[0194] optimizer.zero_grad()

[0195] outputs = model(batch_X)

[0196] loss = criterion(outputs, batch_y.unsqueeze(1))

[0197] loss.backward()

[0198] optimizer.step()

[0199] Verification

[0200] model.eval()

[0201] with torch.no_grad():

[0202] val_outputs = model(X_val)

[0203] val_loss=criterion(val_outputs,y_val.unsqueeze(1))

[0204] print(f"Epoch[{epoch+1} / {num_epochs}],Loss:{loss.item():.4f},ValLoss:{val_loss.item():.4f}")

[0205] ```

[0206] A4 Model Evaluation and Optimization

[0207] A4.1 Performance Evaluation

[0208] Evaluate model performance on the validation set

[0209] Calculate key indicators: accuracy, precision, recall, F1 score, AUCROC, etc.

[0210] Plot confusion matrix and ROC curve

[0211] Sample code:

[0212] ```Python

[0213] from sklearn.metrics import confusion_matrix,roc_auc_score,roc_curveimport matplotlib.pyplot as plt

[0214] import seaborn as sns

[0215] def plot_confusion_matrix(y_true,y_pred):

[0216] cm=confusion_matrix(y_true,y_pred)

[0217] plt.figure(figsize=(8,6))

[0218] sns.heatmap(cm,annot=True,fmt='d',cmap='Blues')

[0219] plt.title('Confusion Matrix')

[0220] plt.ylabel('True Label')

[0221] plt.xlabel('Predicted Label')

[0222] plt.show()

[0223] def plot_roc_curve(y_true, y_pred_proba):

[0224] fpr, tpr, _ = roc_curve(y_true, y_pred_proba)

[0225] auc = roc_auc_score(y_true, y_pred_proba)

[0226] plt.figure(figsize=(8, 6))

[0227] plt.plot(fpr, tpr, label=f'ROC Curve(AUC = {auc:.2f})')

[0228] plt.plot([0, 1], [0, 1], linestyle='', label='Random Classifier')

[0229] plt.xlabel('False Positive Rate')

[0230] plt.ylabel('True Positive Rate')

[0231] plt.title('Receiver Operating Characteristic(ROC) Curve')

[0232] plt.legend()

[0233] plt.show()

[0234] Usage Example

[0235] y_pred = model.predict(X_val)

[0236] y_pred_proba = model.predict_proba(X_val)[:, 1]

[0237] plot_confusion_matrix(y_val, y_pred)

[0238] plot_roc_curve(y_val,y_pred_proba)

[0239] ```

[0240] A4.2 Hyperparameter Tuning

[0241] Hyperparameter tuning using methods such as grid search, random search, or Bayesian optimization

[0242] For traditional machine learning models, you can use sklearn's GridSearchCV or RandomizedSearchCV

[0243] For deep learning models, more complex hyperparameter optimization can be performed using libraries such as Optuna

[0244] Example code (using GridSearchCV):

[0245] ```Python

[0246] from sklearn.model_selection import GridSearchCV

[0247] param_grid = {

[0248] 'n_estimators':[100,200,300],

[0249] 'max_depth':[None,10,20,30],

[0250] 'min_samples_split':[2,5,10],

[0251] 'min_samples_leaf':[1,2,4]

[0252] }

[0253] rf_model=RandomForestClassifier(random_state=42)

[0254] grid_search=GridSearchCV(estimator=rf_model,param_grid=param_grid,cv=5,scoring='f1',n_jobs=1)

[0255] grid_search.fit(X_train,y_train)

[0256] print("Best parameters:",grid_search.best_params_)

[0257] print("Best crossvalidation score:",grid_search.best_score_)

[0258] ```

[0259] A4.3 Model Integration

[0260] Consider using ensemble methods to improve model performance, such as:

[0261] 1. Voting Classifier

[0262] 2. Stacking Integration

[0263] A Blending

[0264] Example code (simple voting classifier):

[0265] ```Python

[0266] from sklearn.ensemble import VotingClassifier

[0267] model1=RandomForestClassifier(random_state=42)

[0268] model2=GradientBoostingClassifier(random_state=42)

[0269] model3=SVC(probability=True,random_state=42)

[0270] voting_model=VotingClassifier(

[0271] estimators=[('rf',model1),('gb',model2),('svm',model3)],

[0272] voting='soft' )

[0274] voting_model.fit(X_train,y_train)

[0275] y_pred=voting_model.predict(X_val)

[0276] print(classification_report(y_val,y_pred))

[0277] ```

[0278] A5 Model Explanatory Analysis

[0279] A5.1 Feature Importance Analysis

[0280] For tree-based models, extract feature importance

[0281] For other models, consider using SHAP (SHapley Additive exPlanations) values

[0282] Example code (Random Forest Feature Importance):

[0283] ```Python

[0284] import pandas as pd

[0285] feature_importance=pd.DataFrame({

[0286] 'feature':X_train.columns,

[0287] 'importance':rf_model.feature_importances_

[0288] }).sort_values('importance', ascending=False)

[0289] plt.figure(figsize=(10,6))

[0290] sns.barplot(x='importance',y='feature',data=feature_importance.head(10))

[0291] plt.title('Top 10Most Important Features')

[0292] plt.show()

[0293] ```

[0294] A5.2 Local Interpretative Analysis

[0295] Analyzing individual predictions using LIME (Local Interpretable Modelagnostic Explanations)

[0296] For deep learning models, consider using visualization techniques such as GradCAM

[0297] Example code (using LIME):

[0298] ```Python

[0299] Import lime

[0300] import lime.lime_tabular

[0301] explainer=lime.lime_tabular.LimeTabularExplainer(

[0302] X_train.values,

[0303] feature_names=X_train.columns,

[0304] class_names=['Normal','Abnormal'],

[0305] mode='classification' )

[0307] Explaining a single instance

[0308] idx=0 selects the instance index to be explained

[0309] exp=explainer.explain_instance(

[0310] X_val.iloc[idx].values,

[0311] rf_model.predict_proba,

[0312] num_features=10 )

[0314] exp.show_in_notebook(show_table=True)

[0315] ```

[0316] Through the above detailed steps, the embodiment of the present invention can build a powerful machine learning model to identify abnormal biochemical reaction curves. This process involves multiple aspects such as data processing, model selection, training, evaluation and optimization, and each step is crucial to the performance of the final model. In practical applications, multiple iterations and adjustments may be required to achieve the best results.

[0317] Specifically, it is assumed that the embodiment of the present invention has a preprocessed biochemical reaction curve data represented as a time series. Each data point contains the time and the corresponding measurement value. For example:

[0318] ``` [

[0320] (0,0.1),(5,0.3),(10,0.5),(15,0.8),(20,1.2),

[0321] (25,1.5),(30,1.7),(35,1.8),(40,1.9),(45,2.0) ]

[0323] ```

[0324] This sequence represents the reaction process from 0 to 45 seconds, with the measured value rising from 0.1 to 2.0. Output example:

[0325] Outputs from the model may include:

[0326] 1. Classification results: normal / abnormal

[0327] 2. Abnormal probability: a value between 0 and 1

[0328] 3. Exception type (if an exception is detected)

[0329] For example:

[0330] ```

[0331] {

[0332] "classification":"Abnormal",

[0333] "anomaly_probability":0.92,

[0334] "anomaly_type":"Anomaly of reaction rate"

[0335] }

[0336] ```

[0337] Several possible situations of abnormal reaction curves:

[0338] 1. Abnormal reaction rate:

[0339] Too fast reaction speed: the curve rises sharply in a short period of time.

[0340] The response speed is too slow: the curve rises significantly slower than expected.

[0341] 2. Abnormal plateau period:

[0342] Reaching the plateau prematurely: The curve flattens too early.

[0343] Failure to reach a plateau: The curve does not flatten out within the expected time.

[0344] 3. Baseline drift:

[0345] Abnormal starting point: The initial measurement deviates significantly from the expected baseline.

[0346] Continuous drift: The entire curve shows a continuous upward or downward trend.

[0347] 4. Abnormal noise:

[0348] High-frequency fluctuation: The curve shows abnormal and rapid fluctuations.

[0349] Sudden peak: Abnormal peaks or valleys appear in the curve.

[0350] 5. Abnormal turning point:

[0351] Multiple inflection points: The curve has multiple inflection points that should not exist.

[0352] Abnormal inflection point position: The inflection point appears at an unexpected position.

[0353] 6. Abnormal endpoint:

[0354] Endpoint value is too high: The final measurement value is significantly higher than expected.

[0355] Endpoint value is too low: The final measurement value is significantly lower than expected.

[0356] 7. Abnormal shape:

[0357] S-shaped anomaly: The curve that should have been a smoothly growing curve takes an S shape.

[0358] Stair-step: The curve rises in steps rather than smoothly.

[0359] 8. Delayed Response:

[0360] Delayed reaction start: The curve remains stable in the initial stage and then suddenly starts to rise.

[0361] 9. Interrupt exception:

[0362] Data interruption: A situation where data is missing from a curve or the measured value suddenly returns to zero.

[0363] 10. Periodic anomalies:

[0364] Unexpected cyclical fluctuations: The curve shows cyclical changes that should not occur.

[0365] The AI ​​model (such as 1DCNN, LSTM, or random weight neural network) analyzes these features and determines whether the curve is abnormal and what type of abnormality it belongs to based on the learned patterns. The model's training data set should contain a variety of normal and abnormal samples to ensure that it can identify multiple abnormal situations.

[0366] Exemplarily, the present invention will provide specific instructions for when the artificial intelligence model is a spike neural network SNN, a long short-term memory network LSTM, a one-dimensional convolutional neural network 1DCNN, or a neural network with random weights and learning biases, respectively, using steps 4.1, 4.2, 4.3 and 4.4 for explanation:

[0367] S4.1: Analysis using Spiking Neural Network (SNN);

[0368] Spiking neural network (SNN) is an artificial neural network that imitates the working mode of biological nervous system. Unlike traditional artificial neural networks, neurons in SNN communicate through discrete pulse signals, which is closer to the working mechanism of human brain. SNN has unique advantages in processing time series data (such as biochemical reaction curves) and can effectively capture the temporal dynamic characteristics of data.

[0369] It includes:

[0370] Pulse encoding: converting continuous biochemical reaction curve data into discrete pulse sequences.

[0371] Neuron model selection: Select an appropriate neuron model according to task requirements, such as the Leaky Integrate-and-Fire (LIF) model.

[0372] Network topology design: determine the number of network layers, the number of neurons in each layer, and the connection method.

[0373] Learning rule implementation: Implement learning algorithms suitable for SNNs, such as learning rules based on spike time-dependent plasticity (STDP).

[0374] For a biochemical reaction curve containing 20-30 time points, the embodiment of the present invention can use frequency encoding to convert it into a pulse sequence. For example, the value of each time point can be mapped to a firing frequency range of 0-100 Hz. Then, these pulse sequences are used as the input of the SNN, and the classification results (normal or abnormal) are output after network processing.

[0375] S4.1.1: Build a multi-layer SNN network structure, including input layer, hidden layer and output layer;

[0376] The multi-layer SNN structure allows the network to extract and process features layer by layer, thus achieving complex nonlinear mapping. By designing a suitable hierarchical structure, SNN can effectively learn time-dependent features and abnormal patterns in biochemical reaction curves.

[0377] Specifically:

[0378] Input layer design: The number of neurons is determined according to the dimension of the input data, usually corresponding to the length of the time series.

[0379] Hidden layer design: Determine the number of hidden layers and the number of neurons in each layer. Usually more hidden layers can extract more complex features.

[0380] Output layer design: Determine the number of output neurons based on the task type (such as binary classification problem).

[0381] Connection mode: Determines the type of connection between layers, such as full connection, local connection, or sparse connection.

[0382] Activation function: Choose an activation function suitable for SNN, such as a threshold function or a more complex dynamic equation.

[0383] Assuming that there is a 100-point biochemical reaction curve in the embodiment of the present invention, the following SNN structure can be designed:

[0384] Input layer: 100 LIF neurons, corresponding to 100 time points

[0385] Hidden layer 1: 200 Izhikevich model neurons

[0386] Hidden layer 2: 100 Izhikevich model neurons

[0387] Output layer: 2 LIF neurons, representing normal and abnormal categories respectively

[0388] Each layer is fully connected, and STDP is used as the learning rule to adjust the synaptic weights.

[0389] S4.1.2: Train the SNN using the training dataset;

[0390] The training goal of SNN is to adjust the network parameters (mainly synaptic weights) so that the network can correctly classify the input biochemical reaction curve. Due to the discrete characteristics of SNN, the traditional back propagation algorithm cannot be directly applied, and a learning algorithm specially designed for SNN is required. Specifically, it includes:

[0391] Data preparation: Convert the biochemical reaction curves in the training dataset into pulse trains.

[0392] Learning algorithm selection: Implement a learning algorithm suitable for SNN, such as SpikeProp, STDP or their improved versions.

[0393] Loss function definition: Design a loss function suitable for SNN, such as cross entropy loss based on spike counts.

[0394] Parameter update: Iteratively update network parameters according to the learning algorithm and loss function.

[0395] Training strategy: Implement training strategies such as batch processing, learning rate scheduling, and early stopping.

[0396] Performance evaluation: Regularly evaluate model performance on the validation set to monitor the training process.

[0397] Example:

[0398] Prepare a training data set containing 1000 normal reaction curves and 1000 abnormal reaction curves.

[0399] The improved STDP algorithm is used for training, and each epoch contains 100 mini-batches.

[0400] The loss function uses the cross entropy based on the number of pulses: L = -Σ(y log(p) + (1-y)log(1-p)), where y is the true label and p is the normalized number of pulses of the output neuron.

[0401] The initial learning rate is set to 0.01 and decays by 10% every 50 epochs.

[0402] Train for 1000 epochs or until the validation set accuracy does not improve for 10 consecutive epochs.

[0403] The model performance is evaluated on the validation set every 10 epochs, and the accuracy, precision, and recall are recorded.

[0404] S4.1.3: Compression and concealment on SNN

[0405] Compression is a network optimization technique that aims to reduce the number of network parameters and computational complexity while maintaining or improving model performance as much as possible. This is particularly important for SNNs, because SNNs usually require more neurons to process time series data, which may lead to excessive consumption of computing resources.

[0406] S4.1.3.1: Add an autoencoder structure to the hidden layer

[0407] An autoencoder is an unsupervised learning method that discovers effective representations of data by learning to compress the input into a low-dimensional representation and then reconstruct it back to the original input. Adding an autoencoder structure to an SNN can help the network learn a more compact feature representation.

[0408] In this step, design the spike-based autoencoder structure, including the encoder and decoder parts. Implement an autoencoder training algorithm suitable for SNN, such as time-based spike backpropagation (STBP). Determine the size of the bottleneck layer of the autoencoder to balance the compression rate and reconstruction error. Integrate the autoencoder loss and classification loss to jointly optimize the network.

[0409] Assuming that the original SNN hidden layer has 500 neurons, the embodiment of the present invention can design a pulse autoencoder to compress the 500-dimensional input to 100 dimensions and then reconstruct it back to 500 dimensions. The loss function of the autoencoder can be defined as the mean square error between the original pulse sequence and the reconstructed pulse sequence.

[0410] ```Python

[0411] class SpikeAutoencoder(nn.Module):

[0412] def__init__(self,input_size=500,bottleneck_size=100):

[0413] super().__init__()

[0414] self.encoder=SpikingLinear(input_size,bottleneck_size)

[0415] self.decoder=SpikingLinear(bottleneck_size,input_size)

[0416] def forward(self,x):

[0417] encoded = self.encoder(x)

[0418] decoded=self.decoder(encoded)

[0419] return decoded

[0420] #Add an autoencoder after each hidden layer of the SNN

[0421] snn_with_ae = nn.Sequential(

[0422] SpikingLinear(100,500),

[0423] SpikeAutoencoder(500,100),

[0424] SpikingLinear(500,2) )

[0426] ```

[0427] S4.1.3.2: Design bottleneck layers to force SNNs to learn compressed representations by reducing the number of neurons

[0428] By introducing a layer with a significantly reduced number of neurons (bottleneck layer) into the network, the network is forced to learn a compressed representation of the data, thereby extracting the most critical features.

[0429] Specifically, first, determine the optimal location of the bottleneck layer, usually in the middle layer of the network. Second, implement a dynamic bottleneck layer width adjustment mechanism to adaptively adjust according to the difficulty of the task. Third, design residual connections to allow some information to bypass the bottleneck layer to prevent information loss. Finally, implement a layered training strategy to first train the part before the bottleneck layer and then train the entire network.

[0430] For example, in an embodiment of the present invention, the original 500-500-500 three-layer hidden layer structure is changed to a 500-100-500 bottleneck structure.

[0431] ```Python

[0432] class SNNWithBottleneck(nn.Module):

[0433] def __init__(self):

[0434] super().__init__()

[0435] self.layer1=SpikingLinear(100,500)

[0436] self.bottleneck=SpikingLinear(500,100)

[0437] self.layer3=SpikingLinear(100,500)

[0438] self.output=SpikingLinear(500,2)

[0439] def forward(self,x):

[0440] x = self.layer1(x)

[0441] bottleneck=self.bottleneck(x)

[0442] x = self.layer3(bottleneck) + x # residual connection

[0443] return self.output(x)

[0444] ```

[0445] S4.1.3.3: Use sparse constraints to limit the number of activated neurons and reduce the network parameters of SNN

[0446] By introducing sparsity constraints, most neurons remain silent and only a few neurons are activated, thereby reducing the number of effective network parameters.

[0447] Among them, a variety of sparsity constraint methods are implemented, such as L1 regularization, KL divergence constraint, etc. In addition, a dynamic threshold mechanism needs to be designed to adaptively adjust the activation threshold of neurons.

[0448] In addition, a sparsity monitoring tool is implemented to observe the sparsity of the network in real time, a sparsity reward mechanism is designed, and sparsity metrics are added to the optimization objectives.

[0449] An L1 regularization term is added to the output of each layer of SNN.

[0450] ```Python

[0451] def sparse_loss(model):

[0452] loss=0

[0453] for name,paramin model.named_parameters():

[0454] if 'weight' in name:

[0455] loss+=torch.sum(torch.abs(param))

[0456] return loss

[0457] #In the training loop

[0458] optimizer.zero_grad()

[0459] outputs = model(inputs)

[0460] classification_loss=criterion(outputs,labels)

[0461] sparsity_loss=sparse_loss(model)

[0462] total_loss=classification_loss+0.001sparsity_loss

[0463] total_loss.backward()

[0464] optimizer.step()

[0465] ```

[0466] S4.1.3.4: Apply pruning technology to remove connections in SNN with weights less than the weight threshold by setting the weight threshold

[0467] Pruning technology reduces network parameters and computation while maintaining network performance by removing unimportant connections in the network (connections with weights close to zero).

[0468] In the embodiment of the present invention, an amplitude pruning function is implemented:

[0469] ```Python

[0470] def prune_network(model,prune_threshold):

[0471] for name,paramin model.named_parameters():

[0472] if 'weight' in name:

[0473] mask=torch.abs(param.data)>prune_threshold

[0474] param.data*=mask

[0475] param.grad.data*=mask

[0476] #Apply pruning periodically during training

[0477] if epoch%prune_interval==0:

[0478] prune_threshold = calculate_threshold(model) #Calculate the threshold based on weight distribution prune_network(model,prune_threshold)

[0479] ```

[0480] Through these compression and concealment techniques, the embodiments of the present invention can significantly reduce the number of parameters and computational complexity of SNN, while maintaining or even improving its performance in the task of anomaly detection of biochemical reaction curves. This is particularly meaningful for deploying SNN models in resource-constrained environments, such as implementing real-time anomaly detection on portable biochemical analysis equipment.

[0481] S4.1.4: Update the parameters of the SNN

[0482] In practical applications, SNNs need to be able to adapt to new data and categories while maintaining the memory of learned knowledge. This step aims to improve the scalability and adaptability of SNNs.

[0483] S4.1.4.1: Design a scalable network structure to support the addition of new categories

[0484] Design a flexible network structure that enables SNNs to be extended to new categories or tasks without retraining the entire network.

[0485] Specifically include:

[0486] 1. Implement a dynamic output layer, where new output neurons can be added as needed.

[0487] 2. Design a modular network structure to facilitate adding new functional modules.

[0488] 3. Decouple the feature extractor and the classifier so that the feature extraction part can remain stable and expand the classifier.

[0489] 4. Design a parameter sharing mechanism to enable new categories to leverage learned knowledge.

[0490] The sample code is as follows:

[0491] ```Python

[0492] class ExpandableSNN(nn.Module):

[0493] def__init__(self,input_size,initial_num_classes):

[0494] super().__init__()

[0495] self.feature_extractor=SpikingFeatureExtractor(input_size,256)

[0496] self.classifier=SpikingLinear(256,initial_num_classes)

[0497] def expand(self,num_new_classes):

[0498] new_classifier=SpikingLinear(256,self.classifier.out_features+num_new_classes)

[0499] new_classifier.weight.data[:self.classifier.out_features]=self.classifier.weight.data

[0500] self.classifier=new_classifier

[0501] def forward(self,x):

[0502] features=self.feature_extractor(x)

[0503] return self.classifier(features)

[0504] #Usage examples

[0505] model=ExpandableSNN(input_size=100,initial_num_classes=2)

[0506] #When you need to add a new category

[0507] model.expand(num_new_classes=1)

[0508] ```

[0509] S4.1.4.2: Implement dynamic weight adjustment mechanism

[0510] Dynamically adjusting network weights enables SNNs to quickly adapt to new data distributions or task requirements while maintaining memory of the original knowledge.

[0511] Specifically include:

[0512] 1. Implement elastic weight adjustment algorithms, such as Elastic Weight Consolidation (EWC).

[0513] 2. Design an importance scoring mechanism to identify the weights that are important for a specific task.

[0514] 3. Implement a progressive learning strategy to gradually adjust the network to adapt to new tasks.

[0515] 4. Design a learning rate scheduler to dynamically adjust the learning rate based on the novelty of the task.

[0516] Sample code:

[0517] ```Python

[0518] class EWC(object):

[0519] def__init__(self,model,dataset):

[0520] self.model = model

[0521] self.dataset = dataset

[0522] self.params={n:p for n,p in self.model.named_parameters()ifp.requires_grad}

[0523] self._means = {}

[0524] self._fisher=self._calculate_fisher()

[0525] def_calculate_fisher(self):

[0526] fisher={n:torch.zeros_like(p)for n,p in self.params.items()}

[0527] self.model.eval()

[0528] for input,target in self.dataset:

[0529] self.model.zero_grad()

[0530] output=self.model(input).view(1,-1)

[0531] label=output.max(1)[1].view(-1)

[0532] loss=F.nll_loss(F.log_softmax(output,dim=1),label)

[0533] loss.backward()

[0534] for n,p in self.model.named_parameters():

[0535] if p.grad is not None:

[0536] fisher[n]+=p.grad.data*2 / len(self.dataset)

[0537] return fisher

[0538] def penalty(self,model):

[0539] loss=0

[0540] for n,p in model.named_parameters():

[0541] _loss=self._fisher[n](p self._means[n])*2

[0542] loss+=_loss.sum()

[0543] return loss

[0544] #Usage examples

[0545] ewc=EWC(model,old_task_dataset)

[0546] for input,target in new_task_dataset:

[0547] output = model (input)

[0548] loss=criterion(output,target)+lambda_ewc ewc.penalty(model)

[0549] loss.backward()

[0550] optimizer.step()

[0551] ```

[0552] S4.1.4.3: Use knowledge distillation techniques to transfer the knowledge of the trained SNN teacher model to the newly trained SNN student model

[0553] Knowledge distillation is a technique that transfers the knowledge of a complex model (teacher model) to a simpler model (student model). Applying knowledge distillation in SNNs can help the new model learn faster while maintaining the memory of the original knowledge.

[0554] Specifically, it includes:

[0555] 1. Design a distillation loss function suitable for SNN, considering the characteristics of the pulse sequence.

[0556] 2. Implement a temperature scaling mechanism to control the "softness" of knowledge transfer.

[0557] 3. Design the encoding method of the teacher model output to make it suitable for SNN learning.

[0558] 4. Implement a progressive distillation strategy to gradually transfer knowledge from the teacher model to the student model.

[0559] Sample code:

[0560] ```Python

[0561] class DistillationLoss(nn.Module):

[0562] def __init__(self, T=2):

[0563] super().__init__()

[0564] self.T = T

[0565] def forward(self, student_outputs, teacher_outputs, targets):

[0566] soft_targets = F.softmax(teacher_outputs / self.T, dim=1)

[0567] student_log_softmax = F.log_softmax(student_outputs / self.T, dim=1)

[0568] distillation_loss = F.kl_div(student_log_softmax, soft_targets, reduction='batchmean') * (self.T * 2)

[0569] student_loss = F.cross_entropy(student_outputs, targets)

[0570] return student_loss + distillation_loss

[0571] # Usage example

[0572] teacher_model = TrainedSNN()

[0573] student_model = NewSNN()

[0574] distillation_criterion = DistillationLoss(T=2)

[0575] for inputs, targets in train_loader:

[0576] teacher_outputs = teacher_model(inputs) It should be noted that there are some syntax errors in the original code, such as incorrect indentation and an incorrect equal sign in the `__init__` method. The above translation is based on the text content while trying to maintain the original format.

[0577] student_outputs=student_model(inputs)

[0578] loss=distillation_criterion(student_outputs,teacher_outputs,targets)

[0579] loss.backward()

[0580] optimizer.step()

[0581] ```

[0582] S4.1.4.4: Maintain a sample buffer to store representative samples of response curve data

[0583] Maintaining a sample buffer to store representative response curve data can help SNN keep the memory of important samples during the updating process and prevent catastrophic forgetting.

[0584] 1. Design sample selection strategies, such as selection based on uncertainty, diversity, or importance.

[0585] 2. Implement a dynamic buffer update mechanism to update samples while keeping the buffer size unchanged.

[0586] 3. Design a strategy for using buffer samples, such as mixing new and old samples during training.

[0587] 4. Implement a sample importance weighting mechanism to assign different learning weights to different samples.

[0588] Sample code:

[0589] ```Python

[0590] class ReplayBuffer:

[0591] def__init__(self, capacity):

[0592] self.capacity = capacity

[0593] self.buffer = []

[0594] self.position = 0

[0595] def push(self,sample):

[0596] if len(self.buffer)<self.capacity:

[0597] self.buffer.append(None)

[0598] self.buffer[self.position] = sample

[0599] self.position = (self.position + 1) % self.capacity

[0600] def sample(self, batch_size):

[0601] return random.sample(self.buffer, batch_size)

[0602] def __len__(self):

[0603] return len(self.buffer)

[0604] # Usage example

[0605] buffer = ReplayBuffer(10000)

[0606] # Training process

[0607] for epoch in range(num_epochs):

[0608] for inputs, targets in train_loader:

[0609] # Add new samples to the buffer

[0610] for input, target in zip(inputs, targets):

[0611] buffer.push((input, target))

[0612] # Sample from the buffer

[0613] if len(buffer)>batch_size:

[0614] replay_inputs, replay_targets = zip(*buffer.sample(batch_size / / 2))

[0615] inputs=torch.cat([inputs[:batch_size / / 2],replay_inputs])

[0616] targets=torch.cat([targets[:batch_size / / 2],replay_targets])

[0617] outputs = model(inputs)

[0618] loss=criterion(outputs,targets)

[0619] loss.backward()

[0620] optimizer.step()

[0621] ```

[0622] Through these techniques, embodiments of the present invention can make SNN more flexible and adaptable, able to handle new categories and tasks while maintaining memory of learned knowledge. This is particularly important for biochemical reaction curve anomaly detection systems in practical applications, as it needs to constantly adapt to new reaction types and anomaly patterns.

[0623] S4.2: Analysis using Long Short-Term Memory (LSTM) networks

[0624] Long short-term memory (LSTM) is a special recurrent neural network that can effectively process long sequence data and capture long-term dependencies. In the anomaly detection of biochemical reaction curves, LSTM can learn the temporal dynamic characteristics of the curve and identify complex abnormal patterns.

[0625] LSTM controls the flow of information through its unique gating mechanism (input gate, forget gate, and output gate), deciding when to remember, forget, or output information. This makes LSTM particularly suitable for processing time series data with long-term dependencies such as biochemical reaction curves.

[0626] When applying LSTM to detect anomalies in biochemical reaction curves, the embodiments of the present invention need to consider factors such as sequence length, batch processing strategy, and the number of LSTM units to balance the expression ability and computational efficiency of the model.

[0627] S4.2.1: Build the LSTM network structure, including the input layer, LSTM layer and output layer

[0628] Building the LSTM network structure is the basis of the entire analysis process. The input layer is responsible for receiving the preprocessed biochemical reaction curve data, the LSTM layer processes the time series information, and the output layer gives the final classification results.

[0629] The design of the input layer needs to take into account the characteristics of the data. For biochemical reaction curves, the input can be a measurement at each time point or multiple measurements within a sliding window. The number of neurons in the input layer should match the number of features at each time step.

[0630] The LSTM layer is the core of the network and is responsible for learning and memorizing important information in the sequence. Multiple LSTM layers can be stacked to enhance the expressiveness of the model. The number of units in each LSTM layer needs to be weighed based on the complexity of the task and the available computing resources.

[0631] In addition, Dropout layers can be added between LSTM layers to prevent overfitting. Dropout enhances the generalization ability of the model by randomly "turning off" a portion of neurons during training.

[0632] The output layer usually uses a fully connected layer, and the number of neurons depends on the task type. For a binary classification problem (normal / abnormal), the output layer can have only one neuron and use the sigmoid activation function. For a multi-classification problem, the number of neurons in the output layer should be equal to the number of categories, and the softmax activation function should be used.

[0633] S4.2.2: Train LSTM using training dataset

[0634] Training the LSTM network is an iterative optimization process, the goal of which is to minimize the difference between the predicted results and the true labels.

[0635] First, you need to prepare training data suitable for LSTM. This includes organizing the biochemical reaction curve data into an appropriate sequence form and preparing corresponding labels. Data enhancement, such as adding noise, time warping, etc., may be required to improve the robustness of the model.

[0636] Choosing a suitable loss function is key. For binary classification problems, binary cross entropy loss is usually used; for multi-classification problems, categorical cross entropy loss is used.

[0637] The choice of optimizer is also very important. Common choices include Adam, RMSprop, etc. These optimizers can adaptively adjust the learning rate, which helps to accelerate convergence and improve performance.

[0638] During training, a mini-batch gradient descent method is used. Each mini-batch should contain multiple complete sequences to fully utilize parallel computing capabilities. The selection of batch size requires a trade-off between training stability and computational efficiency.

[0639] Implementing an early stopping strategy can prevent overfitting. Monitor the performance on the validation set and stop training when the performance stops improving.

[0640] In addition, it is also important to implement a learning rate scheduling strategy. Techniques such as learning rate decay or cyclical learning rates can be used to achieve finer parameter adjustments in the later stages of training.

[0641] During the training process, the model performance is regularly evaluated on the validation set, monitoring indicators such as accuracy, precision, recall, etc. This helps to promptly identify and resolve problems in training, such as overfitting or underfitting.

[0642] Finally, the best model from the training process is saved for later use or further fine-tuning. This is usually judged based on performance metrics on the validation set.

[0643] S4.2.3: First parameter tuning of LSTM using standard Monte Carlo method

[0644] The standard Monte Carlo method is an optimization technique based on random sampling, which is used to find the optimal configuration in a large parameter space. Applying this method in the LSTM model can help the embodiment of the present invention find better initial parameter settings, thereby improving model performance.

[0645] The core idea of ​​this method is to explore the parameter space through random sampling, evaluate the performance of multiple parameter combinations, and then select the best combination. It is particularly suitable for situations where the parameter space is large and there may be complex interactions between parameters, such as hyperparameter tuning of LSTM networks.

[0646] S4.2.3.1: Define the parameter search space, including learning rate, number of LSTM units, number of layers

[0647] Defining the parameter search space is the first step of the Monte Carlo method, which determines the range and granularity of parameters to be explored in the embodiments of the present invention. For the LSTM network, the following parameters are mainly considered:

[0648] Learning rate: Usually defined on a logarithmic scale, such as from 1e-5 to 1e-1. This is because the learning rate has a large impact on model training, and the optimal value is usually significantly different in magnitude.

[0649] Number of LSTM units: can be defined as an integer range, such as 32 to 512. The number of units affects the capacity and complexity of the model, and requires a trade-off between expressiveness and computational efficiency.

[0650] Number of layers: Usually defined as a small range of integers, such as 1 to 5. Increasing the number of layers can improve the expressiveness of the model, but it also increases the risk of overfitting and computational complexity.

[0651] In addition, other parameters can also be considered, such as dropout rate, batch size, etc. Each parameter should have a reasonable range of values, which can be determined based on domain knowledge or preliminary experimental results.

[0652] S4.2.3.2: Generate multiple parameter combinations from the parameter search space based on random sampling function

[0653] Random sampling is the core of the Monte Carlo method. The embodiment of the present invention needs to implement a sampling function that can randomly generate parameter combinations from a defined parameter space.

[0654] For continuous parameters (such as learning rate), you can use uniform distribution or log uniform distribution for sampling. For discrete parameters (such as the number of layers), you can use discrete uniform distribution.

[0655] The sampling process should take into account the dependencies between parameters. For example, when the number of layers increases, it may be necessary to reduce the number of units in each layer to control the overall model complexity.

[0656] The number of parameter combinations generated is a trade-off between exploration sufficiency and computational resources. Typically, generating tens to hundreds of combinations is a reasonable starting point.

[0657] S4.2.3.3: Based on the evaluation function, calculate the performance index of each parameter group in multiple parameter combinations

[0658] The evaluation function is used to measure the performance of each set of parameters. For the task of anomaly detection of biochemical reaction curves, the following indicators can be considered:

[0659] Accuracy: The proportion of samples that are correctly classified.

[0660] Precision and Recall: Special attention is paid to the performance of anomaly detection.

[0661] F1 score: The harmonic average of precision and recall.

[0662] AUC-ROC: Evaluates the performance of the model at different decision thresholds.

[0663] The evaluation process usually involves training the model with given parameters and then testing the performance on the validation set. To reduce the impact of randomness, multiple training and evaluation can be performed and the average performance can be taken.

[0664] Considering the computing resource constraints, you can use early stopping strategy or limit the number of training rounds to speed up the evaluation process.

[0665] S4.2.3.4: Iterate and optimize to select the first parameter combination with the best performance

[0666] After evaluating all parameter combinations, embodiments of the present invention need to analyze the results and select the best combination, which is usually based on key performance indicators, such as the F1 score or AUC-ROC value on the validation set.

[0667] In addition to selecting a single optimal combination, the influence trend of the parameters on the performance should also be analyzed, which can help the embodiments of the present invention understand the interaction between the parameters and provide guidance for subsequent optimization.

[0668] You can use visualization techniques, such as scatter plots or heat maps, to show the relationship between parameters and performance. This helps to intuitively understand the structure of the parameter space.

[0669] Once the best parameter combination is selected, the model should be retrained on the full training set using these parameters and a final evaluation should be performed on the test set to verify the effectiveness of the parameters.

[0670] Finally, record the findings and best parameter combinations throughout the process to provide a basis for subsequent model iteration and optimization. This process may need to be repeated multiple times, each time adjusting the parameter search space based on the previous results to gradually approach the global optimal solution.

[0671] S4.2.4: Second parameter adjustment of LSTM using quasi-Monte Carlo method

[0672] Quasi-Monte Carlo methods are a modified version of the standard Monte Carlo method that uses low-discrepancy sequences instead of pure random sampling to more evenly cover the parameter space. Such methods can often converge to the optimal solution faster, especially in high-dimensional parameter spaces.

[0673] Using the quasi-Monte Carlo method in LSTM parameter tuning can explore the parameter space more effectively, especially in the refinement search phase after the first parameter tuning. This method can provide more comprehensive and uniform coverage of the parameter space with a smaller number of sampling points.

[0674] S4.2.4.1: Select low-discrepancy sequences, including Sobol or Halton sequences

[0675] Low-discrepancy sequences are at the core of quasi-Monte Carlo methods. These sequences are more evenly distributed in parameter space and can more effectively explore the interactions between parameters.

[0676] The Sobol sequence is a commonly used low-discrepancy sequence that performs well in high-dimensional space and can maintain good uniformity. The generation of the Sobol sequence is based on a series of direction numbers, which can gradually generate sampling points.

[0677] Halton sequence is another common choice, which generates sequences based on the base expansion of different prime numbers. Halton sequence performs well in low-dimensional space, but may show correlation in high-dimensional space.

[0678] The choice of which sequence to choose depends on the dimensionality and characteristics of the problem. For LSTM parameter tuning, if there are many parameters to tune (high dimensionality), the Sobol sequence may be more appropriate; if there are few parameters (low dimensionality), the Halton sequence may be sufficient.

[0679] S4.2.4.2: Generate low-discrepancy points using a sampling function based on a low-discrepancy sequence

[0680] Based on the selected low-discrepancy sequence, the embodiment of the present invention needs to implement a sampling function to generate low-discrepancy points in the parameter space. This process involves mapping the low-discrepancy sequence to the actual parameter value.

[0681] For each parameter, its range and distribution need to be defined. For example, the learning rate may be uniformly distributed on a logarithmic scale, while the number of LSTM units may be uniformly distributed on a linear scale.

[0682] The sampling function should be able to generate a predetermined number of sampling points. The number of sampling points should be large enough to cover the parameter space, but also take into account the limitations of computing resources.

[0683] The generated low-discrepancy points should cover the entire parameter space, including edge cases. This helps discover extreme parameter combinations that might be missed by random sampling.

[0684] S4.2.4.3: Map the generated low-difference points to the first parameter combination to generate the second parameter combination

[0685] This step maps the points generated by the low-discrepancy sequences to actual parameter values ​​to generate candidate combinations for the second round of parameter adjustment.

[0686] The mapping process should take into account the results of the first parameter adjustment. You can focus the search around the areas that performed well in the first adjustment to perform a more refined search.

[0687] For continuous parameters (such as learning rate), linear or nonlinear mapping functions can be used to convert low-difference points to actual parameter values. For discrete parameters (such as the number of layers), rounding or thresholding methods can be used.

[0688] When mapping, be careful to maintain a reasonable relationship between parameters. For example, make sure that deeper networks do not have too many LSTM units to avoid over-parameterization.

[0689] The resulting second parameter combinations should include both small tweaks to the first best result as well as some larger changes to balance local optimization and global exploration.

[0690] S4.2.4.4: Evaluate the mapped second parameter combination

[0691] The process of evaluating the second parameter combination is similar to the first parameter adjustment, but can be more refined and rigorous.

[0692] Use the same evaluation metrics as the first tuning, such as accuracy, F1 score, AUC-ROC, etc., to maintain consistency and comparability.

[0693] Consider increasing the rigor of your evaluation, for example using k-fold cross-validation to obtain more stable estimates of performance.

[0694] New evaluation indicators, such as model convergence speed, overfitting degree, etc., can be introduced to comprehensively evaluate the performance of parameter combinations.

[0695] Compare the best result of the second parameter combination with the first adjustment, and analyze the magnitude and pattern of performance improvement.

[0696] Record and visualize evaluation results to identify trends and patterns in parameter adjustments. This can help understand the impact of different parameters on model performance.

[0697] Based on the evaluation results, the best combination of parameters is selected. If the second adjustment does not bring significant improvement, the results of the first adjustment can be considered to be retained.

[0698] Finally, the final model is trained on the full dataset using the selected optimal parameters and a final evaluation is performed on an independent test set to verify the effectiveness of the parameter tuning.

[0699] S4.3: Analysis using one-dimensional convolutional neural network 1DCNN

[0700] One-dimensional convolutional neural network (1DCNN) is a powerful tool for processing sequence data, especially for analyzing time series data such as biochemical reaction curves. 1DCNN can automatically learn local features and long-range dependencies, effectively extract features while maintaining temporal information, which makes it an ideal choice for anomaly detection tasks.

[0701] The main advantage of 1DCNN is its ability to capture local patterns and features while learning more complex temporal dependencies through deep structures. This property enables 1DCNN to identify subtle changes and abnormal patterns in biochemical reaction curves, even if these patterns appear at different time scales.

[0702] When applying 1DCNN in biochemical reaction curve anomaly detection, the embodiments of the present invention need to consider factors such as network depth, convolution kernel size, pooling strategy, etc. to balance the model's expressiveness, computational efficiency, and generalization performance.

[0703] S4.3.1: Construct a 1DCNN network structure, including convolutional layers, pooling layers, and fully connected layers

[0704] Building a 1DCNN network structure is the basis of the entire analysis process. A typical 1DCNN structure includes multiple convolutional layers, pooling layers, and finally a fully connected layer. Each component has its specific role and design considerations:

[0705] Convolutional Layer:

[0706] The convolution layer is the core of 1DCNN and is responsible for extracting local features. In biochemical reaction curve analysis, the convolution operation can capture the change pattern in a short time.

[0707] The following factors need to be considered when designing a convolutional layer:

[0708] 1. Convolution kernel size: determines the size of the time window considered by each convolution operation. Smaller kernels can capture rapid changes, and larger kernels can capture longer-term patterns.

[0709] 2. Number of convolution kernels: More convolution kernels can learn more diverse features, but also increase the complexity of the model.

[0710] 3. Step size: controls the sliding speed of the convolution operation and affects the temporal resolution of the output.

[0711] 4. Padding strategy: You can use zero padding to maintain the output size, or use effective convolution to reduce the output size.

[0712] Pooling layer:

[0713] The pooling layer is used to reduce the resolution of the feature map and extract the most significant features. In 1DCNN, maximum pooling or average pooling is often used.

[0714] Design considerations for the pooling layer:

[0715] 1. Pooling window size: determines the degree of feature compression.

[0716] 2. Step size: Usually the same as the window size to avoid overlap.

[0717] 3. Pooling type: Maximum pooling focuses more on salient features, while average pooling retains more overall information.

[0718] Fully connected layer:

[0719] The fully connected layer is located at the end of the network and is responsible for mapping the learned features to the final classification results.

[0720] Design considerations for the fully connected layer:

[0721] 1. Number of layers: Usually 1-2 fully connected layers are used. Too many fully connected layers may lead to overfitting.

[0722] 2. Number of neurons: The number of neurons in the first fully connected layer is usually large, and then decreases layer by layer.

[0723] 3. Activation function: ReLU activation function is usually used, and the last layer uses sigmoid (binary classification) or softmax (multi-classification).

[0724] Other considerations for network structure design:

[0725] 1. Depth: Increasing the network depth can improve the expressiveness of the model, but it also increases the risk of overfitting and computational complexity.

[0726] 2. Residual connection: In deep networks, you can consider adding residual connections to alleviate the gradient vanishing problem.

[0727] 3. Batch Normalization: Adding a batch normalization layer after the convolutional layer can speed up training and improve model stability.

[0728] 4.Dropout: Adding Dropout between fully connected layers can reduce overfitting.

[0729] Finally, the specific design of the network structure should be adjusted and optimized according to the characteristics of the biochemical reaction curve data (such as sequence length, sampling frequency) and task requirements (such as real-time requirements, available computing resources). You can start with a relatively simple structure and gradually increase the complexity until you find the best balance.

[0730] S4.3.2: Optimizing 1DCNN Hyperparameters Using a Hybrid Metaheuristic Algorithm

[0731] The hybrid meta-heuristic algorithm combines the advantages of multiple optimization methods to solve complex hyperparameter optimization problems. This method is particularly suitable for 1DCNN hyperparameter tuning because it can effectively find approximate optimal solutions in large-scale, high-dimensional search spaces.

[0732] S4.3.2.1: Construct genetic algorithm GA, particle swarm optimization PSO and simulated annealing SA algorithm

[0733] Genetic Algorithm (GA):

[0734] GA simulates the biological evolution process and optimizes hyperparameters through selection, crossover and mutation operations.

[0735] The key components include: chromosome encoding (representing a combination of hyperparameters), fitness function (evaluating performance), selection mechanism, crossover operation, and mutation operation.

[0736] GA is suitable for exploring the solution space in a large range and can escape from the local optimum.

[0737] Particle Swarm Optimization (PSO):

[0738] PSO simulates group behavior, where each particle represents a set of hyperparameters and moves in the search space.

[0739] Key components include: updating rules for particle positions and velocities, and tracking of individual optimal positions and global optimal positions.

[0740] PSO is good at converging quickly to the promising area, but may fall into local optimality.

[0741] Simulated Annealing (SA):

[0742] SA simulates the metal cooling process and allows accepting poor solutions with a certain probability to escape from the local optimum.

[0743] Key components include: temperature scheduling (controlling the probability of accepting a worse solution), neighborhood generation (generating new hyperparameter combinations), and acceptance criteria.

[0744] SA excels at local search and is able to fine-tune hyperparameters at a later stage.

[0745] S4.3.2.2: Design the switching conditions and information exchange mechanism of the above algorithm

[0746] Switching conditions:

[0747] Iteration-based: Switch algorithms every fixed number of times.

[0748] Based on performance improvement: switch when the current algorithm gets stuck.

[0749] Based on the exploration-exploitation balance: GA and PSO are favored in the early stage, and SA is favored in the later stage.

[0750] Information exchange mechanism:

[0751] Population / particle sharing: GA and PSO share the best individuals.

[0752] Optimal solution transfer: The global optimal solution is transferred between algorithms.

[0753] Solution space partitioning: Different algorithms are responsible for different parameter subspaces.

[0754] Collaborative Strategy:

[0755] Parallel operation: Run multiple algorithms at the same time, exchanging information regularly.

[0756] Sequential operation: Run each algorithm in a predetermined order, and each operation inherits the optimal solution of the previous algorithm.

[0757] S4.3.2.3: Define the hyperparameter search space, including convolution kernel size, number of layers, and learning rate

[0758] Convolution kernel size:

[0759] Range: Usually an odd number, such as [3,5,7,9,11].

[0760] Considerations: Smaller kernels capture local features, larger kernels capture long-term dependencies.

[0761] Network layers:

[0762] Range: such as [2,3,4,5,6] (including convolutional layers and fully connected layers).

[0763] Considerations: Increasing the number of layers increases model complexity, but also increases the risk of overfitting.

[0764] Learning Rate:

[0765] Range: Typically on a logarithmic scale, like [1e-4, 1e-3, 1e-2, 1e-1].

[0766] Factors to consider: Impact on model convergence speed and stability.

[0767] Other possible hyperparameters:

[0768] Number of convolution kernels: such as [16, 32, 64, 128].

[0769] Pooling size: such as [2,3,4].

[0770] Dropout rate: such as [0.1, 0.3, 0.5].

[0771] Batch size: such as [32, 64, 128, 256].

[0772] S4.3.2.4: Generate and evaluate hyperparameter combinations using a hybrid strategy

[0773] Generate strategy:

[0774] Initialization: Use Latin hypercube sampling to generate the initial population to ensure that the entire search space is covered.

[0775] GA generation: Generate new hyperparameter combinations through crossover and mutation.

[0776] PSO generation: Generate new combinations by updating particle positions.

[0777] SA generation: Generates disturbances around the current optimal solution.

[0778] Evaluation strategy:

[0779] Performance indicators: such as accuracy on the validation set, F1 score, AUC, etc.

[0780] Computational cost: Consider model size and training time.

[0781] Cross-validation: Use k-fold cross-validation to improve evaluation stability.

[0782] Optimization process:

[0783] 1. Initialization: Generate different initial hyperparameter combinations.

[0784] 2. Evaluation: Train the model and evaluate the performance on the validation set.

[0785] 3. Update: Update the hyperparameter combination according to the algorithm currently used.

[0786] 4. Switch: Switch the optimization algorithm according to predefined conditions.

[0787] 5. Information exchange: Share optimal solutions and search information among different algorithms.

[0788] 6. Repeat steps 2-5 until the stopping condition is met (such as reaching the maximum number of iterations or the performance is no longer significantly improved).

[0789] Final Choice:

[0790] Select the optimal hyperparameter combination.

[0791] Consider performance and model complexity.

[0792] Final evaluation is performed on an independent test set.

[0793] Through this hybrid meta-heuristic method, the embodiments of the present invention can fully utilize the advantages of various optimization algorithms and efficiently find the excellent configuration of 1DCNN in a complex hyperparameter space, thereby improving the performance of the model in the task of biochemical reaction curve anomaly detection.

[0794] S4.3.3: Use the training dataset to train 1DCNN and use the machine learning model to assist in optimizing the training process of 1DCNN

[0795] This step combines the 1DCNN training process with the hyperparameter optimization strategy based on the machine learning model, aiming to find the optimal model configuration more efficiently.

[0796] Training 1DCNN:

[0797] Use the prepared training dataset to train the model.

[0798] Implement standard deep learning training processes, including forward propagation, backpropagation, gradient updates, etc.

[0799] Adopt an appropriate learning rate scheduling strategy, such as learning rate decay or cyclical learning rate.

[0800] Implement early stopping strategy to prevent overfitting.

[0801] S4.3.3.1: Build a Gaussian process regression GPR or random forest RF regression model

[0802] Gaussian Process Regression (GPR):

[0803] GPR is a probabilistic model that can provide estimates of the uncertainty of predictions.

[0804] Applicable to continuous hyperparameter space and can capture complex nonlinear relationships.

[0805] The computational cost increases rapidly with the amount of data, and is suitable for small and medium-sized hyperparameter optimization tasks.

[0806] Random Forest Regression (RF):

[0807] RF is an ensemble learning method consisting of multiple decision trees.

[0808] Applicable to both discrete and continuous hyperparameter spaces and insensitive to outliers.

[0809] The training speed is fast and can process large-scale data.

[0810] Uncertainty estimates of predictions are not provided directly, but can be approximated by the between-tree variance.

[0811] Model construction:

[0812] Select an appropriate kernel function (GPR) or set the number and depth of trees (RF).

[0813] Use the evaluated hyperparameter combinations and their performance as training data.

[0814] Consider feature engineering, such as normalizing or encoding hyperparameters.

[0815] S4.3.3.2: Use GPR or RF regression models to predict performance for unevaluated hyperparameter combinations

[0816] Generate candidate hyperparameter combinations:

[0817] Generate potential hyperparameter combinations using a hybrid metaheuristic algorithm.

[0818] Make sure the generated combinations cover different areas of the search space.

[0819] Performance prediction:

[0820] Candidate hyperparameter combinations are input into the trained GPR or RF model.

[0821] For GPR, get the mean and variance of the predictions.

[0822] For RF, the predicted values ​​and the between-tree variance (as an estimate of uncertainty) are obtained.

[0823] Prediction results analysis:

[0824] Identify hyperparameter combinations with high predictive performance.

[0825] Consider the uncertainty of predictions and balance exploration and exploitation.

[0826] S4.3.3.3: Guiding the search direction of the hybrid metaheuristic algorithm based on the prediction results

[0827] Update search strategy:

[0828] Add the hyperparameter combination with high predictive performance to the population of GA, the particle swarm of PSO, or the current solution of SA.

[0829] Adjust algorithm parameters such as crossover probability for GA, velocity weight for PSO, or temperature for SA to bias towards promising regions.

[0830] Explore unknown areas:

[0831] Identify areas of high forecast uncertainty, which may indicate potential high-performance areas.

[0832] Allocate a portion of computing resources to evaluate these high-uncertainty hyperparameter combinations.

[0833] Using known information:

[0834] Focus resources on evaluating hyperparameter combinations that have high predictive performance and low uncertainty.

[0835] Updated search: More fine-grained searches around known high-performance areas.

[0836] S4.3.3.4: Dynamically adjust search strategies to balance exploration and exploitation

[0837] Adaptive sampling strategy:

[0838] Initially, the algorithm tends to explore and search a wide range of hyperparameter spaces.

[0839] As the search progresses, gradually increase the proportion of utilization and focus on promising areas.

[0840] Multi-objective optimization:

[0841] Consider both prediction performance and prediction uncertainty.

[0842] The Pareto optimization method is used to select the hyperparameter combination to be evaluated next.

[0843] Dynamic resource allocation:

[0844] Dynamically adjust resource allocation of different algorithms (GA, PSO, SA) according to the current optimal solution and search progress.

[0845] Allocate more resources to algorithms with good performance, but reserve certain resources for other algorithms to maintain diversity.

[0846] Online learning and updates:

[0847] Periodically retrain the GPR or RF model to incorporate new evaluation results.

[0848] Adjust the model's hyperparameters (such as the kernel function parameters for GPR or the number of trees for RF) to adapt to changes in the search process.

[0849] Termination conditions:

[0850] Set multiple termination conditions, such as reaching a predetermined number of evaluations, performance improvement below a threshold, computation time limit, etc.

[0851] Implement a soft termination strategy to gradually reduce exploration and increase utilization when some termination conditions are met.

[0852] Result verification and analysis:

[0853] The optimal hyperparameter combination found is evaluated multiple times independently to ensure the stability of the results.

[0854] Analyze the impact of hyperparameters on performance.

[0855] By combining this method with a machine learning model, the embodiment of the present invention can more intelligently guide the hyperparameter optimization process of 1DCNN and find a better model configuration under limited computing resources. This method is particularly suitable for complex biochemical reaction curve anomaly detection tasks, and can more effectively improve model performance and accelerate the development process.

[0856] S4.4: Analysis using neural networks with random weights and learning biases

[0857] This special neural network structure combines random weights and learnable biases to provide a computationally efficient and adaptable model that is particularly suitable for processing complex time series data such as biochemical reaction curves.

[0858] The core idea of ​​random weight neural networks is to keep the weights of the input to the hidden layer fixed (no longer updated after random initialization) and only learn the bias of the output layer. This approach can greatly reduce the number of parameters that need to be optimized and speed up training while still maintaining good performance in some tasks.

[0859] S4.4.1: Construct a random weight neural network structure, including an input layer, a random weight hidden layer, and a learnable bias output layer

[0860] Input Layer:

[0861] Design the input layer to match the dimensions of the biochemical reaction curve data.

[0862] Random weight hidden layer:

[0863] Decide on the number of hidden layers and the number of neurons in each layer. Generally, using more hidden layers can improve the expressiveness of the model.

[0864] Initialization strategy: Initialize weights using an appropriate random distribution, such as uniform distribution or Gaussian distribution. The scale of weights has an important impact on model performance.

[0865] Activation function: Choose a suitable nonlinear activation function, such as ReLU, tanh or sigmoid. Different activation functions may lead to different feature extraction capabilities.

[0866] Learnable bias output layer:

[0867] Design the structure of the output layer to make it suitable for the anomaly detection task. For a binary classification problem, a single output neuron can be used.

[0868] Initialize the biases of the output layer. These biases are the only learnable parameters in the model.

[0869] Network structure considerations:

[0870] Inter-layer connections: Consider whether to add skip connections or residual connections, which may help information flow and gradient propagation.

[0871] Regularization: Although the hidden layer weights are fixed, you can still consider using regularization techniques on the output layer, such as L1 / L2 regularization.

[0872] S4.4.2: Design and optimize learning biases, including initializing bias values ​​and updating strategies

[0873] Bias initialization:

[0874] Consider initializing the biases with small random values, such as sampling from a uniform or Gaussian distribution.

[0875] The initialization strategy should take into account the characteristics of the activation function to avoid saturation problems.

[0876] Update strategy:

[0877] Choose a suitable optimization algorithm such as Stochastic Gradient Descent (SGD), Adam, or RMSprop.

[0878] Design learning rate scheduling strategies, such as learning rate decay or periodic learning rate adjustment.

[0879] Special considerations for biased learning:

[0880] Since only the bias of the output layer needs to be learned, a larger learning rate can be used to speed up the convergence.

[0881] Implement early stopping strategy to prevent overfitting.

[0882] Consider using momentum or adaptive learning rate methods to improve learning stability and efficiency.

[0883] Optimization goal:

[0884] Design a loss function suitable for the anomaly detection task, such as binary cross entropy or focal loss.

[0885] Consider adding regularization terms to the loss function to control model complexity.

[0886] Dynamic adjustment of deviation updates:

[0887] Implement a dynamic bias adjustment mechanism to adaptively adjust the bias update strategy based on model performance and data characteristics.

[0888] Consider using validation set performance to guide the bias update process, such as reducing the learning rate when validation performance stops improving.

[0889] Ensemble methods:

[0890] Consider training multiple models with different random weight initializations and then ensembling their predictions.

[0891] Explore different ensemble strategies such as simple averaging, weighted averaging, or voting.

[0892] Continuous learning and adaptation:

[0893] Design mechanisms to allow models to continue fine-tuning bias after deployment to accommodate potential changes in data distribution.

[0894] Implement an incremental learning strategy so that the model can gradually absorb new data samples.

[0895] Evaluation and Validation:

[0896] Use techniques such as cross-validation to assess the stability of model performance.

[0897] Analyze the impact of different initialization and update strategies on model performance.

[0898] By carefully designing and optimizing this neural network with random weights and learning biases, embodiments of the present invention can create a model with high computational efficiency and strong adaptability, which is particularly suitable for the task of anomaly detection of biochemical reaction curves. This method can capture complex data patterns while maintaining the simplicity of the model, providing an effective solution for real-time or resource-constrained environments.

[0899] S4.4.3: Optimize network parameters using the improved covariance matrix adaptive evolution strategy CMAES multimodal optimization algorithm

[0900] Covariance Matrix Adaptive Evolution Strategy (CMAES) is a powerful optimization algorithm, especially suitable for dealing with complex nonlinear optimization problems. In the optimization of random weight neural networks, CMAES can effectively optimize the learnable bias parameters.

[0901] S4.4.3.1: Construct CMAES framework

[0902] Core components of CMAES:

[0903] 1. Population: a set of candidate solutions, each solution represents a set of network bias parameters.

[0904] 2. Mean vector: represents the estimate of the current optimal solution.

[0905] 3. Covariance matrix: describes the correlation between parameters and the search direction.

[0906] 4. Step size: controls the size of the search range.

[0907] The main steps of CMAES include:

[0908] 1. Initialization: Set the initial mean vector, covariance matrix and step size.

[0909] 2. Sampling: Generate new candidate solutions based on the current distribution.

[0910] 3. Evaluation: Calculate the fitness (network performance) of each candidate solution.

[0911] 4. Selection: Select the best candidate solution to update the mean vector.

[0912] 5. Update: Update the covariance matrix and step size according to the selection results.

[0913] 6. Iteration: Repeat steps 2-5 until the termination condition is met.

[0914] S4.4.3.2: Integrate the distance-based niche method to maintain multiple excellent solutions

[0915] Among them, the introduction of the niche method includes:

[0916] 1. Define the distance metric: design a distance function suitable for the deviation parameter space.

[0917] 2. Niche formation: Similar solutions are clustered into niches based on a distance threshold.

[0918] 3. Multimodal maintenance: retaining the local optimal solution in each ecological niche.

[0919] The main implementation steps are as follows:

[0920] 1. Cluster each generation of population to form multiple ecological niches.

[0921] 2. Perform CMAES updates within each niche.

[0922] 3. Maintain a global elite set that includes excellent solutions from different ecological niches.

[0923] S4.4.3.3: Design a niche radius adaptive adjustment mechanism

[0924] Niche radius determines the size of the niche and affects the exploration-exploitation balance of the algorithm.

[0925] The adaptive adjustment strategies include:

[0926] 1. Initialization: Set a larger initial Niche radius.

[0927] 2. Contraction mechanism: As iterations proceed, the Niche radius is gradually reduced and the local search intensity is increased.

[0928] 3. Expansion mechanism: When a new excellent solution is discovered, the Niche radius is temporarily increased to promote exploration.

[0929] 4. Density-dependent adjustment: Dynamically adjust the radius based on the density of solutions within the niche.

[0930] For example, an adaptive formula can be used, such as r = r0(1t / T) α , where t is the current iteration number, T is the maximum iteration number, α is the adjustment coefficient, r and r0 are the niche radius and niche initial radius respectively.

[0931] S4.4.3.4: Implementing step size adaptive adjustment strategy

[0932] The role of the step size is to control the scope and accuracy of the CMAES search, affecting the convergence speed and the quality of the solution.

[0933] Adaptive adjustment strategies include:

[0934] 1. Success rate tracking: record the rate of generating improved solutions.

[0935] 2.1 / 5 rule: If the success rate is higher than 1 / 5, increase the step length; if it is lower than 1 / 5, reduce the step length.

[0936] 3. Exponential smoothing: Use an exponential moving average to smooth out changes in step size.

[0937] The specific implementation method is:

[0938] σ(t+1)=σ(t)exp((ps 0.2) / 0.8), where ps is the success rate and σ is the step size.

[0939] S4.4.3.5: Design mechanisms to maintain population diversity

[0940] Maintaining population diversity can prevent premature convergence and help explore a wider solution space.

[0941] Diversity maintenance strategies include:

[0942] 1. Distance penalty: Add a distance penalty term to the fitness evaluation to encourage dispersion between solutions.

[0943] 2. Crowding sorting: Consider the congestion of the solution in the selection operation and give priority to solutions located in sparse areas.

[0944] 3. Restart mechanism: When the diversity is below the threshold, the population is partially reinitialized.

[0945] 4. Cross-operation: Introduce appropriate cross-operation to promote information exchange and the generation of new solutions.

[0946] Specific implementation method:

[0947] 1. Define a diversity measure, such as the average Euclidean distance between solutions in the population.

[0948] 2. Calculate and monitor diversity metrics at each generation iteration.

[0949] 3. When the diversity drops below a certain threshold, a diversity maintenance operation is triggered.

[0950] Through these improvements, the CMAES algorithm can handle multimodal optimization problems more effectively and adapt to the complexity of the biochemical reaction curve anomaly detection task. This method can find multiple high-quality solutions in the parameter space, improving the robustness and generalization ability of the model. At the same time, the introduction of the adaptive mechanism enables the algorithm to better balance exploration and utilization, improving search efficiency and solution quality.

[0951] Here are three examples of how to use different AI models for abnormal curve detection:

[0952] Example 1: Using a long short-term memory network (LSTM) to analyze biochemical reaction time series data, during which the parameters of the LSTM algorithm are adjusted based on standard Monte Carlo and quasi-Monte Carlo methods

[0953] B1. Data preparation and preprocessing

[0954] B1.1. Collecting time series data of biochemical reactions

[0955] B1.1.1. Obtaining reaction data at multiple time points from the biochemical analyzer

[0956] B1.1.2. Collect corresponding label information (normal / abnormal)

[0957] B1.2. Data cleaning

[0958] B1.2.1. Removing noise and outliers

[0959] B1.2.2. Handling missing data

[0960] B1.3. Data standardization

[0961] B1.3.1. Normalizing time series data

[0962] B1.3.2. Ensure that all sequences have the same length (padding or truncating if necessary)

[0963] B1.4. Dataset Division

[0964] B1.4.1. Divide the dataset into training set, validation set and test set

[0965] B1.4.2. Ensure that the proportion of normal and abnormal samples in each subset is consistent

[0966] B2. LSTM model design

[0967] B2.1. Define LSTM network structure

[0968] B2.1.1. Design the input layer (considering time steps and feature dimensions)

[0969] B2.1.2. Add one or more LSTM layers

[0970] B2.1.3. Design the output layer (for classification or regression)

[0971] B2.2. Choosing an activation function

[0972] B2.2.1. Choose an appropriate activation function (such as tanh) for the LSTM layer

[0973] B2.2.2. Choose an activation function for the output layer (e.g. sigmoid for binary classification)

[0974] B2.3. Defining loss function and optimizer

[0975] B2.3.1. Choose a loss function suitable for the task (such as binary cross entropy)

[0976] B2.3.2. Select an optimization algorithm (such as Adam)

[0977] B3. Monte Carlo method implementation

[0978] B3.1. Standard Monte Carlo (MC) method

[0979] B3.1.1. Define parameter search space (learning rate, number of LSTM units, number of layers, etc.)

[0980] B3.1.2. Implement a random sampling function to generate parameter combinations from the search space

[0981] B3.1.3. Design an evaluation function to calculate the performance index for each set of parameters

[0982] B3.2. Quasi-Monte Carlo (QMC) method

[0983] B3.2.1. Choose an appropriate low-discrepancy sequence (such as Sobol sequence or Halton sequence)

[0984] B3.2.2. Implementing sampling functions based on selected sequences

[0985] B3.2.3. Mapping the generated low-discrepancy points to the parameter search space

[0986] B4.LSTM parameter adjustment process

[0987] B4.1. Initial parameter settings

[0988] B4.1.1. Set initial LSTM parameters (based on experience or default values)

[0989] B4.1.2. Defining the number of iterations for parameter adjustment

[0990] B4.2.MC / QMC sampling and evaluation

[0991] B4.2.1. Generate parameter combinations using MC or QMC methods

[0992] B4.2.2. Model training and evaluation for each set of parameters

[0993] B4.2.3. Record the performance indicators of each group of parameters

[0994] B4.3. Parameter Optimization

[0995] B4.3.1. Analyze the evaluation results and select the best performance parameter combination

[0996] B4.3.2. Based on the optimal parameters, narrow the search space for the next round of iteration

[0997] B4.4. Iterative Optimization

[0998] B4.4.1. Repeat steps B4.2 and B4.3 until the predetermined number of iterations is reached or the performance converges

[0999] B4.4.2. Record the best parameters and corresponding performance indicators for each iteration

[1000] B5. Model training and validation

[1001] B5.1. Training the LSTM model using optimized parameters

[1002] B5.1.1. Training the model on the training set

[1003] B5.1.2. Use the validation set for model tuning

[1004] B5.2. Model evaluation

[1005] B5.2.1. Evaluate model performance on the test set

[1006] B5.2.2. Calculate key metrics (such as accuracy, precision, recall, F1 score)

[1007] B5.3. Model Interpretation Analysis

[1008] B5.3.1. Visualizing the activation state of LSTM layers

[1009] B5.3.2. Analyzing the model's attention to different time steps

[1010] B6. System Integration and Deployment

[1011] B6.1. Develop real-time data processing modules

[1012] B6.1.1. Realize the data interface with the biochemical analyzer

[1013] B6.1.2. Design real-time data preprocessing process

[1014] B6.2. Ensemble LSTM Model

[1015] B6.2.1. Integrate the trained LSTM model into the system

[1016] B6.2.2. Realize real-time prediction function

[1017] B6.3. Result display and alarm system

[1018] B6.3.1. Design a user interface to display forecast results and key indicators

[1019] B6.3.2. Implement anomaly detection and alarm mechanism

[1020] B7. System verification and continuous optimization

[1021] B7.1. Laboratory validation

[1022] B7.1.1. Conduct system testing in a simulated environment

[1023] B7.1.2. Evaluate the accuracy and real-time performance of the system

[1024] B7.2. Clinical trials

[1025] B7.2.1. Deployment of the system in an actual clinical setting

[1026] B7.2.2. Collect clinical feedback and evaluate system effectiveness

[1027] B7.3. Continuous Optimization

[1028] B7.3.1. Regularly update the model with new data

[1029] B7.3.2. Adjust parameters and model structure based on clinical feedback

[1030] These steps describe in detail how to use LSTM networks to analyze biochemical reaction time series data and adjust the parameters of the LSTM algorithm through standard Monte Carlo and Quasi-Monte Carlo methods. This method can effectively capture long-term dependencies in time series data while improving model performance and stability through advanced parameter adjustment methods.

[1031] Example 2: Using a one-dimensional convolutional neural network (1DCNN) to identify patterns in biochemical reaction curves, and in the process, using a hybrid metaheuristic and machine learning model to optimize

[1032] C1. Data preparation and preprocessing

[1033] C1.1. Collecting biochemical reaction curve data

[1034] C1.1.1. Obtaining reaction curve data from a biochemical analyzer

[1035] C1.1.2. Collect corresponding label information (normal / abnormal / specific abnormal type)

[1036] C1.2. Data cleaning and standardization

[1037] C1.2.1. Removing noise and outliers

[1038] C1.2.2. Normalize the data

[1039] C1.3. Data Augmentation

[1040] C1.3.1. Applying time warping techniques

[1041] C1.3.2. Adding Gaussian noise

[1042] C1.4. Dataset Partitioning

[1043] C1.4.1. Divide the dataset into training set, validation set and test set

[1044] C1.4.2. Ensure that the proportion of samples of each category in each subset is consistent

[1045] C2.1DCNN model design

[1046] C2.1. Define the network structure

[1047] C2.1.1. Design the input layer (considering time series length and feature dimension)

[1048] C2.1.2. Add multiple one-dimensional convolutional layers and pooling layers

[1049] C2.1.3. Design of fully connected layers and output layers

[1050] C2.2. Choosing an activation function

[1051] C2.2.1. Choose activation functions (such as ReLU) for convolutional and fully connected layers

[1052] C2.2.2. Choose an appropriate activation function for the output layer (such as softmax for multi-classification)

[1053] C2.3. Defining loss function and optimizer

[1054] C2.3.1. Choose a loss function suitable for the task (such as cross entropy)

[1055] C2.3.2. Choose an optimization algorithm (such as Adam or RMSprop)

[1056] C3. Hybrid meta-heuristic optimization algorithm design

[1057] C3.1. Choosing a base metaheuristic algorithm

[1058] C3.1.1. Implementing Genetic Algorithm (GA)

[1059] C3.1.2. Implementing Particle Swarm Optimization (PSO)

[1060] C3.1.3. Implementing the Simulated Annealing Algorithm (SA)

[1061] C3.2. Designing a hybrid strategy

[1062] C3.2.1. Define algorithm switching conditions

[1063] C3.2.2. Implementing information exchange mechanism between algorithms

[1064] C3.3. Defining the search space

[1065] C3.3.1. Determine the hyperparameters that need to be optimized (such as convolution kernel size, number of layers, learning rate, etc.)

[1066] C3.3.2. Define a range of values ​​for each hyperparameter

[1067] C4. Machine Learning Model Assisted Optimization

[1068] C4.1. Selecting auxiliary learning models

[1069] C4.1.1. Implementing the Gaussian Process Regression (GPR) model

[1070] C4.1.2. Implementing the Random Forest (RF) regression model

[1071] C4.2. Training auxiliary models

[1072] C4.2.1. Use initial hyperparameter combinations and their performance as training data

[1073] C4.2.2. Update the model regularly to incorporate new assessment results

[1074] C4.3. Predictive performance and guided search

[1075] C4.3.1. Using auxiliary models to predict performance for unevaluated hyperparameter combinations

[1076] C4.3.2. Guiding the search direction of the hybrid metaheuristic algorithm based on the prediction results

[1077] C5.1DCNN parameter optimization process

[1078] C5.1. Initialization

[1079] C5.1.1. Randomly generate an initial population of hyperparameter combinations

[1080] C5.1.2. Evaluating the performance of the initial population

[1081] C5.2. Iterative Optimization

[1082] C5.2.1. Generating New Hyperparameter Combinations Using Hybrid Metaheuristics

[1083] C5.2.2. Use auxiliary learning models to pre-screen potential combinations

[1084] C5.2.3. Training and evaluating the selected 1DCNN model

[1085] C5.2.4. Updating the optimal solution and the population

[1086] C5.3. Dynamic Adjustment

[1087] C5.3.1. Dynamically adjust the hybrid strategy based on the optimization progress

[1088] C5.3.2. Adaptive adjustment of search range

[1089] C5.4. Termination conditions

[1090] C5.4.1. Reaching the predetermined number of iterations or computing time

[1091] C5.4.2. Performance improvement is lower than the set threshold

[1092] C6. Model training and validation

[1093] C6.1. Training 1DCNN model using optimized parameters

[1094] C6.1.1. Training the model on the training set

[1095] C6.1.2. Use the validation set for model tuning

[1096] C6.2. Model Evaluation

[1097] C6.2.1. Evaluate model performance on the test set

[1098] C6.2.2. Calculate key indicators (such as accuracy, F1 score, AUCROC, etc.)

[1099] C6.3. Model Interpretation Analysis

[1100] C6.3.1. Visualizing Convolutional Kernels and Activation Maps

[1101] C6.3.2. Analysis of model sensitivity to different response curve characteristics

[1102] C7. System Integration and Deployment

[1103] C7.1. Develop real-time data processing modules

[1104] C7.1.1. Realize real-time data interface with biochemical analyzer

[1105] C7.1.2. Design data preprocessing and feature extraction process

[1106] C7.2. Integrated optimized 1DCNN model

[1107] C7.2.1. Deploy the trained model to the production environment

[1108] C7.2.2. Implementing real-time prediction and classification functions

[1109] C7.3. Result display and alarm system

[1110] C7.3.1. Design a user-friendly interface to display identification results and key indicators

[1111] C7.3.2. Implementing a multi-level anomaly detection alarm mechanism

[1112] C8. System verification and continuous optimization

[1113] C8.1. Laboratory Validation

[1114] C8.1.1. System testing in a simulated environment

[1115] C8.1.2. Evaluate the accuracy, real-time performance, and stability of the system

[1116] C8.2. Clinical trials

[1117] C8.2.1. Deployment of the system in a real clinical setting

[1118] C8.2.2. Collect clinical feedback and evaluate system effectiveness

[1119] C8.3. Continuous Optimization

[1120] C8.3.1. Regularly update the model with new data

[1121] C8.3.2. Adjust model structure and optimization strategy based on clinical feedback

[1122] C8.3.3. Explore transfer learning techniques to adapt to new biochemical reaction types

[1123] These steps describe in detail how to use a one-dimensional convolutional neural network (1DCNN) to identify biochemical reaction curve patterns and optimize them through a hybrid metaheuristic and machine learning model. This approach combines the advantages of 1DCNN in time series data processing with advanced optimization techniques to effectively improve model performance and adaptability, thereby more accurately identifying various biochemical reaction curve patterns.

[1124] Example 3. A neural network with random weights and learning biases for identifying and detecting outliers in biochemical reaction curves, using an improved CMAES multimodal optimization algorithm: integrating Niching strategy and dynamic adaptation mechanism

[1125] D1. Data preparation and preprocessing

[1126] D1.1. Collect biochemical reaction curve data

[1127] D1.1.1. Obtaining reaction curve data from the biochemical analyzer

[1128] D1.1.2. Mark known outliers and normal data points

[1129] D1.2. Data cleaning and standardization

[1130] D1.2.1. Removing Obvious Noise and Erroneous Data

[1131] D1.2.2. Normalize the data

[1132] D1.3. Data Augmentation

[1133] D1.3.1. Creating samples using sliding window techniques

[1134] D1.3.2. Apply a small amount of random perturbations to increase data diversity

[1135] D1.4. Dataset Division

[1136] D1.4.1. Divide the dataset into training set, validation set and test set

[1137] D1.4.2. Ensure that the ratio of outliers to normal data in each subset is consistent

[1138] D2. Random Weight Neural Network (RWNN) Design

[1139] D2.1. Network structure definition

[1140] D2.1.1. Design the input layer (considering the time window size and feature dimension)

[1141] D2.1.2. Add one or more hidden layers, using random weights

[1142] D2.1.3. Design output layer (for outlier identification)

[1143] D2.2. Random weight initialization

[1144] D2.2.1. Generating random weight matrices for hidden layers

[1145] D2.2.2. Choose an appropriate random distribution (such as uniform distribution or Gaussian distribution)

[1146] D2.3. Learning bias design

[1147] D2.3.1. Introducing a learnable bias term in the output layer

[1148] D2.3.2. Initialization bias value

[1149] D3. Improved CMAES multimodal optimization algorithm design

[1150] D3.1. Standard CMAES Implementation

[1151] D3.1.1. Basic framework for implementing the covariance matrix adaptive evolution strategy (CMAES)

[1152] D3.1.2. Define the objective function (e.g., minimize the error rate of outlier detection)

[1153] D3.2. Niching strategy integration

[1154] D3.2.1. Implementing the distance-based Niching method

[1155] D3.2.2. Design of Niche radius adaptive adjustment mechanism

[1156] D3.3. Dynamic Adaptation Mechanism

[1157] D3.3.1. Implementing adaptive step size adjustment

[1158] D3.3.2. Design strategies to maintain population diversity

[1159] D4. RWNN parameter optimization process

[1160] D4.1. Initialization

[1161] D4.1.1. Generate an initial population, each individual represents a set of learning biases

[1162] D4.1.2. Evaluating the fitness of the initial population

[1163] D4.2. Iterative Optimization

[1164] D4.2.1. Generating new learning bias combinations using improved CMAES

[1165] D4.2.2. Update the bias term of the RWNN model

[1166] D4.2.3. Evaluate model performance on the validation set

[1167] D4.2.4. Update population and fitness information

[1168] D4.3.Niching operation

[1169] D4.3.1. Identify and maintain multiple niches with excellent solutions

[1170] D4.3.2. Local search within a niche

[1171] D4.4. Dynamic Adaptation

[1172] D4.4.1. Adjusting step size based on optimization progress

[1173] D4.4.2. Dynamically adjust the niche radius

[1174] D4.5. Termination conditions

[1175] D4.5.1. Reaching the scheduled number of iterations

[1176] D4.5.2. The improvement of the best solution is lower than the threshold

[1177] D5. Model training and validation

[1178] D5.1. RWNN model training

[1179] D5.1.1. Training RWNN using optimized learning bias

[1180] D5.1.2. Forward propagation and error calculation on the training set

[1181] D5.1.3. Update the learnable bias of the output layer only

[1182] D5.2. Model evaluation

[1183] D5.2.1. Evaluate model performance on the test set

[1184] D5.2.2. Calculate key metrics (such as accuracy, precision, recall, F1 score)

[1185] D5.3. Outlier detection threshold optimization

[1186] D5.3.1. Determine the optimal detection threshold using ROC curve analysis

[1187] D5.3.2. Balancing assay sensitivity and specificity

[1188] D6. Ensemble learning and model fusion

[1189] D6.1. Building RWNN Ensemble

[1190] D6.1.1. Training multiple RWNN models with different random weights

[1191] D6.1.2. Design ensemble strategies (such as majority voting or averaging)

[1192] D6.2. Anomaly Detector Fusion

[1193] D6.2.1. Combining RWNN ensemble results with traditional anomaly detection methods

[1194] D6.2.2. Design of weighted fusion mechanism

[1195] D7. System implementation and deployment

[1196] D7.1. Real-time data processing module

[1197] D7.1.1. Realize real-time data interface with biochemical analyzer

[1198] D7.1.2. Design real-time data preprocessing and feature extraction process

[1199] D7.2. Outlier Detection Module

[1200] D7.2.1. Integrated optimized RWNN model and fusion strategy

[1201] D7.2.2. Implementing real-time outlier detection function

[1202] D7.3. Result display and alarm system

[1203] D7.3.1. Design an intuitive visual interface to display detection results and suspicious data points

[1204] D7.3.2. Implement a multi-level outlier alarm mechanism

[1205] D8. System verification and continuous optimization

[1206] D8.1. Laboratory validation

[1207] D8.1.1. System testing in a simulated environment

[1208] D8.1.2. Evaluate the accuracy, real-time performance, and robustness of the system

[1209] D8.2. Clinical trials

[1210] D8.2.1. Deployment of the system in a real clinical setting

[1211] D8.2.2. Collect clinical feedback and evaluate system effectiveness

[1212] D8.3. Continuous Optimization

[1213] D8.3.1. Regularly update models and optimize parameters using new data

[1214] D8.3.2. Adjust detection thresholds and alarm strategies based on clinical feedback

[1215] D8.3.3. Explore incremental learning techniques to enable models to adapt to new anomaly patterns

[1216] These steps describe in detail how to use a neural network with random weights and learning biases for outlier identification and detection of biochemical reaction curves, and optimize it with a modified CMAES multimodal optimization algorithm. This approach combines the fast training and good generalization capabilities of random weight neural networks with advanced optimization techniques to effectively improve the accuracy and robustness of outlier detection while being able to adapt to multimodal problem spaces.

[1217] S5: Based on the analysis results of the artificial intelligence model, trigger the corresponding alarm mechanism

[1218] This step aims to convert the analysis results of the artificial intelligence model into practical and actionable alerts to ensure that abnormal situations in the biochemical reaction process are discovered and handled in a timely manner.

[1219] S5.1: Set multiple alarm levels to correspond to different degrees of abnormal situations

[1220] Example of alarm level setting:

[1221] 1. Low-level alert (Level 1):

[1222] Abnormal probability: 0.50 0.70

[1223] Situation: Slight deviation from the normal range, requiring attention but not urgent, such as: reaction rate slightly lower than expected, or slight baseline drift 2. Intermediate alarm (Level 2):

[1224] Abnormal probability: 0.70 0.85

[1225] Situation: obvious abnormality, need to be dealt with in time, for example: the reaction does not reach the expected plateau period, or obvious noise abnormality occurs 3. Advanced alarm (Level 3):

[1226] Abnormal probability: 0.85 0.95

[1227] Situation: Severe abnormality, requiring immediate treatment, such as: significant abnormality in reaction rate, or unexpected multiple inflection points 4. Emergency Alert (Level 4):

[1228] Abnormal probability: >0.95

[1229] Situation: Extremely abnormal, which may lead to experiment failure or equipment damage, such as data interruption, or the reaction curve presents a completely abnormal shape. S5.2: Trigger an alarm of the corresponding level according to the degree of abnormality

[1230] Trigger logic example:

[1231] 1. Low-level alert (Level 1):

[1232] Display a yellow warning icon on the system interface

[1233] Record warning information to the log file

[1234] Send low priority notifications to the laboratory management system

[1235] 2. Intermediate Alert (Level 2):

[1236] An orange warning icon is displayed on the system interface and a prompt window is popped up to send a text message notification to the experiment operator

[1237] Create a medium priority incident in the lab management system

[1238] 3. High Alert (Level 3):

[1239] Display a red warning icon on the system interface, pop up a prompt window and play an alarm sound Send SMS and email notifications to experimental operators and laboratory supervisors Create a high-priority event in the laboratory management system

[1240] Start automatic protection procedures, such as pausing sample delivery

[1241] 4. Emergency Alert (Level 4):

[1242] Display a red warning on the system interface and play a continuous alarm. Send emergency text messages and emails to all relevant personnel (including technical support teams). Create a top priority event in the laboratory management system. Automatically execute emergency protection measures, such as stopping the experimental process and protecting key equipment.

[1243] S5.3: Alarm signals are sent out in a variety of ways, including system prompts, SMS notifications, and email alerts

[1244] Specific solutions to realize multiple alarm modes:

[1245] 1. System prompts:

[1246] Designing the alarm display area in the experimental control software interface

[1247] Use different colors and icons to visually display alert levels

[1248] Implement pop-up window function to display detailed exception information and suggested actions

[1249] Integrated sound alarm system, plays different alarm tones according to the alarm level

[1250] 2. SMS notification:

[1251] Integrate SMS sending API (such as Twilio or local telecom service provider's API)

[1252] Maintain a contact database containing contact information for people in different roles

[1253] Select the notification object according to the alarm level, for example, level 1 alarm only notifies the operator, and level 4 alarm notifies all relevant personnel

[1254] Design concise SMS templates that include key information such as alert level, exception type, timestamp and brief description

[1255] 3. Email Alerts:

[1256] Use SMTP protocol or email sending service (such as SendGrid) to implement email sending function

[1257] Design detailed email templates, including:

[1258] Alert levels and urgency

[1259] Detailed exception description

[1260] Response curve diagram (if possible)

[1261] Recommended treatment steps

[1262] Relevant contact information

[1263] Implement email tracking function to ensure that critical alert emails are read in time

[1264] 4. Laboratory management system integration:

[1265] Develop API interface with laboratory management system

[1266] Automatically create and update exception event records

[1267] Track alert processing status to ensure each alert is handled appropriately

[1268] 5. Mobile application push:

[1269] Develop supporting mobile applications to support real-time push notifications

[1270] Realize alarm confirmation and simple feedback functions to facilitate remote and rapid response

[1271] 6. Automated response system:

[1272] Automate responses to high-level and critical alerts

[1273] For example, automatically adjust experimental parameters, pause sample injection, or safely shut down the device in extreme situations

[1274] 7. Alarm escalation mechanism:

[1275] If a low-level alarm is not handled within a certain period of time, the alarm level will be automatically upgraded

[1276] Implement an alarm confirmation and handling tracking system to ensure that all alarms receive timely attention

[1277] This multi-level, multi-channel alarm mechanism can ensure that abnormal situations can be discovered and handled in a timely manner, minimize the risk of experimental failure and equipment damage, and improve the reliability and efficiency of the entire biochemical analysis process.

[1278] Embodiment 2

[1279] like Figure 3 As shown, the embodiment of the present application also provides a biochemical reaction curve anomaly detection system 30 based on artificial intelligence, including:

[1280] A data acquisition module 31 is used to obtain biochemical reaction curve data;

[1281] A data preprocessing module 32, used for preprocessing the biochemical reaction curve data;

[1282] The artificial intelligence analysis module 33 is used to analyze the pre-processed data using an artificial intelligence model and identify abnormal reaction curves;

[1283] The alarm module 34 is used to trigger a corresponding alarm mechanism based on the analysis results of the artificial intelligence model.

[1284] Embodiment 3

[1285] The present application also provides a computer device, such as Figure 4 As shown, the computer device comprises:

[1286] at least one processor; and,

[1287] a memory communicatively connected to the at least one processor; wherein,

[1288] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned biochemical reaction curve anomaly detection method based on artificial intelligence.

[1289] An embodiment of the present application also provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute the above-mentioned biochemical reaction curve anomaly detection method based on artificial intelligence.

[1290] An embodiment of the present application also provides a computer program product, including computer instructions, characterized in that when the computer instructions are executed by a processor, the steps of the above-mentioned biochemical reaction curve anomaly detection method based on artificial intelligence are implemented.

[1291] Each module in the above-mentioned artificial intelligence-based biochemical reaction curve anomaly detection system can be implemented in whole or in part by software, hardware, and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[1292] In one embodiment, a computer device is also provided. The computer device is the artificial intelligence-based biochemical reaction curve anomaly detection system mentioned in the above method embodiment. Its internal structure diagram can be as follows: Figure 4 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface.

[1293] Among them, the processor of the computer device is used to provide computing and control capabilities, and can be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto. The processor may include one or more processors, for example, one or more central processing units (CPUs). When the processor is a CPU, the CPU may be a single-core CPU or a multi-core CPU. The processor may also include one or more special-purpose processors, and the special-purpose processor may include a GPU, an FPGA, etc., for accelerated processing. The processor is used to call the program code and data in the memory and execute the steps in the above method embodiment. For details, please refer to the description in the method embodiment, which will not be repeated here.

[1294] The memory of the computer device includes, but is not limited to, non-volatile storage media and internal memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium.

[1295] The input / output interface of the computer device is used to exchange information between the processor and external devices.

[1296] The communication interface of the computer device is used to communicate with an external terminal via a network connection.

[1297] When the computer program is executed by a processor, a method for seafloor geological imaging is implemented.

[1298] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the division of each unit / module is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The mutual coupling, direct coupling, or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.

[1299] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[1300] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable systems. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media integrations. The available medium may be a read-only memory (ROM), or a random access memory (RAM), or a magnetic medium, such as a floppy disk, a hard disk, a tape, a disk, or an optical medium, such as a digital versatile disc (DVD), or a semiconductor medium, such as a solid state disk (SSD), etc.

[1301] The system of the embodiments of the present disclosure can execute the method provided by the embodiments of the present disclosure, and the implementation principles are similar. The actions performed by each module in the system of each embodiment of the present disclosure correspond to the steps in the method of each embodiment of the present disclosure. For the detailed functional description of each module of the system, please refer to the description in the corresponding method shown in the previous text, which will not be repeated here.

[1302] The above is only an optional implementation method for some implementation scenarios of the present disclosure. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the scheme of the present disclosure, other similar implementation methods based on the technical ideas of the present disclosure are also within the protection scope of the embodiments of the present disclosure.

Claims

1. A biochemical reaction curve anomaly detection method based on artificial intelligence, characterized in that: The following steps are involved: Obtain biochemical reaction curve data; Preprocessing the biochemical reaction curve data to obtain preprocessed data; Analyzing the preprocessed data using an artificial intelligence model to identify abnormal reaction curves; Based on the analysis results of the artificial intelligence model, a corresponding alarm mechanism is triggered.

2. The method according to claim 1, characterized in that The obtaining of biochemical reaction curve data comprises: Collect reaction curve data in real time from the biochemical analyzer; Extract stored reaction curve data from the historical database.

3. The method according to claim 2, characterized in that The preprocessing of the biochemical reaction curve data includes: Remove noise and outliers; Normalizing the biochemical reaction curve data; The normalized biochemical reaction curve data are subjected to data enhancement processing, including superimposing random noise that obeys Gaussian distribution on the biochemical reaction curve data, or performing nonlinear transformation on the time axis to simulate the change of reaction speed.

4. The method according to claim 1, characterized in that: Before analyzing the preprocessed data using the artificial intelligence model, the method further includes: Extract time series features, including slope and curvature; Extract frequency domain features, including main frequency and energy distribution; Calculate relevant biochemical indicators, including reaction rate and substrate concentration.

5. The method according to claim 2, characterized in that: The artificial intelligence model is a spiking neural network (SNN), and the method further comprises: Construct a multi-layer SNN network structure, including input layer, hidden layer and output layer; Training the SNN using a training data set; Performing compression and concealment on the SNN; Updating parameters of the SNN; The step of performing compression and concealment on the SNN includes: Adding an autoencoder structure to the hidden layer; Design a bottleneck layer to force the SNN to learn compressed representations by reducing the number of neurons; Use sparse constraints to limit the number of activated neurons and reduce the network parameters of the SNN; Applying pruning technology to remove connections in the SNN with weights less than the weight threshold by setting a weight threshold; Wherein, updating the parameters of the SNN includes: Design a scalable network structure to support the addition of new categories; Implement dynamic weight adjustment mechanism; Use knowledge distillation technology to transfer the knowledge of the trained SNN teacher model to the newly trained SNN student model; A sample buffer is maintained to store representative samples of the response curve data.

6. The method according to claim 1, characterized in that The artificial intelligence model is a long short-term memory network (LSTM), and the method further includes: Construct the LSTM network structure, including the input layer, LSTM layer and output layer; Training the LSTM using a training data set; The first parameter adjustment of the LSTM is performed using the standard Monte Carlo method; Using the quasi-Monte Carlo method to adjust the parameters of the LSTM for the second time; The first parameter adjustment of the LSTM is performed using the standard Monte Carlo method, including: Define the parameter search space, including learning rate, number of LSTM units, and number of layers; generating a plurality of parameter combinations from the parameter search space based on a random sampling function; Based on the evaluation function, calculating the performance index of each group of parameters in the plurality of parameter combinations; Iterate optimization and select the first parameter combination with the best performance; The LSTM is adjusted for the second time using the quasi-Monte Carlo method, including: Select low-discrepancy sequences, including Sobol or Halton sequences; generating low-discrepancy points using a sampling function based on the low-discrepancy sequence; Mapping the generated low-difference point to the first parameter combination to generate a second parameter combination; The mapped second parameter combination is evaluated.

7. The method according to claim 1, characterized in that The artificial intelligence model is a one-dimensional convolutional neural network 1DCNN, and the method further includes: Construct a 1DCNN network structure, including convolutional layers, pooling layers, and fully connected layers; Optimizing the hyperparameters of the 1DCNN using a hybrid meta-heuristic algorithm; Using a training data set to train the 1DCNN, and using a machine learning model to assist in optimizing the training process of the 1DCNN; Among them, a hybrid meta-heuristic algorithm is used to optimize the hyperparameters of 1DCNN, including: Construct genetic algorithm GA, particle swarm optimization PSO and simulated annealing SA algorithm; Design the switching conditions and information exchange mechanism of the above algorithm; Define the hyperparameter search space, including convolution kernel size, number of layers, and learning rate; Generate and evaluate hyperparameter combinations using a hybrid strategy; Among them, the machine learning model is used to assist in optimizing the training process of 1DCNN, including: Build a Gaussian process regression GPR or random forest RF regression model; Use the Gaussian process regression GPR or random forest RF regression model to predict the performance of un-evaluated hyperparameter combinations; guiding the search direction of the hybrid metaheuristic algorithm based on the prediction results; Dynamically adjust search strategies to balance exploration and exploitation.

8. The method according to claim 1, characterized in that The artificial intelligence model is a neural network with random weights and learning biases, and the method further includes: Construct a random weight neural network structure, including an input layer, a random weight hidden layer, and a learnable bias output layer; Design and optimize learning biases, including initializing bias values ​​and updating strategies; The improved covariance matrix adaptive evolution strategy CMAES multimodal optimization algorithm is used to optimize network parameters, including: Build the CMAES framework; Integrate the distance-based niche method to maintain multiple excellent solutions; Design a niche radius adaptive adjustment mechanism; Implement step size adaptive adjustment strategy; Design mechanisms to maintain population diversity.

9. The method according to claim 1, characterized in that: The analysis results based on the artificial intelligence model trigger the corresponding alarm mechanism including: Set multiple alarm levels to correspond to different degrees of abnormal situations; Trigger an alarm of corresponding level according to the degree of abnormality; Alarm signals are sent out in a variety of ways, including system prompts, SMS notifications, and email alerts.

10. A biochemical reaction curve anomaly detection system based on artificial intelligence, characterized in that: include: A data acquisition module, used to obtain biochemical reaction curve data; A data preprocessing module, used for preprocessing the biochemical reaction curve data; The artificial intelligence analysis module is used to analyze the pre-processed data using the artificial intelligence model and identify abnormal reaction curves; The alarm module is used to trigger a corresponding alarm mechanism based on the analysis results of the artificial intelligence model.

Citation Information

Patent Citations

  • Method and apparatus for treating abnormity of reaction curve, biochemical analyzer and storage medium

    CN107703132A

  • Tissue optical parameter extraction method and system based on long short-term memory network

    CN114997208A

  • Petrochemical production informatization system intelligent operation and maintenance method and system

    CN116823175A

  • Abnormality detection method for fine chemical production process

    CN117113250A