Cloud psychological problem prediction method based on large model

By improving the loss function of the psychological problem prediction model and adding weight coefficients to deal with the data imbalance problem, the problem of poor training results of existing models in data imbalance is solved, and higher accuracy and generalization ability are achieved.

CN119993397APending Publication Date: 2025-05-13WUXI URBAN BLOCKCHAIN ADVANCED RES CENT +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411827838.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

When the existing psychological problem prediction model deals with the problem of uneven data distribution, the training effect is poor, and the accuracy and generalization ability are insufficient.

Method used

The cloud psychological problem prediction method based on large models is adopted. By improving the loss function in the prediction model, the weight coefficient is added to reduce the impact of positive samples with a predicted value greater than 0.5 on the loss, and the impact of positive samples with a predicted value less than 0.5 on the loss.

Benefits of technology

It effectively reduces the negative impact of data imbalance on training effect and improves the accuracy and generalization ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119993397A_ABST
    Figure CN119993397A_ABST
Patent Text Reader

Abstract

The invention relates to an on-cloud psychological problem prediction method based on a large model. The method comprises the following steps: S1, obtaining psychological problem training data, performing data enhancement on the training data, clustering the enhanced training data, and scoring the clustered training data to obtain scored label data; s2, sampling the label data for multiple times to form a plurality of different sub-data sets; s3, training the sub-data set corresponding to the input of each neural network, calculating a loss function for increasing a weight coefficient based on the output of the neural network, and optimizing the parameters of the neural network based on the loss function; and S4, combining the prediction sub-models to obtain a final psychological problem prediction model, deploying the psychological problem prediction model in a cloud end, obtaining actual psychological dialogue data by the psychological problem prediction model, and outputting a psychological problem prediction result. Compared with the prior art, the method has the advantages that the training effect of the model on unbalanced data is improved, and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of psychological problem prediction, and in particular to a cloud-based psychological problem prediction method based on a large model. Background Art

[0002] As young students are increasingly immersed in the vast ocean of information on the Internet, Internet addiction has become a psychological problem that has attracted much attention. As the main force of Internet users, young students are exposed to rich and diverse online information, which not only shapes their outlook on life, values ​​and ways of thinking, but also has a potential impact on their mental health. In this Internet environment, many students face problems such as improper information management, inability to correctly distinguish information quality, and online information overload, which may lead to the development of addictive behavior.

[0003] Internet addiction and online psychological counseling are one of the hot topics in the current field of psychology. With the popularization of the Internet and the development of technology, people's attention to Internet addiction has gradually increased. In response to this problem, researchers have begun to explore online psychological counseling as a solution. With the rise of online counseling platforms and the continuous improvement of online communication technology, online psychological counseling has gradually gained attention as a convenient and flexible form of counseling. By converting traditional psychological counseling methods into online forms, the needs of young students and other Internet users can be met. Previous studies have found that online counseling platforms can provide young students with more convenient and flexible mental health support and reduce the harmful effects of excessive use of the Internet.

[0004] At present, with the development of medical technology and artificial intelligence, corresponding technologies for diagnosing adolescent depression have been developed and improved, including data analysis and pattern recognition, bio-indicators and sensor technology, natural language processing and speech analysis, as well as applications and online tools.

[0005] At present, the systems that realize the diagnosis function of adolescent depression are generally based on machine learning or deep learning models. Through various internal or external physical data, such as gender, age, hormone levels, or facial expressions, voice and body movements, the model is trained to perform depression classification prediction. In dealing with the problem of uneven data distribution, traditional methods generally delete some samples; in traditional risk prediction research, traditional machine learning methods are mostly used. However, traditional methods cannot solve the problem of uneven data distribution well, which affects the accuracy and generalization ability of the model. Summary of the invention

