CN118035465A - Method and device for constructing lightweight model, storage medium and electronic device - Google Patents

Method and device for constructing lightweight model, storage medium and electronic device Download PDF

Info

Publication number
CN118035465A
CN118035465A CN202410167008.0A CN202410167008A CN118035465A CN 118035465 A CN118035465 A CN 118035465A CN 202410167008 A CN202410167008 A CN 202410167008A CN 118035465 A CN118035465 A CN 118035465A
Authority
CN
China
Prior art keywords
knowledge
graph
data
model
user
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410167008.0A
Other languages
Chinese (zh)
Inventor
杜永杰
窦方正
田云龙
陶冶
王平辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Haier Technology Co Ltd
Qingdao Haier Intelligent Home Appliance Technology Co Ltd
Haier Uplus Intelligent Technology Beijing Co Ltd
Original Assignee
Qingdao Haier Technology Co Ltd
Qingdao Haier Intelligent Home Appliance Technology Co Ltd
Haier Uplus Intelligent Technology Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Haier Technology Co Ltd, Qingdao Haier Intelligent Home Appliance Technology Co Ltd, Haier Uplus Intelligent Technology Beijing Co Ltd filed Critical Qingdao Haier Technology Co Ltd
Priority to CN202410167008.0A priority Critical patent/CN118035465A/en
Publication of CN118035465A publication Critical patent/CN118035465A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a method and a device for constructing a lightweight model, a storage medium and an electronic device, and relates to the technical field of smart families, wherein the method for constructing the lightweight model comprises the following steps: converting the constructed hierarchical knowledge graph into a text; the knowledge in the hierarchical knowledge graph is divided into different hierarchies according to the degree of correlation and the importance level; inputting the text into a plurality of basic models for training to obtain a plurality of light-weight models; each lightweight model corresponds to knowledge of one or more levels in the level knowledge graph. According to the method, the hierarchical knowledge graph is constructed, and the hierarchical knowledge graph is converted into the text, so that knowledge forms in the hierarchical knowledge graph are more uniform, and knowledge understanding of a basic model is facilitated. In this way, knowledge can be layered and text-processed, and further, corresponding lightweight models can be trained aiming at knowledge of different levels, and further, hierarchical management of knowledge can be achieved.

Description

