Machine learning-based bed type classification method and device, equipment and storage medium
Through machine learning methods, the unstructured bed type description text data of hotel suppliers is extracted and vectorized, and the bed type classification model is constructed, which solves the problem of inefficient bed type classification in the existing technology and realizes efficient bed type automated classification.
Patent Information
- Application Number
- CN202411811946.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-25
Smart Images

Figure CN119884375A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a bed type classification method, device, equipment and storage medium based on machine learning. Background Art
[0002] In the hotel business, when parsing bed type information data in the interface provided by hotel suppliers, traditional data parsing methods are usually used, relying on predefined rules to parse data, which can realize rule-based, centralized architecture and structured data processing.
[0003] However, bed type information usually exists in the form of unstructured data in different vendor systems, which is manifested in the diversity and complexity of text descriptions, which may include different bed type names.
[0004] Traditional data parsing methods have great limitations for unstructured data, such as bed type description text, and are unable to flexibly cope with diverse and complex text descriptions. Summary of the invention
[0005] The present application provides a bed type classification method, device, equipment and storage medium based on machine learning, which can improve the efficiency of bed type classification.
[0006] In a first aspect, the present application provides a bed type classification method based on machine learning, comprising: obtaining multiple historical bed type description text data, and historical bed type classification results corresponding to each of the multiple historical bed type description text data; performing keyword extraction on the multiple historical bed type description text data respectively to obtain bed type description keywords, and performing vectorization processing on the multiple historical bed type description text data to obtain bed type description keyword vectors of the bed type description keywords; generating model training data based on the bed type description keyword vectors and the historical bed type classification results, and performing model training processing based on the model training data to obtain a bed type classification model; obtaining the to-be-classified bed type description keyword vector of the to-be-classified bed type description text data, and inputting the to-be-classified bed type description keyword vector into the bed type classification model to obtain a bed type classification result.
[0007] In a possible implementation, after obtaining a plurality of historical bed type description text data, it further includes: performing data preprocessing on the plurality of historical bed type description text data respectively to obtain a plurality of corresponding preprocessed text data; wherein the data preprocessing includes data matching based on a preset target regular expression, and data cleaning; and updating the plurality of preprocessed text data to the plurality of historical bed type description text data.
[0008] In a possible implementation, data preprocessing is performed on the multiple historical bed type description text data respectively to obtain corresponding multiple preprocessed text data; wherein the data preprocessing includes data matching based on a preset target regular expression, and data cleaning, specifically including: setting a target regular expression, and matching processing is performed on the multiple historical bed type description text data based on the target regular expression; when it is detected that there is target text data matching the target regular expression in the multiple historical bed type description text data, the target text data is updated to target characters to obtain multiple updated historical bed type description text data; based on the target characters, the multiple updated historical bed type description text data is cleaned to obtain multiple preprocessed historical bed type description text data.
[0009] In a possible implementation, model training data is generated based on the bed type description keyword vector and the historical bed type classification results, specifically including: setting category labels for the bed type description keyword vector based on the historical bed type classification results to obtain bed type category labels corresponding to each bed type description keyword vector; and using each bed type description keyword vector and the bed type category labels corresponding to each bed type description keyword vector as model training data.
[0010] In a possible implementation, keyword extraction is performed on the multiple historical bed type description text data respectively to obtain bed type description keywords, which specifically includes: performing word segmentation processing on the multiple historical bed type description text data respectively to obtain word sets corresponding to the multiple historical bed type description text data; based on the word sets, keyword extraction is performed on each historical bed type description text data based on a preset keyword extraction algorithm to obtain the corresponding bed type description keywords.
[0011] In a possible implementation, the multiple historical bed type description text data are vectorized to obtain bed type description keyword vectors of the bed type description keywords, specifically including: constructing a vector construction model based on Word2vec technology, obtaining word sets corresponding to each of the multiple historical bed type description text data, inputting the word sets into the trained vector construction model respectively, and obtaining a multidimensional word vector corresponding to each word in the word set; and based on the multidimensional word vector corresponding to each word in the word set, obtaining the bed type description keyword vectors of the bed type description keywords corresponding to each of the multiple historical bed type description text data.
[0012] In a possible implementation, model training processing is performed based on the model training data to obtain a bed type classification model, specifically including: constructing an initial bed type classification model, and performing model training on the initial bed type classification model based on the model training data, so that the initial bed type classification model outputs a predicted bed type classification result; calculating the L1 norm between the predicted bed type classification result and the actual bed type classification result, and determining a loss function based on the L1 norm; and performing reverse iterative training on the initial bed type classification model based on the loss function to obtain a bed type classification model.
[0013] In a second aspect, the present application provides a bed type classification device based on machine learning, comprising: a historical data acquisition module, a feature data extraction module, a model training module and a bed type classification module; wherein the historical data acquisition module is used to acquire a plurality of historical bed type description text data, and the historical bed type classification results corresponding to each of the plurality of historical bed type description text data; the feature data extraction module is used to perform keyword extraction on the plurality of historical bed type description text data respectively to obtain bed type description keywords, and perform vectorization processing on the plurality of historical bed type description text data to obtain bed type description keyword vectors of the bed type description keywords; the model training module is used to generate model training data based on the bed type description keyword vectors and the historical bed type classification results, and perform model training processing based on the model training data to obtain a bed type classification model; the bed type classification module is used to acquire the to-be-classified bed type description keyword vectors of the to-be-classified bed type description text data, and input the to-be-classified bed type description keyword vectors into the bed type classification model to obtain the bed type classification results.
[0014] In a third aspect, an embodiment of the present application further provides a computer device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.
[0015] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program can implement the above method when executed by a processor.
[0016] The embodiments of the present application provide a bed type classification method, device, equipment and storage medium based on machine learning, which have the following advantages over the prior art:
[0017] A plurality of historical bed type description text data are obtained, and keyword extraction and vectorization processing are performed on the plurality of historical bed type description text data to convert the unstructured text data into a structured numerical form that can be used for analysis, thereby processing the diversity and complexity of the text description, and based on the bed type description keyword vector and the historical bed type classification results, model training data is generated, and model training processing is performed based on the model training data to obtain a bed type classification model; during the model training process, the bed type description keyword vector and the corresponding historical bed type classification results can help the model understand the relationship between different types of bed type text features and their categories. This training method allows the model to accurately classify new bed type description text data according to the rules learned during the training process; subsequently, by obtaining the to-be-classified bed type description keyword vector of the to-be-classified bed type description text data, and inputting the to-be-classified bed type description keyword vector into the bed type classification model, the model can quickly predict the bed type category and obtain the bed type classification result. This automated process significantly improves the efficiency of bed type classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0020] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0021] Figure 1 It is a flowchart of an embodiment of a bed type classification method based on machine learning provided by the present application;
[0022] Figure 2 It is a structural schematic diagram of an embodiment of a bed type classification device based on machine learning provided by the present application;
[0023] Figure 3 It is a structural schematic diagram of an electronic device provided by this application. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0025] The disclosure below provides many different embodiments or examples to implement the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0026] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0027] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0028] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0029] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0030] Example 1, see Figure 1 , Figure 1 is a flow chart of an embodiment of a bed type classification method based on machine learning provided by the present application, such as Figure 1As shown, the method includes steps 101 to 104, which are specifically as follows:
[0031] Step 101: Acquire a plurality of historical bed type description text data and historical bed type classification results corresponding to each of the plurality of historical bed type description text data.
[0032] In one embodiment, data preprocessing is performed on the multiple historical bed type description text data to obtain corresponding multiple preprocessed text data; wherein the data preprocessing includes data matching based on a preset target regular expression and data cleaning; and the multiple preprocessed text data are updated to the multiple historical bed type description text data.
[0033] In one embodiment, when data preprocessing is performed on the multiple historical bed type description text data respectively, a target regular expression is set, and based on the target regular expression, matching processing is performed on the multiple historical bed type description text data respectively; when it is detected that there is target text data matching the target regular expression in the multiple historical bed type description text data, the target text data is updated to target characters to obtain multiple updated historical bed type description text data; based on the target characters, data cleaning processing is performed on the multiple updated historical bed type description text data to obtain multiple preprocessed historical bed type description text data.
[0034] Specifically, in the classification problem, we focus on the correlation between features and target variables, namely, bed type categories; although bed width information is related to bed type, it is not the key feature to distinguish different bed types. Therefore, by removing this bed width information, the dimension of the feature space can be reduced and the efficiency and accuracy of model training can be improved.
[0035] Specifically, the target regular expression is determined by determining all possible texts describing the width of the bed. For example, the text describing the width of the bed may be 1.4 meters, 120cm*200cm, 1.2*1.8 meters, 200 centimeters, and 1.2m×1.8m, etc. Based on this, the target regular expression can be set as:
[0036] (?:\d+\.?\d*\s?(cm|m|meter))|(?:\d+\.?\d*\s*x\s*\d+\.?\d*\s?(cm|m|meter)); Among them, (?:\d+\.?\d*\s?(cm|m|meter)) is used to match the pattern of a number followed by a unit (centimeter, meter), and (?:\d+\.?\d*\s*x\s*\d+\.?\d*\s?(cm|m|meter)) is used to match the pattern of two numbers and an "x".
[0037] Specifically, a regular expression library in a programming language (such as Python, C#, etc.) is used to apply the target regular expression to multiple historical bed type description text data respectively. When it is detected that target text data matching the target regular expression exists in the multiple historical bed type description text data, the target text data of the matched width description is replaced based on the target character to obtain multiple updated historical bed type description text data corresponding to the multiple historical bed type description text data.
[0038] Preferably, the target character may be a space character or a specific character.
[0039] Specifically, after obtaining a plurality of updated historical bed type description text data, all target characters in the plurality of updated historical bed type description text data are traversed, and all traversed target characters are deleted to obtain a plurality of pre-processed historical bed type description text data.
[0040] Preferably, in addition to deleting all target characters in the multiple updated historical bed type description text data, further deleting special symbols, punctuation marks and stop words in the multiple updated historical bed type description text data may be performed.
[0041] In one embodiment, the historical bed type classification results include but are not limited to single beds, double beds, king-size beds, bunk beds, solid wood beds, leather beds, fabric beds, sofa beds, folding beds, wrought iron beds, and tatami beds.
[0042] Step 102: extract keywords from the plurality of historical bed type description text data respectively to obtain bed type description keywords, and perform vectorization processing on the plurality of historical bed type description text data to obtain bed type description keyword vectors of the bed type description keywords.
[0043] In one embodiment, word segmentation processing is performed on the multiple historical bed type description text data to obtain word sets corresponding to the multiple historical bed type description text data; based on the word sets, keyword extraction is performed on each historical bed type description text data based on a preset keyword extraction algorithm to obtain the corresponding bed type description keywords.
[0044] Specifically, based on the jieba library in python, word segmentation processing is performed on multiple historical bed type description text data to obtain word sets corresponding to each of the multiple historical bed type description text data, wherein the word sets corresponding to each of the multiple historical bed type description text data are composed of one or more phrases.
[0045] Specifically, based on the bed type classification type, a bed type classification set is set, and for each historical bed type description text data, a bed type is randomly extracted from the bed type classification set, and a target word is randomly extracted from the word set corresponding to each historical bed type description text data, and based on a preset keyword extraction algorithm, the intensity value corresponding to each target word in the word set corresponding to each historical bed type description text data is calculated, all intensity values corresponding to each historical bed type description text data are normalized to obtain a normalized intensity value corresponding to each intensity value, all normalized intensity values are sorted in descending order, and the first preset number of target words in the normalized intensity sorting are selected, and the preset number of target words selected are used as bed type description keywords corresponding to the historical bed type description text data.
[0046] Specifically, the keyword extraction algorithm is as follows:
[0047]
[0048] Where S(k) is the strength value of the target word k, k is a single target word in the word set corresponding to each historical bed type description text data, z is the total number of words in the word set corresponding to each historical bed type description text data, t is a bed type in the bed type classification set, f(t|k) is the probability distribution function of the target word k appearing under bed type t, f(t) is the probability distribution function of the bed type t appearing in the bed type classification set, T is the bed type classification set, and a, b, and c are constants.
[0049] In one embodiment, a vector construction model is constructed based on Word2vec technology, and word sets corresponding to each of the multiple historical bed type description text data are obtained. The word sets are respectively input into the trained vector construction model to obtain a multidimensional word vector corresponding to each word in the word set; and based on the multidimensional word vector corresponding to each word in the word set, a bed type description keyword vector of the bed type description keyword corresponding to each of the multiple historical bed type description text data is obtained.
[0050] Specifically, since Word2vec technology is a model based on deep learning, its core idea is to map words into a K-dimensional real feature space through training to form a multi-dimensional word vector; in essence, the vector construction model based on Word2vec technology can be regarded as a matrix decomposition model, which constructs a matrix by analyzing the relationship between words and their context, and extracts the vector representation of each word in the latent space by decomposing this matrix.
[0051] Specifically, the training process of the vector construction model is to perform data processing on each word in the word set corresponding to each historical bed type description text data, wherein the data processing includes removing stop words and counting word frequency results, and removing high-frequency words and low-frequency words based on the word frequency results; and constructing a Huffman tree, storing a parameter vector for all non-leaf nodes in the Huffman tree, taking each word in the word set as a leaf node in the Huffman tree, and randomly initializing the word vector of each word in the word set, and the initial value of the parameter vector is 0; after the Huffman tree is constructed, the corresponding A Huffman code is assigned to each word. For a given word, the model starts from the root node along the Huffman tree and chooses to move left or right according to the Huffman code of the word (for example, "010011") until it reaches the corresponding leaf node. The parameter vectors of each non-leaf node passed on the path are accumulated, and finally the word vector representation of the word is obtained, that is, the multi-dimensional word vector of each word is calculated by the non-leaf node parameter vectors on the path from the root node to the leaf node of the word; in this process, the multi-dimensional word vector of the word is trained using CBOW or Skip-gram to complete the training of the vector construction model.
[0052] Specifically, after obtaining the multidimensional word vector corresponding to each word in the word set corresponding to multiple historical bed type description text data, based on the bed type description keyword, traverse each word in the word set, and when a target word identical to the bed type description keyword is found in the word set, the multidimensional word vector corresponding to the target word is used as the bed type description keyword vector of the bed type description keyword.
[0053] Step 103: Generate model training data based on the bed type description keyword vector and the historical bed type classification results, and perform model training processing based on the model training data to obtain a bed type classification model.
[0054] In one embodiment, based on the historical bed type classification results, category labels are set for the bed type description keyword vectors to obtain bed type category labels corresponding to each bed type description keyword vector.
[0055] Specifically, for the historical bed type classification results corresponding to each of the plurality of historical bed type description text data, the historical bed type classification results are used as bed type category labels for each bed type description keyword vector corresponding to each of the plurality of historical bed type description text data.
[0056] In one embodiment, each bed type description keyword vector and the bed type category label corresponding to each bed type description keyword vector are used as model training data.
[0057] Specifically, each bed type description keyword vector is used as input data for model training, and the bed type category label corresponding to each bed type description keyword vector is used as output data for model training.
[0058] In one embodiment, when a bed type classification model is obtained by performing model training processing based on the model training data, an initial bed type classification model is constructed, and model training is performed on the initial bed type classification model based on the model training data, so that the initial bed type classification model outputs a predicted bed type classification result; the L1 norm between the predicted bed type classification result and the actual bed type classification result is calculated, and a loss function is determined based on the L1 norm; and the initial bed type classification model is reversely iterated trained based on the loss function to obtain a bed type classification model.
[0059] Specifically, by selecting a machine learning algorithm suitable for the classification task, such as logistic regression, decision tree, support vector machine or neural network, an initial bed type classification model is constructed, and the initial bed type classification model has randomly initialized parameters at the beginning.
[0060] Specifically, when calculating the L1 norm between the predicted bed type classification result and the actual bed type classification result, and determining the loss function based on the L1 norm, the predicted bed type classification result and the actual bed type classification result are input into a preset L1 norm calculation formula to obtain the loss function, wherein the preset L1 norm calculation formula is as follows:
[0061]
[0062] Among them, y i is the actual bed type classification result. is the bed type classification result, n is the number of samples of the bed type description keyword vector during the training process, and L1 is the loss function.
[0063] Specifically, the initial bed type classification model is reversely iterated trained based on the loss function. When the bed type classification model is obtained, the back propagation algorithm can be used to calculate the gradient of the loss function with respect to the parameters of the initial bed type classification model, and the weights and bias of the model are updated according to the calculated gradient and the preset learning rate through the gradient descent method. The initial bed type classification model is repeatedly trained until the loss function meets the preset threshold or reaches a predetermined number of iterations to obtain the bed type classification model.
[0064] Specifically, after sufficient model training iterations, the initial bed type classification model can learn how to predict the bed type category based on the bed type description keyword vector in the bed type description text data, that is, to model the correspondence between the bed type description keyword vector and the bed type category, thereby obtaining a bed type classification model.
[0065] In one embodiment, after obtaining the bed type classification model, an incremental learning method is used to continuously optimize and fine-tune the hyperparameters of the existing bed type classification model, so that the bed type classification model can automatically adjust and update when receiving new data without the need for complete retraining.
[0066] Step 104: obtaining a key word vector of the description of the bed type to be classified of the text data of the description of the bed type to be classified, and inputting the key word vector of the description of the bed type to be classified into the bed type classification model to obtain a bed type classification result.
[0067] In one embodiment, after obtaining the to-be-classified bed type description text data input by the user, keyword extraction is performed on the to-be-classified bed type description text data to obtain to-be-classified bed type description keywords, and vectorization is performed on the to-be-classified bed type description text data to obtain to-be-classified bed type description keyword vectors of the to-be-classified bed type description keywords.
[0068] Specifically, the method of performing keyword extraction and vectorization processing on the bed type description text data to be classified is as shown in the above step 102, and no further explanation or limitation is given here.
[0069] In one embodiment, the obtained bed type description keyword vector to be classified is directly input into a trained bed type classification model, so that the bed type classification model directly outputs a bed type classification result.
[0070] Example 2, see Figure 2 , Figure 2 1 is a schematic diagram of a structure of an embodiment of a bed type classification device based on machine learning provided by the present application. Corresponding to the above bed type classification method based on machine learning, the present application also provides a bed type classification device based on machine learning. The bed type classification device based on machine learning includes a module for executing the above bed type classification method based on machine learning, and the bed type classification device based on machine learning can be configured in a desktop computer, a tablet computer, a laptop computer, and other terminals. Specifically, the bed type classification device based on machine learning includes a historical data acquisition module 201, a feature data extraction module 202, a model training module 203, and a bed type classification module 204.
[0071] The historical data acquisition module 201 is used to acquire a plurality of historical bed type description text data and historical bed type classification results corresponding to each of the plurality of historical bed type description text data.
[0072] The feature data extraction module 202 is used to extract keywords from the multiple historical bed type description text data to obtain bed type description keywords, and to vectorize the multiple historical bed type description text data to obtain bed type description keyword vectors of the bed type description keywords.
[0073] The model training module 203 is used to generate model training data based on the bed type description keyword vector and the historical bed type classification results, and perform model training processing based on the model training data to obtain a bed type classification model.
[0074] The bed type classification module 204 is used to obtain a bed type description keyword vector of the bed type description text data to be classified, and input the bed type description keyword vector to be classified into the bed type classification model to obtain a bed type classification result.
[0075] In one embodiment, the historical data acquisition module 201, after being used to acquire a plurality of historical bed type description text data, further includes: performing data preprocessing on the plurality of historical bed type description text data respectively to obtain a plurality of corresponding preprocessed text data; wherein the data preprocessing includes data matching based on a preset target regular expression, and data cleaning; and updating the plurality of preprocessed text data to the plurality of historical bed type description text data.
[0076] In one embodiment, the historical data acquisition module 201 is used to perform data preprocessing on the multiple historical bed type description text data respectively to obtain corresponding multiple preprocessed text data; wherein the data preprocessing includes data matching based on a preset target regular expression, and data cleaning, specifically including: setting a target regular expression, and matching the multiple historical bed type description text data respectively based on the target regular expression; when it is detected that there is target text data matching the target regular expression in the multiple historical bed type description text data, updating the target text data to target characters to obtain multiple updated historical bed type description text data; based on the target characters, performing data cleaning on the multiple updated historical bed type description text data to obtain multiple preprocessed historical bed type description text data.
[0077] In one embodiment, the model training module 203 is used to generate model training data based on the bed type description keyword vector and the historical bed type classification results, specifically including: setting category labels for the bed type description keyword vector based on the historical bed type classification results to obtain the bed type category labels corresponding to each bed type description keyword vector; and using each bed type description keyword vector and the bed type category labels corresponding to each bed type description keyword vector as model training data.
[0078] In one embodiment, the feature data extraction module 202 is used to perform keyword extraction on the multiple historical bed type description text data respectively to obtain bed type description keywords, specifically including: performing word segmentation processing on the multiple historical bed type description text data respectively to obtain word sets corresponding to the multiple historical bed type description text data; based on the word sets, based on a preset keyword extraction algorithm, performing keyword extraction on each historical bed type description text data respectively to obtain the corresponding bed type description keywords.
[0079] In one embodiment, the feature data extraction module 202 is used to perform vectorization processing on the multiple historical bed type description text data to obtain bed type description keyword vectors of the bed type description keywords, specifically including: constructing a vector construction model based on Word2vec technology, obtaining word sets corresponding to each of the multiple historical bed type description text data, inputting the word sets into the trained vector construction model respectively, and obtaining a multi-dimensional word vector corresponding to each word in the word set; and based on the multi-dimensional word vector corresponding to each word in the word set, obtaining the bed type description keyword vectors of the bed type description keywords corresponding to each of the multiple historical bed type description text data.
[0080] In one embodiment, the model training module 203 is used to perform model training processing based on the model training data to obtain a bed type classification model, specifically including: constructing an initial bed type classification model, and performing model training on the initial bed type classification model based on the model training data, so that the initial bed type classification model outputs a predicted bed type classification result; calculating the L1 norm between the predicted bed type classification result and the actual bed type classification result, and determining a loss function based on the L1 norm; and performing reverse iterative training on the initial bed type classification model based on the loss function to obtain a bed type classification model.
[0081] The above-mentioned bed type classification device based on machine learning can implement the bed type classification method based on machine learning in the above-mentioned method embodiment. The options in the above-mentioned method embodiment are also applicable to this embodiment and will not be described in detail here.
[0082] like Figure 3 As shown, Figure 3 It is a structural diagram of an electronic device provided by the present application; it includes a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114, and the memory 113 is used to store computer programs.
[0083] In one embodiment of the present application, the processor 111 is used to implement the bed type classification method based on machine learning provided by any one of the aforementioned method embodiments when executing the program stored in the memory 113 .
[0084] It is understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.
[0085] Therefore, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the bed type classification method based on machine learning as provided in any of the aforementioned method embodiments are implemented.
[0086] The storage medium is a physical, non-transient storage medium, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which can store program codes. The computer-readable storage medium can be non-volatile or volatile.
[0087] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0088] 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 device embodiments described above are only schematic. For example, the division of each unit 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.
[0089] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present application can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0090] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application.
[0091] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0092] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
[0093] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A bed type classification method based on machine learning, characterized in that: include: Acquire a plurality of historical bed type description text data and historical bed type classification results corresponding to each of the plurality of historical bed type description text data; Performing keyword extraction on the plurality of historical bed type description text data respectively to obtain bed type description keywords, and performing vectorization processing on the plurality of historical bed type description text data to obtain bed type description keyword vectors of the bed type description keywords; Generate model training data based on the bed type description keyword vector and the historical bed type classification results, and perform model training processing based on the model training data to obtain a bed type classification model; A key word vector of the description of the bed type to be classified of the description text data of the bed type to be classified is obtained, and the key word vector of the description of the bed type to be classified is input into the bed type classification model to obtain a bed type classification result.
2. The method according to claim 1, characterized in that After obtaining multiple historical bed type description text data, it also includes: Preprocessing the plurality of historical bed type description text data respectively to obtain a plurality of corresponding preprocessed text data; wherein the data preprocessing includes data matching based on a preset target regular expression and data cleaning; The plurality of pre-processed text data are updated to the plurality of historical bed type description text data.
3. The method according to claim 2, characterized in that The plurality of historical bed type description text data are respectively preprocessed to obtain a plurality of corresponding preprocessed text data; wherein the data preprocessing includes data matching based on a preset target regular expression and data cleaning, specifically including: Setting a target regular expression, and performing matching processing on the plurality of historical bed type description text data respectively based on the target regular expression; When it is detected that there is target text data matching the target regular expression in the plurality of historical bed type description text data, the target text data is updated to target characters to obtain a plurality of updated historical bed type description text data; Based on the target characters, data cleaning processing is performed on the plurality of updated historical bed type description text data to obtain a plurality of pre-processed historical bed type description text data.
4. The method according to claim 1, characterized in that: Based on the bed type description keyword vector and the historical bed type classification results, model training data is generated, specifically including: Based on the historical bed type classification results, setting category labels for the bed type description keyword vectors to obtain bed type category labels corresponding to each bed type description keyword vector; Each bed type description keyword vector and the bed type category label corresponding to each bed type description keyword vector are used as model training data.
5. The method according to claim 1, characterized in that: Keyword extraction is performed on the plurality of historical bed type description text data respectively to obtain bed type description keywords, specifically including: Performing word segmentation processing on the plurality of historical bed type description text data respectively to obtain word sets corresponding to the plurality of historical bed type description text data respectively; Based on the word set and a preset keyword extraction algorithm, keyword extraction is performed on each historical bed type description text data to obtain the bed type description keywords corresponding to each of them.
6. The method according to claim 1, characterized in that: Vectorization processing is performed on the plurality of historical bed type description text data to obtain a bed type description keyword vector of the bed type description keyword, specifically including: Building a vector construction model based on Word2vec technology, obtaining word sets corresponding to the plurality of historical bed type description text data, respectively inputting the word sets into the trained vector construction model, and obtaining a multi-dimensional word vector corresponding to each word in the word set; And based on the multi-dimensional word vector corresponding to each word in the word set, the bed type description keyword vectors of the bed type description keywords corresponding to each of the plurality of historical bed type description text data are obtained.
7. The method according to claim 1, characterized in that: Model training processing is performed based on the model training data to obtain a bed type classification model, which specifically includes: Constructing an initial bed type classification model, and performing model training on the initial bed type classification model based on the model training data, so that the initial bed type classification model outputs a predicted bed type classification result; Calculating the L1 norm between the predicted bed type classification result and the actual bed type classification result, and determining a loss function based on the L1 norm; The initial bed type classification model is reversely iterated trained based on the loss function to obtain a bed type classification model.
8. A bed type classification device based on machine learning, characterized in that: include: Historical data acquisition module, feature data extraction module, model training module and bed type classification module; Wherein, the historical data acquisition module is used to acquire a plurality of historical bed type description text data and the historical bed type classification results corresponding to each of the plurality of historical bed type description text data; The feature data extraction module is used to perform keyword extraction on the multiple historical bed type description text data to obtain bed type description keywords, and perform vectorization processing on the multiple historical bed type description text data to obtain bed type description keyword vectors of the bed type description keywords; The model training module is used to generate model training data based on the bed type description keyword vector and the historical bed type classification results, and perform model training processing based on the model training data to obtain a bed type classification model; The bed type classification module is used to obtain a key word vector of the bed type description text data to be classified, and input the key word vector of the bed type description to be classified into the bed type classification model to obtain a bed type classification result.
9. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 can be implemented.
Citation Information
Cited By
Event classification method and device and medium
CN120763675A