[0006] The purpose of the present invention is to reduce the poor training effect, insufficient accuracy and generalization ability caused by data imbalance during the training of the psychological problem prediction model, and to provide a cloud-based psychological problem prediction method based on a large model, by improving the loss function in the prediction model. Adding a weight coefficient to the loss function reduces the impact of positive samples with a predicted value greater than 0.5 on the loss, and increases the impact of positive samples with a predicted value p less than 0.5 on the loss, so that better training effects can still be obtained for training data with unbalanced data, ensuring accuracy and generalization ability.

[0007] The purpose of the present invention can be achieved by the following technical solutions:

[0008] A cloud-based psychological problem prediction method based on a large model, the method comprising the following steps:

[0009] S1. Obtain psychological problem training data, wherein the training data is divided into positive samples and negative samples, perform data enhancement on the training data, cluster the enhanced training data, score the clustered training data and extract data based on the scores to obtain scored label data, wherein the enhanced training data includes original data and generated data, wherein the original data is psychological problem training data, and the generated data is data generated during the data enhancement process;

[0010] S2, sampling the labeled data multiple times based on the scores of the labeled data to form multiple different sub-datasets, and constructing a corresponding neural network for each sub-dataset;

[0011] S3, training the sub-dataset corresponding to each neural network input, calculating a loss function with an increased weight coefficient based on the output of the neural network, optimizing the parameters of the neural network based on the loss function, and obtaining a prediction sub-model;

[0012] S4. Combine the various prediction sub-models to obtain the final psychological problem prediction model, deploy the psychological problem prediction model in the cloud, and the psychological problem prediction model obtains the actual psychological dialogue data and outputs the psychological problem prediction results.

[0013] Furthermore, the loss function of increasing the weight coefficient is:

[0014]

[0015] Among them, p t The focal probability weight in Focal Loss is similar to that in Focal Loss. Assume that the probability of the model predicting a positive sample is p. If the sample is a positive sample, then p t =p, otherwise p t =1-p,α t Represents the weight coefficient, n trepresents the amount of data of the target class in this extraction, n represents the total sample size in this data extraction, L(y t ,p) represents the binary cross entropy loss function, γ1 and γ2 are scaling coefficients.

[0016] Furthermore, the weight coefficient is specifically:

[0017]

[0018] Among them, it is assumed that the positive sample is a minority sample, n p is the number of positive samples, n n is the number of negative samples.

[0019] Furthermore, the specific steps of scoring the clustered training data to obtain the scored label data are:

[0020] Score each piece of data in each class in the clustered training data. For the positive samples and negative samples in the original data, set the positive sample score and negative sample score respectively. For the generated data, set the generated data score to obtain the scored label data.

[0021] Furthermore, the positive sample score is:

[0022]

[0023] Among them, n k It represents the number of data entries with the same or similar features as the label. Similarity classes are determined by the high-dimensional KNN algorithm. Samples of the same or similar classes share the same score. θ1 represents the first hyperparameter.

[0024] Furthermore, the negative sample score is:

[0025]

[0026] Among them, n p Represents the number of positive samples, n n represents the number of negative samples, and θ2 represents the second hyperparameter.

[0027] Furthermore, the generated data score is:

[0028]

[0029] Among them, n gen represents the number of generated data, θ gen is the artificial coefficient, n p Represents the number of positive samples.

[0030] Furthermore, the specific steps of performing data enhancement on the training data are:

[0031] The original data is enhanced to obtain generated data, labels are set for the original data and the generated data respectively, the labels indicate whether they are original data, and the original data and the generated data are used together as enhanced training data.

[0032] Furthermore, the clustering method adopted is the HDBSCAN high-dimensional clustering algorithm.

[0033] Furthermore, the neural network is constructed based on the AutoML mechanism.

[0034] Compared with the prior art, the present invention has the following beneficial effects:

[0035] The present invention improves the loss function in the prediction model. A weight coefficient is added to the loss function to reduce the influence of positive samples with predicted values ​​greater than 0.5 on the loss, and to increase the influence of positive samples with predicted values ​​less than 0.5 on the loss, thereby still obtaining a better training effect for training data with unbalanced data, and ensuring the accuracy and generalization ability of the module. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 A workflow diagram of a module corresponding to the method of the present invention;