Method and device for constructing lightweight model, storage medium and electronic device
Technical Field
The application relates to the technical field of smart families, in particular to a method and device for constructing a lightweight model, a storage medium and an electronic device.
Background
At present, due to the wide coverage of household appliances in the smart home field, the knowledge structure is complex and the hierarchical relationship is strong, and different types of products may have completely different characteristics and problem solutions. In practical application, according to different business demands, knowledge corresponding to the demands needs to be selected, so that more accurate and efficient service is realized. Therefore, knowledge in the smart home field needs to be effectively integrated, managed and applied to achieve hierarchical management of knowledge.
In order to manage the knowledge in a grading manner, the related technology preprocesses the knowledge through a natural language processing technology, and carries out advanced processing on the preprocessed data, including entity identification, relation extraction, emotion analysis and the like, so as to construct a knowledge graph, and more accurate service is provided through the knowledge graph.
In the process of implementing the embodiments of the present disclosure, it is found that at least the following problems exist in the related art:
The related art can manage knowledge through a knowledge graph, but does not classify the knowledge according to different business requirements, and does not train a lightweight model for each level of knowledge. Thus, for knowledge in the smart home domain with a complex hierarchical knowledge structure, it is difficult for the related art to provide more accurate service for users with respect to their different business needs.
It should be noted that the information disclosed in the above background section is only for enhancing understanding of the background of the application and thus may include information that does not form the prior art that is already known to those of ordinary skill in the art.
Disclosure of Invention
The following presents a simplified summary in order to provide a basic understanding of some aspects of the disclosed embodiments. This summary is not an extensive overview, and is intended to neither identify key/critical elements nor delineate the scope of such embodiments, but is intended as a prelude to the more detailed description that follows.
The embodiment of the disclosure provides a method and a device for constructing a lightweight model, a storage medium and an electronic device, which can provide more accurate service for users according to business requirements.
In some embodiments, the method comprises: converting the constructed hierarchical knowledge graph into a text; the knowledge in the hierarchical knowledge graph is divided into different hierarchies according to the degree of correlation and the importance level; inputting the text into a plurality of basic models for training to obtain a plurality of light-weight models; each lightweight model corresponds to knowledge of one or more levels in the level knowledge graph.
Optionally, constructing a hierarchical knowledge graph includes: acquiring a knowledge base in the intelligent family field; wherein the knowledge base includes structured data and unstructured data; constructing a primary knowledge graph according to the knowledge base; training the primary knowledge graph to obtain a hierarchical knowledge graph.
Optionally, constructing a primary knowledge graph according to the knowledge base, including: carrying out entity identification and relation establishment on the structured data in the knowledge base; performing entity identification and relation extraction on unstructured data in a knowledge base; and constructing a primary knowledge graph according to the entity and the relation.
Optionally, constructing a primary knowledge graph according to the entity and the relationship, including: and according to the entity and the relationship, carrying out entity link and relationship fusion to obtain a primary knowledge graph.
Optionally, before entity identification and relation extraction are performed on unstructured data in the knowledge base, the method further comprises: text cleaning is carried out on unstructured data; and/or, word segmentation is performed on unstructured data; and/or performing stop word removal on unstructured data; and/or performing stem extraction on unstructured data.
Optionally, training the primary knowledge-graph to obtain a hierarchical knowledge-graph, including: clustering the primary knowledge graph; and grading the clustered primary knowledge graph.
Optionally, ranking the clustered primary knowledge-graph includes: grading according to a learning algorithm; or, classifying by a classifier model.
Optionally, ranking according to a machine learning algorithm includes: extracting features of data in the primary knowledge graph to obtain feature vectors; according to the feature vector, acquiring a grading strategy corresponding to the feature vector; and grading the primary knowledge graph according to a grading strategy.
Optionally, the method further comprises: and evaluating the grading result, and adjusting the grading strategy according to the evaluation result.
Optionally, clustering the primary knowledge-graph includes: carrying out relation prediction through a graph neural network; the predicted relationships are added to the primary knowledge-graph.
Optionally, converting the constructed hierarchical knowledge graph into text includes: vectorizing the data in the hierarchical knowledge graph; constructing a scene vector library according to the vectorization processing result; the data in the scene vector library are numerical data.
Optionally, after the text is input into a plurality of basic models to train and a plurality of lightweight models are obtained, the method further comprises: respectively testing the light models to obtain a plurality of test results; and respectively updating the lightweight models according to the test results.
Optionally, testing the plurality of basic models respectively to obtain a plurality of test results, including: acquiring a test set; and respectively testing the plurality of basic models according to the test set to obtain a plurality of test results.
Optionally, updating the lightweight models according to the plurality of test results, respectively, includes: acquiring newly added data according to a plurality of test results; and continuing training the lightweight model according to the newly added data.
In some embodiments, the apparatus for scene generation comprises: the conversion module is configured to convert the constructed hierarchical knowledge graph into text; and the training module is configured to input texts into a plurality of basic models for training to obtain a plurality of lightweight models.
In some embodiments, the computer-readable storage medium includes a stored program, wherein the program when run performs the method for building a lightweight model described above.
In some embodiments, the electronic device comprises a memory in which a computer program is stored and a processor arranged to perform the above-described method for constructing a lightweight model by means of the computer program.
The method and device for constructing the lightweight model, the storage medium and the electronic device provided by the embodiment of the disclosure can realize the following technical effects:
by constructing a hierarchical knowledge graph, knowledge can be divided into different levels according to the degree of correlation and importance levels. And the hierarchical knowledge graph is converted into the text, so that knowledge forms in the hierarchical knowledge graph are more uniform, and knowledge understanding of a basic model is facilitated. Therefore, knowledge can be subjected to layering and text processing, corresponding light-weight models can be trained aiming at knowledge of different levels, hierarchical management of the knowledge can be further realized, and different levels of services can be provided for users according to business requirements.
The foregoing general description and the following description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the application or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a schematic diagram of a hardware environment for a method of scene generation according to an embodiment of the present disclosure;
FIG. 2 is a software system schematic diagram of a method for scene generation according to an embodiment of the present disclosure;
FIG. 3 is a software system schematic diagram of a method for building a lightweight model according to an embodiment of the disclosure;
FIG. 4 is a schematic diagram of a method for constructing a lightweight model according to an embodiment of the disclosure;
FIG. 5 is a schematic diagram of another method for building a lightweight model according to an embodiment of the disclosure;
FIG. 6 is a schematic diagram of an apparatus for building a lightweight model according to an embodiment of the disclosure;
FIG. 7 is a schematic diagram of an electronic device for building a lightweight model according to an embodiment of the disclosure;
fig. 8 is a schematic diagram of a method for constructing a hierarchical knowledge-graph, in accordance with an embodiment of the present disclosure.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
At present, with the rapid development of technologies such as the Internet of things, cloud computing, artificial intelligence and the like, smart families become a popular research and application field.
According to one aspect of an embodiment of the present disclosure, a method for scene generation is provided. The method for generating the scene is widely applied to full-house intelligent digital control application scenes such as intelligent Home (Smart Home), intelligent Home equipment ecology, intelligent Home (INTELLIGENCE HOUSE) ecology and the like. Alternatively, in the embodiment of the present disclosure, the method for generating a scene described above may be applied to a hardware environment composed of the smart home device 01 and the control center device 02 as shown in fig. 1. As shown in fig. 1, the control center device 02 is connected with the intelligent home appliance device 01 through a network, and can be used for providing services (such as application services and the like) for a terminal or a client installed on the terminal, a database can be set on a server or independent of the server, and used for providing data storage services for the control center device 02, and cloud computing and/or edge computing services can be configured on the server or independent of the server, and used for providing data computing services for the control center device 02.
The network may include, but is not limited to, at least one of: wired network, wireless network. The wired network may include, but is not limited to, at least one of: a wide area network, a metropolitan area network, a local area network, and the wireless network may include, but is not limited to, at least one of: WIFI (WIRELESS FIDELITY ), bluetooth. The intelligent household electrical appliance 01 can be not limited to a PC, a mobile phone, a tablet personal computer, an intelligent air conditioner, an intelligent smoke machine, an intelligent refrigerator, an intelligent oven, an intelligent cooking range, an intelligent washing machine, an intelligent water heater, an intelligent washing device, an intelligent dish washer, an intelligent projection device, an intelligent television, an intelligent clothes hanger, an intelligent curtain, an intelligent video, an intelligent socket, an intelligent sound box, an intelligent fresh air device, an intelligent kitchen and toilet device, an intelligent bathroom device, an intelligent sweeping robot, an intelligent window cleaning robot, an intelligent mopping robot, an intelligent air purifying device, an intelligent steam box, an intelligent microwave oven, an intelligent kitchen appliance, an intelligent purifier, an intelligent water dispenser, an intelligent door lock and the like.
The control center device 02 may not be limited to a cloud server, a central controller, an intelligent home gateway, or the like.
In connection with the hardware environment shown in fig. 1, a software system for scene generation is provided in an embodiment of the present disclosure, as shown in fig. 2. The control center device 02 is provided with a user interaction module 03, a model application module 04, a control module 05 and a model training module 06.
The user interaction module 03 is configured to acquire a user's requirement and input the user's requirement into the lightweight model.
A model application module 04 comprising a lightweight model configured to output a first scenario solution upon receiving a user's demand; wherein the training data types of the lightweight model include user data, device data, environmental data, and spatial data.
Training data for the lightweight model is stored in the background information base 09. The background information base 09 includes user data, device data, environment data, and space data.
The user data includes basic attributes, behavior habits, preferences and preferences, common equipment and the environment in which the user is located.
User data is extremely important in the smart home environment, and can help the system understand and predict the behavior of the user, so that the service is more personalized and efficient. Basic attributes include the sex, age, occupation, etc. of the user. These tags can help the system understand the general behavioral tendencies of the user. For example, a young white collar may be more familiar with smart phones to control home devices. The behavior habit comprises records of the past use of the intelligent home equipment by the user, and the behavior habit can describe a comprehensive behavior mode. For example, a user often uses a coffee machine in 7 a.m., the use time and device identification are taken as one of the user's behavioral habits data, which the system can learn and warm up the coffee machine in time before the use time. The preferences and preferences include a record of user control devices and configuration settings that the system can also learn. For example, a user may like to watch a movie in the evening, and the user may often dim the living room lights and turn on home theater mode. Common devices include records of the devices most commonly used by users. For example, if a user often cooks in a kitchen and prefers to hear an audio reading, the sound is determined to be the user's usual device, or one of the usual devices. The environment in which the user is located includes activity patterns in different spatial environments. For example, a user who is often working in a study will exhibit a different activity pattern than a user who is resting in a living room.
The device data includes: device basic information, device status, device capabilities, and device location.
Devices are a key component of a smart home environment. The basic information of the device includes the model, brand, model and the like of the device, and the information is helpful for identifying the type of the device and knowing the basic function of the device. The device state includes a switch state and a current operating state of the device. Such state information is critical to understanding the current situation of the device and predicting the operations that may need to be performed. For example, knowing that the air conditioner is running and is set at 22 ℃, the system may need to raise the temperature of the air conditioner setting if the user feels too cold. Device capabilities include functions that the device can perform. For example, intelligent lights may adjust brightness and color. And the intelligent sound box can play music, set timing and the like. The system needs to know the characteristics of the device and how the device responds to a particular command. Each device in a home environment will be in a particular spatial location. This location information will influence the understanding of the user instructions and subsequent operating strategies. For example, if it is known that a voice command is issued from a bedroom and the command content is "turn off the light" then the light located in the bedroom should be turned off.
The environmental data includes: somatosensory environment, indoor air quality, time and season, room traffic and special conditions.
The environment has a decisive influence on the system's understanding of the user's needs and making accurate decisions. The somatosensory environment comprises indoor temperature, humidity, illumination, noise and other environmental parameter information. For example, the indoor temperature may affect a thermostatic device. While indoor lighting conditions change may change the user's demand for intelligent lights. Indoor air quality may require a user to turn on an air purifier or a roller blind. The time and season include the current point in time, date, season, etc. For example, entering the night requires the light to be turned on, while in winter it may be necessary to raise the temperature of the thermostatic device. The room traffic includes whether someone is in the room and the movement of the person. For example, a room with no person may turn off the lights to save energy, while if someone enters it may be necessary to turn on the lighting. Special cases include special events that also affect the environment, such as whether a party is in progress or a guest is coming.
Spatial data includes room layout, room functions, device distribution, and spatial dimensions.
Spatial data refers to physical attributes and features of the environment in which the smart home system is located. The room layout includes the positional relationship of the individual rooms in the home and the house type design. Such information may affect how the devices are distributed and installed, and may also affect the user's movement and use of the devices at home. Each room has specific functions, e.g. bedrooms for rest, study rooms for work or study, living rooms for social or recreational activities. Knowing the function of each room can help the system understand what activities a user may be doing at a particular location or what needs the device. The device distribution can learn the intelligent home devices contained in each room. And the relative position between the devices is also important for accurate control of the devices. Spatial dimensions include the size, angle, and height of a space or venue. For example, when controlling a window shade, it is necessary to consider the stroke required for window shade opening and closing control according to the width of the window.
A control module 05 configured to control the target device according to the first scenario scheme. Wherein the target device is one or more of the intelligent home devices 01.
Model training module 06 is configured to train a lightweight model. Model training module 06 includes: knowledge base 061, hierarchical knowledge graph 062, scene vector library 063 and reinforcement learning model 07 in the intelligent family domain.
In the knowledge base 061 of the smart home domain, structured and unstructured data are stored, including but not limited to: product design data, scene design, product planning, enterprise standardization data, product function list, etc. Such data may be obtained from product specifications, customer service orders, after-market orders, marketing orders, or e-commerce evaluations.
The hierarchical knowledge graph 062 is a knowledge graph subjected to deep clustering and grading treatment, and a knowledge structure meeting relevant requirements can be constructed. As shown in fig. 8, the knowledge base 061 of the smart home domain provides data support for the primary knowledge-graph such that the hierarchical knowledge-graph 062 obtained from the primary knowledge-graph includes multi-hierarchy attributes of the smart home domain. The knowledge in the hierarchical knowledge graph 062 is divided into a plurality of different hierarchies according to the degree of correlation and the importance level, so that the scene generation model is convenient to understand the use mode of each intelligent device and the relation between the intelligent devices. The hierarchical knowledge graph can be used as an effective input for training a lightweight model and provides a necessary knowledge system for the model. By constructing the hierarchical knowledge graph 062, new dimensions can be added on the basis of the original full-scale knowledge graph, so that the knowledge graph can better serve a specific business scene, and the value of the knowledge graph in practical application is improved.
The scene vector library 063 is composed of a large number of scene vectors, the scene vector library 063 comprises a large number of data for scene generation, and the lightweight model is trained through the scene vector library 063, so that the lightweight model can combine a large number of data for scene generation. And finally, enabling the generated scene to better meet the requirements of users.
The reinforcement learning model 07 is used to update the scene vector library, and the reinforcement learning model 07 can expand the scene vectors in the scene vector library. The reinforcement learning model 07 may include one or more of a condition generation countermeasure network, a markov decision process, or a Q value learning algorithm. In the case of optimization of the countermeasure network by conditional generation, the authenticity of the scene vector in the scene vector library can also be tested, thereby further optimizing the scene vector library.
The control hub device 02 is further provided with a user feedback module 08 configured to collect and process feedback information of the user to update the lightweight model by the user.
As shown in fig. 2, the system is capable of training a lightweight model in combination with a knowledge base 061 of the smart home domain. In generating a scene through a lightweight model, various data such as user data, device data, environment data, and space data are combined. And, the lightweight model can be updated with user feedback. And finally, enabling the generated scene to better meet the requirements of users.
The lightweight model can control equipment in the smart home according to the requirements of the user, and a scene corresponding to the requirements of the user is generated. The user interaction module 03 is configured to obtain a requirement of a user, and input the requirement of the user into the scene generating model. The knowledge base 061, the hierarchical knowledge graph 062, the scene vector library 063 and the reinforcement learning model 07 in the smart home domain are all used for training the lightweight model.
In the software system shown in fig. 2, the control hub device 02 needs to understand the needs and intentions of the user in an efficient manner and respond accordingly. The key point is to understand the true intention of the user, and thus classify the user request.
As shown in fig. 3, an embodiment of the present disclosure provides a software system for constructing a lightweight model. The system is arranged in the model training module 06 of fig. 2, and comprises a conversion module 064 and a training module 065.
The conversion module 064 can convert the constructed hierarchical knowledge-graph into text. The training module 065 can train the text input into a plurality of basic models to obtain a plurality of lightweight models. The conversion module 064 can divide the knowledge into different levels according to the degree of correlation and the importance level by constructing a level knowledge graph 062. And, the hierarchical knowledge graph 062 is converted into text, and a scene vector library 063 is obtained. The knowledge form in the hierarchical knowledge graph 062 can be more unified, and knowledge understanding of the basic model is facilitated.
In combination with the hardware environment shown in fig. 1 and the software systems shown in fig. 2 and 3, the method for constructing a lightweight model is provided in an embodiment of the present disclosure. The method is as shown in fig. 4, and comprises the following steps:
S001, the conversion module converts the constructed hierarchical knowledge graph into a text. The knowledge in the hierarchical knowledge graph is divided into different hierarchies according to the degree of correlation and the importance level.
S002, the training module inputs the text into a plurality of basic models to train, and a plurality of light weight models are obtained. Each lightweight model corresponds to knowledge of one or more levels in the level knowledge graph.
In the embodiment of the disclosure, compared with the related art, knowledge can be divided into different levels according to the degree of correlation and the importance level by constructing a level knowledge graph. For example, when the hierarchy classification is performed according to the degree of correlation, the usage methods of the devices can be obtained from the specifications of different smart home devices at the same time, and the knowledge related to the usage methods of the devices in the specifications is classified into the product introduction layer. When grading according to importance levels, knowledge can be graded into high and low levels, e.g. business requirements for scene generation may only need to use knowledge at a high level of the hierarchical knowledge graph. And the hierarchical knowledge graph is converted into the text, so that knowledge forms in the hierarchical knowledge graph are more uniform, and knowledge understanding of a basic model is facilitated. In this way, knowledge can be layered and text-processed, and further corresponding lightweight models can be trained for knowledge of different levels.
Optionally, constructing a hierarchical knowledge graph includes: acquiring a knowledge base in the intelligent family field; wherein the knowledge base includes structured data and unstructured data; constructing a primary knowledge graph according to the knowledge base; training the primary knowledge graph to obtain a hierarchical knowledge graph.
In the embodiment of the disclosure, the knowledge graph not only can capture the multi-element information of the household electrical appliance, but also can integrate the information to form deep association, thereby providing valuable decision support for links such as design, production, sales and the like of the household electrical appliance. According to the embodiment of the disclosure, the knowledge graph is built according to the knowledge base in the intelligent home field, and is used for training the lightweight model, so that the lightweight model can contain the multiple information in the intelligent home field, intelligent home appliances can be better utilized in a generated scene, the generated scene is further more in accordance with the requirements of users, and the use experience of the users is improved.
Optionally, constructing a primary knowledge graph according to the knowledge base, including: carrying out entity identification and relation establishment on the structured data in the knowledge base; performing entity identification and relation extraction on unstructured data in a knowledge base; and constructing a primary knowledge graph according to the entity and the relation.
In the embodiment of the disclosure, the structured data is data in a fixed format, for example, data in an Excel format. Some tools, such as the pandas library of Python, may be used to read Excel files and load the data into memory. In the data presented in Excel format, each column may represent an entity type and each row may represent a particular set of entities and relationships between entities. Therefore, the relationship between the entity type of each column and each row can be obtained by traversing the Excel file, so that the primary knowledge graph is built through the entity type, and the relationship is built among the entities in the primary knowledge graph.
The format of unstructured data is not fixed, e.g., product introduction in the product specification. Entities in unstructured data can be identified through natural language processing techniques, and relationships between entities are obtained by understanding the meaning of unstructured data. And then the obtained entity and relationship are used for constructing a primary knowledge graph.
Optionally, constructing a primary knowledge graph according to the entity and the relationship, including: and according to the entity and the relationship, carrying out entity link and relationship fusion to obtain a primary knowledge graph.
In the disclosed embodiment, entity linking is an important task in the field of natural language processing. The goal of entity linking is to link entities mentioned in the text, such as person names, place names, organization names, etc., with corresponding entities in the knowledge base. The semantics of sentences can be better understood through entity linkage, and text mining and analysis work can be performed on a richer and comprehensive knowledge base.
Optionally, before entity identification and relation extraction are performed on unstructured data in the knowledge base, the method further comprises: text cleansing is performed on unstructured data.
Text cleansing can delete unwanted characters, format text, and misspellings. And thus remove invalid information in the unstructured data. And further, accuracy and efficiency of entity identification and relation extraction are improved.
Optionally, before entity identification and relation extraction are performed on unstructured data in the knowledge base, the method further comprises: and word segmentation is carried out on unstructured data.
The segmentation may segment the continuous text into individual words or tokens. And further, accuracy and efficiency of entity identification and relation extraction are improved.
Optionally, before entity identification and relation extraction are performed on unstructured data in the knowledge base, the method further comprises: and performing stop word removal on unstructured data.
Stop words are words that occur frequently in text but contribute less to the meaning of the text, such as "have", etc. The stop word removal is to remove words that contribute less to the meaning of the text to reduce noise. And further, accuracy and efficiency of entity identification and relation extraction are improved.
Optionally, before entity identification and relation extraction are performed on unstructured data in the knowledge base, the method further comprises: and extracting word stems of unstructured data.
Stem extraction is used to unify words of different forms into the same form, thereby making the text representation more compact and consistent. The method is beneficial to improving the performance of tasks such as text classification, information retrieval and the like, and further improving the accuracy and efficiency of entity identification and relation extraction.
Optionally, training the primary knowledge-graph to obtain a hierarchical knowledge-graph, including: clustering the primary knowledge graph; and grading the clustered primary knowledge graph.
In the embodiment of the disclosure, the primary knowledge graphs are clustered, so that the related knowledge entities can be gathered together, and the control center equipment can find all information related to a certain theme or concept more easily. For the primary knowledge graph, clustering can hide the complexity of the underlying structure, thereby providing a more concise and intuitive knowledge view.
The clustered knowledge graph is classified, and each cluster is ordered or classified mainly according to the importance, the relevance or the hierarchical structure of the knowledge entity. By grading, a layering view from macroscopic to microscopic can be provided, and the structure of the knowledge graph can be better understood. Important entities or relationships can be highlighted by ranking, providing more valuable information. And the information or sub-fields required can be rapidly positioned according to the grading result, so that the information retrieval efficiency is improved. Further, the ranking may be updated according to time or other dynamic factors to reflect changes in the knowledge-graph. By grading, the structure and the content of the knowledge graph can be more easily explained, and the understandability of knowledge is improved.
Optionally, clustering the primary knowledge-graph includes: and carrying out relation prediction through a graph neural network. The predicted relationships are added to the primary knowledge-graph.
A graph neural network is a neural network that is dedicated to processing graph structure data. Graph convolution is a basic operation in a graph neural network to capture relationships between nodes. By updating node characteristics in the graph volume lamination, information of neighbor nodes can be aggregated, so that richer node representations are obtained. After the graph rolling, each node contains much information about its neighbors. Relationships between nodes may be predicted using prediction tasks. Common prediction tasks include link prediction between nodes, node attribute prediction, and the like. In the embodiment of the disclosure, the relationship among the nodes in the primary knowledge graph can be predicted through the prediction task, and the predicted relationship is added into the primary knowledge graph, so that the node representation in the primary knowledge graph is more abundant, and the primary knowledge graph is further conveniently layered, so that the hierarchical knowledge graph is obtained.
Optionally, ranking the clustered primary knowledge-graph includes ranking according to a learning algorithm.
In the embodiments of the present disclosure, the learning algorithm includes a machine learning algorithm and a deep learning algorithm. The machine learning algorithm can be directly classified according to the similarity among knowledge points, and the classification efficiency is higher. The deep learning algorithm can learn the nonlinear relation among the knowledge points, so that the grading result is more accurate, and the hierarchical knowledge graph which meets the requirements of users better is obtained.
Optionally, ranking according to a machine learning algorithm includes: extracting features of data in the primary knowledge graph to obtain feature vectors; according to the feature vector, acquiring a grading strategy corresponding to the feature vector; and grading the primary knowledge graph according to a grading strategy.
In the embodiment of the disclosure, feature extraction is performed on data in the primary knowledge-graph, wherein feature vectors can be extracted from nodes in the primary knowledge-graph. Based on the extracted feature vectors, a classification strategy may be formulated. Such as ranking based on the distance between feature vectors of the nodes or the similarity of feature vectors. In this way, the knowledge in the primary knowledge graph can be divided into different levels, and the attributes corresponding to the levels are obtained.
Optionally, ranking the clustered primary knowledge-graph includes ranking by a classifier model.
The classifier model can quickly classify new data, so that the classifier model is widely applied to scenes needing real-time response. And, the implementation and maintenance costs of the classifier model are relatively low compared to learning algorithms.
Optionally, after grading the clustered primary knowledge graph, the method further includes: and evaluating the grading result, and adjusting the grading strategy according to the evaluation result.
In the embodiment of the disclosure, due to the relative disorder of the data in the primary knowledge graph, the classification policy formulated for the first time may cause errors in classification, thereby affecting the classification result. By evaluating the grading result, the grading strategy can be timely adjusted, so that the knowledge in the primary knowledge graph can be more accurate when being graded, and the accuracy of the hierarchical knowledge graph is further improved.
In practical application, a retention method, a cross-validation method or a self-help method can be utilized, test errors can be obtained through the retention method, the cross-validation method or the self-help method, and the generalized errors of the grading result are simulated by the test errors, so that the grading result is evaluated.
Further, after the evaluation result is obtained, the evaluation strategy is adjusted. For example, the number of layers of a hierarchical knowledge graph is increased or decreased, or some type of data is increased or decreased in knowledge of a single hierarchy, depending on the evaluation result.
Optionally, converting the constructed hierarchical knowledge graph into text includes: vectorizing the data in the hierarchical knowledge graph; constructing a scene vector library according to the vectorization processing result; the data in the scene vector library are numerical data.
In the embodiment of the disclosure, the scene vector in the scene vector library can embody the scene mode that the scene generating model can generate, for example, the vector of 'Xiaoming', the vector of the home appliance (intelligent sound box and air conditioner), the vector of 'evening' and the vector of 'living room' are combined to form a scene vector comprehensively considering all elements. Thus, the smart home scene can be described as "Xiaoming in the evening, the temperature of the air conditioner is adjusted to 24 degrees through the smart speaker in the living room to watch television news" by the scene vector. "
Knowledge in the hierarchical knowledge graph is converted into a vector form through vectorization processing. Therefore, the data in the vector form is beneficial to understanding of the basic model, and after the text is input into the basic model, the basic model is convenient to train, and then the lightweight model is obtained.
Optionally, after the text is input into a plurality of basic models to train and a plurality of lightweight models are obtained, the method further comprises: respectively testing the light models to obtain a plurality of test results; and respectively updating the lightweight models according to the test results.
As shown in connection with fig. 5, another method for constructing a lightweight model provided by an embodiment of the present disclosure includes:
S101, converting the constructed hierarchical knowledge graph into a text by a conversion module. The knowledge in the hierarchical knowledge graph is divided into different hierarchies according to the degree of correlation and the importance level.
S102, a training module inputs texts into a plurality of basic models to train, and a plurality of lightweight models are obtained. Each lightweight model corresponds to knowledge of one or more levels in the level knowledge graph.
S103, the training module tests the lightweight models respectively to obtain a plurality of test results.
S104, the training module respectively updates the lightweight models according to the plurality of test results.
In the embodiment of the disclosure, the built lightweight model is tested, whether the lightweight model meets the requirements of users or not can be tested, and whether more accurate services can be provided for the users according to different service requirements or not can be tested. After the test result is obtained, the lightweight model is updated according to the test result, so that the lightweight model can meet the requirements of users.
Optionally, testing the plurality of basic models respectively to obtain a plurality of test results, including: acquiring a test set; and respectively testing the plurality of basic models according to the test set to obtain a plurality of test results.
In the embodiment of the disclosure, the test set corresponds to a scene, the plurality of basic models are respectively tested through the test set, different basic models can be tested, and then test results can be matched with different basic models, so that the update of different lightweight models is facilitated.
Optionally, updating the lightweight models according to the plurality of test results, respectively, includes: acquiring newly added data according to a plurality of test results; and continuing training the lightweight model according to the newly added data.
In the embodiment of the disclosure, aiming at a plurality of test results, newly-added data matched with the lightweight model can be obtained, the newly-added data can expand a scene vector library, and further the lightweight model is continuously trained by using the expanded scene vector library. Thus, the trained lightweight model is enabled to more meet the requirements of users, and the users can select a proper lightweight model according to business requirements.
Optionally, after obtaining the plurality of lightweight models, the method further includes: the user's demand is obtained. And inputting the requirements of the user into the light model to obtain a first scene scheme. Wherein the training data types of the lightweight model include user data, device data, environmental data, and spatial data. The target device is controlled according to the first scenario scheme.
Under the condition that the user demand is simpler, the user demand is input into a lightweight model, and an output result is obtained. For example, if the user needs to turn on a light, the user's needs are input into a lightweight model corresponding to the lighting device.
Under the condition that the user requirement is complex, the requirement of the user is input into a plurality of lightweight models, and an output result is obtained. For example, a user needs to repair damaged equipment in a smart home, and then needs to input the user's needs into a lightweight model associated with the damaged equipment and a lightweight model associated with after-market.
In the embodiment of the disclosure, the control center device generates a first scene scheme through the lightweight model, and controls the target device according to the first scene scheme. The target device executes the first scenario scheme, and generates a scenario corresponding to the user's needs. In the related art, a scene is generated according to a control instruction and a scene classification template, which may cause that the generated scene may have a larger difference from the requirement of a user, and the requirement of the user is difficult to reach. The embodiment of the disclosure trains the lightweight model by utilizing various data such as users, equipment, environment and space, so that the trained lightweight model can generate scenes by combining a plurality of factors such as users, equipment, environment and space. In this way, the generated scene is closer to the requirements of the user, so that the user experience is improved.
Optionally, after controlling the target device according to the first scenario solution, the method further includes: scene data is acquired. And updating the first scene scheme according to the scene data to obtain a second scene scheme. And controlling the target device according to the second scene scheme.
The second scene scheme comprises changing data of the target equipment, the control center equipment can acquire the target equipment to be controlled, and the running state of the target equipment is changed according to the changing data of the second scene scheme so as to meet the requirements of users.
In the embodiment of the disclosure, the current scene state can be obtained, the execution effect of the current scheme and the change condition of the environment can be judged, and the control center equipment can update the first scene scheme according to the judgment result, so that the second scene scheme meets the requirements of users more and the user experience is improved. In addition, the updating process is completed by the control center equipment, the requirement is not required to be input again by a user, the operation of the user is simplified, and the scene generating process is more intelligent.
Optionally, the scene data includes a temperature after the scene is executed, a humidity after the scene is executed, and an operating state of the device after the scene is executed.
Through monitoring the temperature humidity and the equipment running state of the room, the execution effect of the scene can be acquired more accurately, the control center equipment can update the first scene scheme according to the execution effect of the scheme, the second scene scheme is more in line with the requirements of users, and the user experience is improved.
Optionally, after controlling the target device according to the first scenario solution, the method further includes: and obtaining the satisfaction degree of the user on the generated scene. And updating the lightweight model according to the satisfaction degree of the user.
In the embodiment of the disclosure, user feedback can be collected and processed, and the satisfaction degree of the user on the generated scene can be obtained through the feedback information of the user. Through deep understanding and analysis of user satisfaction, the lightweight model can be timely and accurately corrected and optimized, so that user experience is improved.
Optionally, obtaining satisfaction of the user with the generated scene includes: and monitoring the behavior of the user in the generated scene, and analyzing to obtain the satisfaction degree of the user.
Optionally, obtaining satisfaction of the user with the generated scene includes: and collecting feedback of the user, and analyzing and obtaining satisfaction degree of the user. For example, user-implicit feedback may be collected. For example, users talk about smart home experiences on social media, or share use experiences with friends, family. These implicit feedback can represent user satisfaction with the scene.
Optionally, obtaining satisfaction of the user with the generated scene includes: and analyzing and obtaining the satisfaction degree of the user through an A/B test. Illustratively, the satisfaction of the user is tested by creating two or more versions of the control scenario. For example, different control strategies may be tested for the same device, with the test being more popular with users.
Optionally, obtaining satisfaction of the user with the generated scene includes: and analyzing and obtaining the satisfaction degree of the user according to the prediction model. Based on the user's historical behavior, personal characteristics, and other relevant factors, the user's reaction to a particular scenario may be predicted using machine learning or statistical models. And the satisfaction degree of the user to the scene can be deduced according to the reaction of the user.
Optionally, obtaining satisfaction of the user with the generated scene includes: and analyzing and obtaining the satisfaction degree of the user according to the user loss rate and the return visit rate. The churn rate and revisit rate of the user can be counted, and if the user is not satisfied with the provided scene, the user can stop using the system, so that the churn rate is increased. If the user is very satisfied, the user may often return, resulting in an increase in return visit rate. Monitoring churn rate and return visit rate can help to learn user satisfaction to obtain user satisfaction.
Optionally, updating the lightweight model according to the satisfaction of the user includes: and evaluating the first scene scheme according to the satisfaction degree of the user to obtain an evaluation result. Wherein the evaluation result includes a positive evaluation or a negative evaluation. And inputting the evaluation result into a knowledge base in the intelligent family field so as to update the lightweight model.
Optionally, inputting the evaluation result into a knowledge base in the smart home domain, and updating the lightweight model, including: and according to the evaluation result, expanding the knowledge of the knowledge base in the intelligent family field to obtain an updated knowledge base. And training a lightweight model according to the updated knowledge base.
In the embodiments of the present disclosure, lightweight models can be optimized. The evaluation result is input into the knowledge base in the intelligent family field, the evaluation result can be used as a training material to construct a knowledge graph, and the knowledge graph is used for further training the lightweight model, so that the scene generated by the lightweight model meets the requirements of users.
Optionally, updating the lightweight model according to the satisfaction of the user includes: and evaluating the first scene scheme according to the satisfaction degree of the user to obtain an evaluation result. And inputting the evaluation result into the large language model to obtain correction data, and updating the lightweight model by using the correction data.
In the embodiment of the disclosure, the large language model is a deep learning model and is trained based on massive text data. Natural language text can be generated, meaning of the language text can be understood, and various natural language tasks such as text abstracts, questions and answers, translation and the like can be processed. Large language models are characterized by large scale, contain billions of parameters, and are capable of learning complex patterns in language data. The large language model has the advantages of naturalness, generalization capability, high efficiency, strong task processing capability, high-quality text content generation, strong dialogue system establishment capability, reduced dependence on domain data, promotion of development of the artificial intelligence field and the like. They are able to understand and generate natural language text, accommodating a variety of different languages and contexts.
The evaluation result is input to the large language model, and correction data corresponding to the positive evaluation or the negative evaluation obtained by the evaluation model can be output through the large language model. And applying the correction data to the scene vector library to update the scene rule, and obtaining an updated scene vector library. And training a lightweight model through the updated scene vector library. The scene generated by the lightweight model can meet the requirements of users.
Optionally, updating the lightweight model with the correction data includes: applying the correction data to a scene vector library to update scene rules and obtain an updated scene vector library; and obtaining an updated lightweight model through training of the updated scene vector library.
According to the embodiment of the disclosure, according to the correction data, the scene rules in the scene vector library can be updated, so that the scene vectors in the scene vector library are more real, and further, the requirements of users are met more. The scene vector library comprises a large amount of data for generating scenes, and the updated lightweight model is obtained through training of the scene vector library, so that the updated lightweight model can be combined with a large amount of data for generating scenes. And finally, enabling the generated scene to better meet the requirements of users.
Optionally, obtaining the updated lightweight model through training of the updated scene vector library includes: and creating a training set according to the updated scene vector library. Wherein the training set includes scenes that match the updated scene vector library. And training by using the training set to obtain an updated lightweight model.
In the embodiment of the disclosure, the training set comprises scenes conforming to the updated scene vector library, and the scene generating model is trained through the training set, so that the trained scene generating model can be adjusted based on the updated scene vector library, and further, the scenes generated by the scene generating model are more in accordance with the requirements of users through feedback of the users.
Optionally, training using the training set to obtain an updated lightweight model includes: and training the basic model by using a training set to obtain an updated lightweight model.
The updated lightweight model is a scene generation model which is obtained by training after integrating user feedback data on the basis of the basic model. Compared with a lightweight model, the method has more reference data, and a more real scene scheme can be generated according to the requirements of users, so that the requirements of the users are met.
In an embodiment of the disclosure, the base model includes a neural network-based language model, a recurrent neural network language model, a long-short-term memory network language model, or a gated loop unit language model. These models have wide application in the field of natural language processing, such as speech recognition, machine translation, text classification, and the like.
According to the embodiment of the disclosure, the basic model is trained through the training set, the obtained updated lightweight model is integrated with feedback data of the user, and the generated scene meets the requirements of the user.
Optionally, training using the training set to obtain an updated lightweight model includes: and adjusting the lightweight model by using the training set to obtain the updated lightweight model.
According to the embodiment of the disclosure, the training set is used as new training data, and the user data, the device data, the environment data and the space data are combined, so that the training set, the user data, the device data, the environment data and the space data can be simultaneously utilized when the lightweight model is trained, and then parameters in the lightweight model can be adjusted, and the updated lightweight model is obtained.
Optionally, performing positive evaluation or negative evaluation on the generated scene according to the satisfaction degree of the user, including: and according to the satisfaction degree of the user, evaluating the scene corresponding to the satisfaction degree by using an evaluation model to obtain the evaluation score of the scene. And in the case that the evaluation score is higher than or equal to the score threshold value, determining to perform forward evaluation on the generated scene. Or in the case that the evaluation score is lower than the score threshold, determining to perform negative evaluation on the generated scene.
In the embodiment of the disclosure, the scenes corresponding to the satisfaction degree need to be evaluated by using the evaluation model, the evaluation model can score the current scenes according to the satisfaction degree of the user, and the scenes are given an evaluation score. The rating score can represent how well the current scene meets the user's needs. The higher the degree of compliance, the higher the user satisfaction.
And sorting the evaluation scores according to the historical evaluation data by the evaluation model, and selecting a high-score scene and a low-score scene. The evaluation model can determine a score threshold based on the high score scene and the low score scene. And in the case that the evaluation score is higher than or equal to the score threshold value, determining to perform forward evaluation on the generated scene. Or in the case that the evaluation score is lower than the score threshold, determining to perform negative evaluation on the generated scene. In this way, by comparing the evaluation score with the score threshold, the generated scene can be evaluated positively or negatively.
In the embodiment of the disclosure, the control center device can acquire feedback information of the user, and the feedback information can embody the feeling of the user and the execution effect of the first scene scheme. And evaluating the feedback information, so that the control center equipment can understand the feeling of the user and the execution effect of the first scene scheme conveniently. The evaluation result is input into the knowledge base in the intelligent family field, the evaluation result can be used as a training material to construct a knowledge graph, the knowledge graph is used for training the lightweight model, and the lightweight model is further trained, so that the scene generated by the lightweight model meets the requirements of users.
Optionally, before evaluating the scene corresponding to the satisfaction degree by using the evaluation model according to the satisfaction degree of the user, the method further includes: selecting a machine learning model or a statistical model; training the selected model according to the historical user feedback data to obtain an evaluation model.
Optionally, the machine learning model includes a decision tree, random forest, support vector machine, neural network, or clustering algorithm.
Alternatively, the statistical model comprises linear regression, logistic regression, analysis of variance, chi-square test, or survival analysis.
In the embodiment of the disclosure, training of the evaluation model is particularly important, and positive evaluation or negative evaluation can be performed on the generated scene through the evaluation model. Firstly, a proper model to be trained is selected, and under the condition of selecting a machine learning model, the machine learning model is better in performance when processing large-scale and high-dimensional data, can mine complex relations in the data, and accurately predicts unknown data. The machine learning model can continuously optimize its own parameters through an adaptive learning algorithm to better adapt to the change of data. In the case of selecting a statistical model, the statistical model can give an estimate of the parameter and its degree of influence on the target variable, making the result easier to interpret and understand. And the statistical model is more effective in processing data with obvious statistical rules, and the result is relatively stable. Secondly, the control center equipment can acquire historical user feedback data, and training the selected model according to the historical user feedback data. Therefore, the trained evaluation model can learn the habit of the historical user, and further, a more accurate evaluation result is obtained.
In practical applications, a suitable machine learning model or statistical model may be selected according to circumstances.
Optionally, updating the lightweight model according to the satisfaction of the user, further includes: evaluating the first scene scheme according to the satisfaction degree of the user to obtain an evaluation result; inputting the evaluation result into a condition to generate an countermeasure network and updating the lightweight model.
In the embodiment of the disclosure, the condition generating countermeasure network can be used for training the scene vector library, and the evaluation result is input into the condition generating countermeasure network, so that the data which can be utilized by the condition generating network are more abundant, and further in the process of generating the scene vector by the generator, the input evaluation result can be utilized to generate a more real scene vector. Therefore, continuous training of the countermeasure network is generated through the conditions, so that scenes in the scene vector library are more real, and the requirements of users can be met. Optionally, obtaining the requirement of the user includes: request data of a user is received. Background information is added to the request data. Wherein the context information includes user data, device data, environment data, and spatial data. And processing the request data added with the background information to obtain the fused request data. And transmitting the fused request data to a classifier. Wherein the classifier is used for classifying the request of the user.
In the embodiment of the disclosure, by adding the background information in the request data, the request data of the user contains more effective information related to the scene, so that the classifier is convenient to understand and classify. The user requests are classified by a deep learning model as compared to the related art. According to the embodiment of the disclosure, after the background information is added to the request data, the data is subjected to subsequent processing, so that the processed data is easier to be understood by the classifier, and the classification result of the classifier is more accurate. Finally, the accuracy of the classification model is improved.
Optionally, adding context information in the request data includes: background information is collected. Wherein the context information includes user data, device data, environment data, and spatial data. The request data and the context information are combined.
In the embodiment of the disclosure, the control center device can acquire the background information of the current smart home after the user sends out the request data. The background information contains a lot of information related to the scene. By adding such information to the request data, the content of the request data can be made richer, and more effective information can be contained for the classifier to understand and classify. The request data and the background information can be bound by combining the request data and the background information, the request data and the background information can be transmitted simultaneously in the data transmission process, and the request data and the background information can be understood and classified simultaneously when the classifier is used for understanding and classifying. By comprehensively understanding the request data and the background information, the classification result of the classifier is more accurate. Finally, the accuracy of the classification model is improved.
Optionally, processing the request data to which the background information is added includes: and carrying out domain vectorization processing on the request data added with the background information.
In the disclosed embodiments, domain vectorization processing exhibits the advantages of being efficient, interpretable, flexible, scalable, robust, powerful analysis capabilities, reusable, and supporting large-scale data processing by converting unstructured data into a structured vector representation. The method makes field vectorization processing a powerful data processing and analysis technology, can greatly improve the performance and accuracy of the model, and provides a better solution for various fields. By deep mining the intrinsic laws and patterns of data, the intrinsic structure and features of the data can be better understood, thereby better interpreting the results of the model. Meanwhile, the result of vectorization processing can be shared among different tasks and fields, so that the reusability of the model is improved.
The field vectorization processing is carried out on the request data added with the background information, so that the processed data can be more easily understood by the front-end classifier, and the classification result of the front-end classifier is more accurate. Finally, the accuracy of the classification model is improved.
Optionally, performing domain vectorization processing on the request data added with the background information, including: forming conversion content according to the background information; inserting the converted content into the request data of the user to obtain comprehensive data; the integrated data is converted into a fixed length vector.
In the embodiment of the disclosure, the background information has various forms, and the direct insertion of the background information into the request data of the user may lead to the disorder of the inserted data form, which is not beneficial to the understanding and classification of the classifier. The conversion content obtained by the conversion based on the background information is more easily inserted into the request data of the user. And the comprehensive data is converted into a vector with a fixed length, so that the form of the comprehensive data can be unified, and the comprehensive data is input into the classifier, so that the classifier can understand and classify the comprehensive data conveniently, and the classification result of the classifier is more accurate. Finally, the accuracy of the classification model is improved.
Optionally, forming the conversion content according to the background information includes: acquiring a text in the background information according to a natural language processing algorithm; the text is converted into a numerical vector.
In the disclosed embodiments, text needs to be converted into numeric vectors for processing by a machine learning model or a deep learning model. Text conversion is typically aided by Word embedding techniques such as Word2Vec (Word to Vector), gloVe (Global Vectors for Word Representation, global Vector of Word representation) or BERT (Bidirectional Encoder Representations from Transformers, transform-based bi-directional encoder representation) models, and the like. BERT is a pre-trained model that can be fine-tuned to classify user intent. Word embedding is a method commonly used in natural language processing, mainly converting text data into numerical vectors for use by machine learning or deep learning models. Word2Vec is a common Word embedding method that can train a continuous vector space model in which semantically similar words are also located very close in space. The two modes are also classified into CBOW (Continuous Bag of Words, continuous word bag model) and Skip-gram (Skip-gram model). CBOW predicts the context around a word, while Skip-gram predicts the context around from a word. GloVe is another word embedding method, training on a global corpus. GloVe are directed to minimizing reconstruction errors of dense matrices. BERT employs a bi-directional transducer encoder. Unlike most previous pre-trained language models that can only be pre-trained using either left or right contexts, BERT allows the model to be encoded with both left and right contexts by introducing a masking language model objective function.
Each method is suitable for different scenarios, e.g. Word2Vec is suitable when there is a lot of training data and computational resources are limited. GloVe can fully mine global statistics. BERT achieves the best results when dealing with diverse inputs.
Optionally, inserting the conversion content into the request data of the user includes: vectorizing the request data of the user to obtain an input vector of the user; and splicing the input vector of the user with the numerical vector in the background information.
The most basic and intuitive method of stitching the user's input vector with the numeric vector in the background information is to stitch the numeric vector in the background information directly to the tail or head of the user's input vector. For example, if the user input is a vector of length N and the background is a vector of length M, then a new vector of length n+m will be obtained after stitching.
Optionally, inserting the conversion content into the request data of the user includes: vectorizing the request data of the user to obtain an input vector of the user; the user's input vector is weighted summed with the numeric vector of the background information.
The input vector of the user and the numerical vector of the background information are weighted and summed, and the other method is to weight and sum the input vector of the user and the numerical vector of the background information according to a certain weight. This method requires defining a weight parameter that indicates how important the two pieces of information are to the final result. The weighted summation can keep the dimension of the combined vector unchanged.
Optionally, inserting the conversion content into the request data of the user includes: vectorizing the request data of the user to obtain an input vector of the user; the user's input vector is mixed with the numeric vector of the background information. The input vector of the user and the numerical vector of the background information are mixed, or the two vectors can be spliced together to form a longer vector, and then the longer vector is subjected to nonlinear transformation through one or more fully connected layers. The method can better fuse two parts of information, and can learn the optimal fusion method through training.
As shown in connection with fig. 6, in some embodiments, an apparatus 60 for constructing a lightweight model includes: a conversion module 064 and a training module 065.
The conversion module 064 is configured to convert the constructed hierarchical knowledge-graph into text. The training module 065 is configured to train text input into a plurality of base models to obtain a plurality of lightweight models.
By adopting the device 60 for constructing a lightweight model provided by the embodiment of the present disclosure, knowledge can be divided into different levels according to the degree of correlation and the importance level by constructing a level knowledge graph. In addition, the conversion module 064 converts the hierarchical knowledge graph into a text, so that knowledge forms in the hierarchical knowledge graph can be more uniform, and knowledge understanding of the basic model is facilitated. In this way, knowledge can be layered and textually processed, and then the training module 065 trains the corresponding lightweight model for knowledge of different levels.
In some embodiments, a computer-readable storage medium includes a stored program, wherein the program when run performs the method for building a lightweight model described above.
Embodiments of the present disclosure may be embodied in a software product stored on a storage medium, including one or more instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of a method according to embodiments of the present disclosure. While the aforementioned storage medium may be a non-transitory storage medium, such as: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
As shown in connection with fig. 7, in some embodiments, the electronic device comprises a memory 701 and a processor 700, the memory 701 having stored therein a computer program, the processor 700 being arranged to perform the above-described method for constructing a lightweight model by means of the computer program.
Optionally, the electronic device 70 may also include a communication interface (Communication Interface) 702 and a bus 703. The processor 700, the communication interface 702, and the memory 701 may communicate with each other through the bus 703. The communication interface 702 may be used for information transfer. The processor 700 may call logic instructions in the memory 701 to perform the method for building a lightweight model of the above embodiment.
Further, the logic instructions in the memory 701 may be implemented in the form of software functional units and may be stored in a computer readable storage medium when sold or used as a stand alone product.
The memory 701 is used as a computer readable storage medium for storing a software program, a computer executable program, and program instructions/modules corresponding to the methods in the embodiments of the present disclosure. The processor 700 executes the functional application and the data processing by executing the program instructions/modules stored in the memory 701, that is, implements the method for constructing the lightweight model in the above embodiment.
The memory 701 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, at least one application program required for a function. The storage data area may store data created according to the use of the terminal device, etc. In addition, the memory 701 may include a high-speed random access memory, and may also include a nonvolatile memory.

Claims (13)

1. A method for constructing a lightweight model, comprising:
converting the constructed hierarchical knowledge graph into a text; the knowledge in the hierarchical knowledge graph is divided into different hierarchies according to the degree of correlation and the importance level;
Inputting the text into a plurality of basic models for training to obtain a plurality of light-weight models; each lightweight model corresponds to knowledge of one or more levels in the level knowledge graph.
2. The method of claim 1, wherein constructing a hierarchical knowledge-graph comprises:
acquiring a knowledge base in the intelligent family field; wherein the knowledge base includes structured data and unstructured data;
constructing a primary knowledge graph according to the knowledge base;
Training the primary knowledge graph to obtain a hierarchical knowledge graph.
3. The method of claim 2, wherein constructing a primary knowledge-graph from the knowledge-base comprises:
carrying out entity identification and relation establishment on the structured data in the knowledge base;
performing entity identification and relation extraction on unstructured data in a knowledge base;
And constructing a primary knowledge graph according to the entity and the relation.
4. A method according to claim 3, wherein constructing a primary knowledge-graph from entities and relationships comprises:
And according to the entity and the relationship, carrying out entity link and relationship fusion to obtain a primary knowledge graph.
5. The method of claim 2, wherein training the primary knowledge-graph to obtain a hierarchical knowledge-graph comprises:
clustering the primary knowledge graph; and is combined with the other components of the water treatment device,
And grading the clustered primary knowledge graph.
6. The method of claim 5, wherein ranking the clustered primary knowledge-graph comprises:
grading according to a learning algorithm; or alternatively, the first and second heat exchangers may be,
Classification is performed by a classifier model.
7. The method of claim 6, wherein ranking according to a machine learning algorithm comprises:
extracting features of data in the primary knowledge graph to obtain feature vectors;
according to the feature vector, acquiring a grading strategy corresponding to the feature vector;
and grading the primary knowledge graph according to a grading strategy.
8. The method as recited in claim 7, further comprising:
The result of the classification is evaluated and,
And adjusting the grading strategy according to the evaluation result.
9. The method of claim 5, wherein clustering the primary knowledge-graph comprises:
Carrying out relation prediction through a graph neural network;
The predicted relationships are added to the primary knowledge-graph.
10. The method according to any one of claims 1 to 9, wherein converting the constructed hierarchical knowledge-graph into text comprises:
Vectorizing the data in the hierarchical knowledge graph;
constructing a scene vector library according to the vectorization processing result; the data in the scene vector library are numerical data.
11. An apparatus for constructing a lightweight model, comprising:
The conversion module is configured to convert the constructed hierarchical knowledge graph into text;
and the training module is configured to input texts into a plurality of basic models for training to obtain a plurality of lightweight models.
12. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored program, wherein the program when run performs the method of any one of claims 1 to 10.
13. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, the processor being arranged to perform the method of any of claims 1 to 10 by means of the computer program.
CN202410167008.0A 2024-02-06 2024-02-06 Method and device for constructing lightweight model, storage medium and electronic device Pending CN118035465A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410167008.0A CN118035465A (en) 2024-02-06 2024-02-06 Method and device for constructing lightweight model, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410167008.0A CN118035465A (en) 2024-02-06 2024-02-06 Method and device for constructing lightweight model, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN118035465A true CN118035465A (en) 2024-05-14