[0037] Figure 2 A schematic diagram of the interaction mode between the large language model and the psychological problem prediction model of the present invention and the user;

[0038] Figure 3 A flowchart for model training of the present invention;

[0039] Figure 4 It is a schematic diagram of the effect of LLM realizing the present invention. DETAILED DESCRIPTION

[0040] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.

[0041] Aiming at the shortcomings of the existing adolescent depression diagnosis system, the present invention proposes a cloud-based psychological problem prediction method based on a large model. The flowchart of the method is as follows: Figure 1As shown. The method of the present invention adopts the SMOTE algorithm to perform data enhancement for a small number of samples, and uses the improved HDBSCAN algorithm to calculate the importance of the data, and scores and annotates each sample (including the original sample and the generated sample), and forms a database with data importance scores to solve the problem of uneven data distribution. Inspired by the AutoML automatic machine learning algorithm, a basic automatic machine learning algorithm is established for sampling combination prediction, which enhances the performance and balance of the diagnostic model. In addition, the present invention provides a solution based on a large language model and cloud services, which uses the generative dialogue interaction function provided by the large language model and the cloud service architecture deployment to reduce the user client usage cost, so that the diagnostic system can provide assistance for the prevention and treatment of depression in a large number of teenagers; at the same time, the cloud service architecture enables the system to better manage data from various sources. The method of the present invention comprises the following steps:

[0042] S1. Obtain psychological problem training data, wherein the training data is divided into positive samples and negative samples, perform data enhancement on the training data, cluster the enhanced training data, score the clustered training data, and obtain scored label data, wherein the enhanced training data includes original data and generated data, wherein the original data is psychological problem training data, and the generated data is data generated during the data enhancement process;

[0043] S2, sampling the labeled data multiple times based on the scores of the labeled data to form multiple different sub-datasets, and constructing a corresponding neural network for each sub-dataset;

[0044] S3, training the sub-dataset corresponding to each neural network input, calculating a loss function with an increased weight coefficient based on the output of the neural network, optimizing the parameters of the neural network based on the loss function, and obtaining a prediction sub-model;

[0045] S4. Combine the various prediction sub-models to obtain the final psychological problem prediction model, deploy the psychological problem prediction model in the cloud, and the psychological problem prediction model obtains the actual psychological dialogue data and outputs the psychological problem prediction results.

[0046] After the psychological problem prediction model is deployed on the cloud, a module corresponding to the steps of the present invention is formed. The workflow diagram of the module corresponding to the method is as follows: Figure 1As shown. The consultation information input module is used to obtain the actual psychological dialogue data, the data formatting module pre-processes the actual data obtained, and then inputs the prediction model module with a prediction model, and then determines whether the prediction model has been established. If it has been established, the prediction result is output according to the result output module. If not, the prediction model is established by using the methods of S1 to S4. The present invention uses the cloud architecture mode of services, and the data enhancement algorithm and automatic classification algorithm proposed by the present invention are supported at the bottom of the architecture. They provide update services for the online model in the cloud. At the same time, the algorithm designed by the present invention ensures that the model can be learned online and dynamically adjusted according to the latest data to achieve the best judgment effect. Considering the privacy of medical data, we added an encryption algorithm between the client and the cloud model to ensure the security of the data. First, the adolescents are consulted through the cloud-based large model; then the large model structures the information and inputs it into the prediction model to obtain the diagnosis result; in terms of the establishment of the prediction model, the improved HDBSCAN algorithm is used to solve the problem of uneven data distribution, and the improved AutoML algorithm is used for sampling combination prediction; finally, the large model provides depression prevention and treatment suggestions based on the diagnosis results. In addition, the client and database are connected to the cloud model to provide updates for the cloud model and use encryption algorithms to ensure data security.

[0047] When conducting psychological question inquiries based on the present invention, the present invention proposes a multi-round question-answering interaction mode based on a large model, such as Figure 2 As shown. LangChain is used to give the model the ability to call tools, conduct multi-round conversations, and learn through prompts. The specific process is as follows:

[0048] 1) The large model asks the patient multiple rounds of questions based on the prompt word template to collect the information needed for diagnosis.

[0049] 2) The large model collects the patient's responses and determines whether the responses contain the required information.

[0050] 3) According to the prompt word instruction, the large model converts the patient's answer into a standard format, such as:

[0051] "Age of the patient: 16 years old\n"

[0052] 4) Use string matching to extract the required information and convert it into structured data.

[0053] 5) Input structured data into the diagnostic model for prediction.

[0054] 6) The prediction results are returned to the big model, and the big model provides targeted suggestions to the patient based on the results.

[0055] The prediction problem of the present invention can actually be abstracted as a high-dimensional data classification problem. Therefore, there is a serious imbalance in the training data. The present invention proposes to use data with item scores and a data extraction algorithm, that is, while using the SMOTE method for data enhancement, labels are added to these generated data, and data similarity scores are performed. Data extraction is controlled by labels and scores to generate different training data sets for model learning.

[0056] In addition, in order to meet the function of online learning, that is, the structure and parameters of the model can be adaptively adjusted according to different input data, we introduced the AutoML thinking mechanism to establish an automated prediction model, and referred to the Boosting and Rainbow methods: the scored label data is sampled multiple times to form different data sets. We input different data sets into the automated prediction model algorithm to generate multiple models, and then combine the multiple models according to the weights into a comprehensive model predictor to predict the results. At the same time, in order to improve the convergence of the model and save training time, a new loss function that adapts to the model of data imbalance is designed with reference to the cross entropy of the binary classification. The workflow of the prediction model training is as shown in the figure below. Figure 3 shown.

[0057] After formatting and cleaning, basic model data such as census data are divided into positive samples and negative samples, and processed by the SMOTE method and ENN method respectively. After processing, the positive and negative samples are scored using the data entry importance algorithm. Data samples with large discreteness and derived from real data rather than generated data will obtain higher scores.

[0058] In the present invention, the specific steps of performing data enhancement on the training data, clustering the enhanced training data, and scoring the clustered training data to obtain the scored label data are:

[0059] Score each piece of data in each class in the clustered training data. For the positive samples and negative samples in the original data, set the positive sample score and negative sample score respectively. For the generated data, set the generated data score to obtain the scored label data. Specifically:

[0060] Generate labels for whether it is original data and assign values ​​0 and 1 respectively.

[0061] The original data is scored in the range of [0,1], and the larger the value, the higher the importance. Through experiments, it is recommended to take the hyperparameter range θ1∈[0.6,0.8], θ2=1, and the specific formula is as follows:

[0062] Positive Sample

[0063] Negative samples

[0064] In the above formula, n k Represents the number of data entries of similar classes.

[0065] Manually given coefficient θ gen (Based on the experiment, it is generally set to [0.1, 0.2]), and the importance of the generated data is calculated according to this formula:

[0066]

[0067] where n p is the number of positive samples.

[0068] Based on the idea of ​​DBSCAN method, the HDBSCAN clustering method is adopted for the high-dimensional characteristics of the data, and the maximum and minimum cluster number constraints are added, that is, the minimum cluster number is set to min_samples, and the maximum is set to max_samples. After clustering through the improved high-dimensional clustering algorithm, the scores are given according to the number of each category. The smaller the number of samples in the category cluster, the higher the importance score.

[0069] The specific steps of S2 to S4 are:

[0070] The scored labeled data is sampled multiple times to form different sub-datasets for sub-model training.

[0071] Take one of the data sets and introduce the AutoML mechanism to build an automated prediction model.

[0072] To set the loss function for the model, first define the cross entropy loss:

[0073]

[0074] Add a weight coefficient α=1-p to the loss function to reduce the impact of positive samples with predicted values ​​p greater than 0.5 on the loss, and increase the impact of positive samples with predicted values ​​p less than 0.5 on the loss, and get Focal Loss generalized to multi-classification:

[0075] FL(p t )=-α t (1-p t ) γ log(p t )

[0076] Expand the loss function and add a data volume weight. The formula is:

[0077]

[0078] Among them, p tThe focal probability weight in Focal Loss is similar to that in Focal Loss. Assume that the probability of the model predicting a positive sample is p. If the sample is a positive sample, then p t =p, otherwise p t =1-p,α t Represents the weight coefficient, n t represents the amount of data of the target class in this extraction, n represents the total sample size in this data extraction, L(y t ,p) represents the binary cross entropy loss function, γ1 and γ2 are scaling coefficients used to adapt to data sets with different dimensional difficulties. For example, when the dependent variable dimension of all samples is low, γ1 and γ2 use non-negative integers less than or equal to 2, otherwise use integers greater than or equal to 2. Repeat the above steps, combine the above different inference models to form the final inferencer, and adjust the adaptive threshold of the prediction results through the Softmax algorithm to output the final classification results, avoiding systematic deviations caused by a single data source / training model.

[0079] Implement the above steps based on the large model tool chain:

[0080] 1. Introduce the Langchain large model tool chain package, encapsulate Huatuo GPT as an inheritance of the LLM class, and rewrite the method _call so that both the input and output are in natural language form.

[0081] 2. Encapsulate the classification model into a tool class and specify the name, func, and description attributes, which are the name of the classifier, the implementation function, and the description of the classifier, respectively.

[0082] 3. Define the agent object and specify the LLM and tool.

[0083] 4. Use the prompt word template to format the action input provided when LLM calls the tool, and use string matching or regular expression operations to extract the input of the classification model

[0084] 5. Use the pre-set Transformer word segmenter and word vector template to match the input content. When the similarity of the matching word vector is greater than the threshold, it is considered that the main question has been answered. When the answer content meets the pre-set threshold ratio of the required matching data, the LLM model can use the data to call the judgment model, use the judgment model result as the prompt word input, and output the result in a conversational manner after processing.

[0085] 6. Use the prompt word template to guide LLM to output targeted suggestions based on the results of the classification model.

[0086] The key points of the present invention are:

[0087] Cloud applications that use a combination of pre-trained large models and domain expert models:

[0088] Introduction of big models: Using pre-trained big models for consultation and interactive dialogue can provide a deeper understanding of the patient's condition and provide more personalized diagnosis and suggestions. It is conducive to the use and operation of the general audience.

[0089] Data processing and automated classification algorithms:

[0090] Data scoring is completed based on HDBSCAN high-dimensional algorithm clustering: In order to retain the richness of the original data and solve the problem of severe data imbalance, it is proposed to use data with item scoring and data extraction algorithms. Each piece of data is scored, and the score is used as the importance of the item data. According to the importance, a sub-dataset is extracted as data for machine learning model training.

[0091] Sampling combination prediction method based on AutoML: The AutoML mechanism is introduced to complete the establishment of automatic prediction models for big data. At the same time, the design of the LOSS function is improved, which significantly improves the balance of calculations on samples.

[0092] Data processing flow and adaptive model adjustment:

[0093] Multi-stage processing flow: including large model query, information extraction, data conversion and structuring, prediction model input and other stages, so that the data is processed multiple times for use in the prediction model, which may increase the accuracy and robustness of the model.

[0094] Online learning and adaptive adjustment: The AutoML mechanism is introduced to realize the adaptive adjustment of the model, and the model structure is dynamically adjusted according to the input data. This online learning method can make the model more adaptable and flexible.

[0095] Highly Imbalanced Data Enhancement and Automated Prediction Model Building:

[0096] Data enhancement strategy: Use the SMOTE method for data enhancement, and label and similarity score the generated data to control data extraction. This strategy can provide richer samples for model training.

[0097] Automated prediction model: Introducing AutoML and multiple sampling strategies to generate multiple models and combine them into a comprehensive prediction model for prediction. This approach can improve model diversity and prediction accuracy.

[0098] The schematic diagram of the effect of LLM realizing the present invention is as follows Figure 4 shown.

[0099] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.

Claims

1. A cloud-based psychological problem prediction method based on a large model, characterized in that: The method comprises the following steps: S1. Obtain psychological problem training data, wherein the training data is divided into positive samples and negative samples, perform data enhancement on the training data, cluster the enhanced training data, score the clustered training data and extract data based on the scores to obtain scored label data, wherein the enhanced training data includes original data and generated data, wherein the original data is psychological problem training data, and the generated data is data generated during the data enhancement process; S2, sampling the labeled data multiple times based on the scores of the labeled data to form multiple different sub-datasets, and constructing a corresponding neural network for each sub-dataset; S3, training the sub-dataset corresponding to each neural network input, calculating a loss function with an increased weight coefficient based on the output of the neural network, optimizing the parameters of the neural network based on the loss function, and obtaining a prediction sub-model; S4. Combine each prediction sub-model to obtain the final psychological problem prediction model, deploy the psychological problem prediction model in the cloud, and the psychological problem prediction model obtains the actual psychological dialogue data and outputs the psychological problem prediction results.

2. According to claim 1, a cloud-based psychological problem prediction method based on a large model is characterized in that: The loss function of increasing the weight coefficient is: Among them, p t The focal probability weight in Focal Loss is similar to that in Focal Loss. Assume that the probability of the model predicting a positive sample is p. If the sample is a positive sample, then p t =p, otherwise p t =1-p,α t Represents the weight coefficient, n t represents the amount of data of the target class in this extraction, n represents the total sample size in this data extraction, L(y t ,p) represents the binary cross entropy loss function, γ1 and γ2 are scaling coefficients.

3. According to claim 2, a cloud-based psychological problem prediction method based on a large model is characterized in that: The weight coefficient is specifically: Among them, it is assumed that the positive sample is a minority sample, n p is the number of positive samples, n n is the number of negative samples.

4. The cloud-based psychological problem prediction method based on a large model according to claim 1 is characterized in that: The specific steps of scoring the clustered training data to obtain the scored label data are as follows: Score each piece of data in each class in the clustered training data. For the positive samples and negative samples in the original data, set the positive sample score and negative sample score respectively. For the generated data, set the generated data score to obtain the scored label data.

5. The cloud-based psychological problem prediction method based on a large model according to claim 4 is characterized in that: The positive sample score is: Among them, n k It represents the number of data entries with the same or similar features as the label. Similarity classes are determined by the high-dimensional KNN algorithm. Samples of the same or similar classes share the same score. θ1 represents the first hyperparameter.

6. The cloud-based psychological problem prediction method based on a large model according to claim 5 is characterized in that: The negative sample score is: Among them, n p Represents the number of positive samples, n n represents the number of negative samples, and θ2 represents the second hyperparameter.

7. The cloud-based psychological problem prediction method based on a large model according to claim 6 is characterized in that: The generated data scores are: Among them, n gen represents the number of generated data, θ gen is the artificial coefficient, n p Represents the number of positive samples.

8. The cloud-based psychological problem prediction method based on a large model according to claim 1 is characterized in that: The specific steps of performing data enhancement on the training data are: The original data is enhanced to obtain generated data, labels are set for the original data and the generated data respectively, the labels indicate whether they are original data, and the original data and the generated data are used together as enhanced training data.

9. The cloud-based psychological problem prediction method based on a large model according to claim 1 is characterized in that: The clustering method used is the HDBSCAN high-dimensional clustering algorithm.

10. The cloud-based psychological problem prediction method based on a large model according to claim 1, characterized in that: The neural network is built based on the AutoML mechanism.