Family

ID=90985154

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410167008.0A Pending CN118035465A (en) 2024-02-06 2024-02-06 Method and device for constructing lightweight model, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN118035465A (en)

Similar Documents

Publication Publication Date Title
Acampora et al. Interoperable and adaptive fuzzy services for ambient intelligence applications
CN115826428B (en) Control method and device of household equipment, storage medium and electronic device
US11669059B2 (en) Autonomous and semantic optimization approach for real-time performance management in a built environment
CN112799747A (en) Intelligent assistant evaluation and recommendation method, system, terminal and readable storage medium
Wang et al. Learning performance prediction via convolutional GRU and explainable neural networks in e-learning environments
CN115424615A (en) Intelligent equipment voice control method, device, equipment and storage medium
CN117762032B (en) Intelligent equipment control system and method based on scene adaptation and artificial intelligence
CN111046071A (en) Intelligent home decision method based on Markov logic network
Hoang et al. A novel time series prediction approach based on a hybridization of least squares support vector regression and swarm intelligence
Li et al. Intelligent control system of smart home for context awareness
Konstantakopoulos et al. A deep learning and gamification approach to energy conservation at nanyang technological university
CN117706954B (en) Method and device for generating scene, storage medium and electronic device
CN117708680B (en) Method and device for improving accuracy of classification model, storage medium and electronic device
WO2023173596A1 (en) Statement text intention recognition method and apparatus, storage medium, and electronic apparatus
CN118035465A (en) Method and device for constructing lightweight model, storage medium and electronic device
CN116541166A (en) Super-computing power scheduling server and resource management method
CN116958608A (en) Method, device, equipment, medium and program product for updating object recognition model
CN118051625A (en) Method and device for optimizing scene generation model, storage medium and electronic device
Tegelund et al. A task-oriented service personalization scheme for smart environments using reinforcement learning
Qiu et al. Pbre: A rule extraction method from trained neural networks designed for smart home services
Maury et al. Savings at home by modifying the energy consumption pattern using gamification, predictive models and Energy Management Systems
Wang et al. Collectively learned multi-level spatial embeddings for residential rental price prediction
KR20080050976A (en) A method and its system for user's intention modeling based on human desires
Naim et al. A big-bang big-crunch optimized general type-2 fuzzy logic approach for multi-criteria group decision making
Munoz et al. Finding the appropriate housing: A fuzzy-model-based recommender system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination