Model training method, device, electronic device and storage medium

By generating and sending histograms to edge computing nodes in IoT devices for model training, the problem of insufficient storage resources of IoT devices is solved, the model training efficiency is improved and data security is enhanced.

CN115701071BActive Publication Date: 2024-12-31CHINA MOBILE M2M +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110807500.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-16
Publication Date
2024-12-31
Estimated Expiration
2041-07-16

AI Technical Summary

Technical Problem

In the field of IoT, the storage resource limitation of mobile terminals leads to the inability to process large amounts of sample data, resulting in reduced model training efficiency.

Method used

By acquiring tasks in the blockchain, IoT devices collect data to generate a histogram and send it to an edge computing node, using Byzantine consensus and decision tree verification algorithm for model training, and combining and processing histograms to improve model training efficiency.

Benefits of technology

It improves the efficiency of model training, reduces the burden on IoT devices, ensures the optimization of data processing and storage resources, and enhances data security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115701071B_ABST
    Figure CN115701071B_ABST
Patent Text Reader

Abstract

The present application discloses a model training method, device, electronic device and storage medium. The method is applied to an Internet of Things device, and the method includes: obtaining at least one first data based on a first task published in a blockchain; the first task represents the task of training a tree structure model; the first data represents the data collected by the Internet of Things device; generating a first histogram based on the at least one first data; the first histogram represents the distribution of the first data; and sending the first histogram to a first edge computing node, so that the first edge computing node performs the training of the tree structure model in the first task based on the received histogram.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet of Things technology, and in particular to a model training method, device, electronic device and storage medium. Background Art

[0002] In the related art, when conducting model training in the field of Internet of Things, mobile terminals are usually used as devices for data flow and training. However, the limited storage resources of mobile terminals make it impossible to process large amounts of sample data, which reduces the efficiency of model training. Summary of the invention

[0003] In view of this, the embodiments of the present application provide a model training method, device, electronic device and storage medium to at least solve the problem of being unable to process a large amount of sample data, thereby reducing the efficiency of model training.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] The present application embodiment provides a model training method, which is applied to an Internet of Things device, and the method includes:

[0006] Based on a first task published in the blockchain, at least one first data is obtained; the first task represents a task of training a tree structure model; the first data represents data collected by the Internet of Things device;

[0007] Generate a first histogram according to the at least one first data; the first histogram represents the distribution of the first data;

[0008] The first histogram is sent to a first edge computing node, so that the first edge computing node performs training of the tree structure model in the first task based on the received histogram.

[0009] The embodiment of the present application also provides another model training method, which is applied to a first edge computing node, and the method includes:

[0010] Receive at least one first histogram; the first histogram represents a histogram uploaded by an Internet of Things device matching each edge computing node in at least one edge computing node; the first histogram is generated by the Internet of Things device according to at least one first data obtained by the first task; the first task represents a task of training a tree structure model based on a first root node;

[0011] Performing merging processing on the at least one first histogram to generate a second histogram;

[0012] Based on the second histogram, the tree structure model is trained through Byzantine consensus and decision tree verification algorithm.

[0013] The present application also provides a model training device, including:

[0014] An acquisition unit, configured to acquire at least one first data based on a first task published in a blockchain; the first task represents a task of training a tree structure model; and the first data represents data collected by an Internet of Things device;

[0015] A first generating unit, configured to generate a first histogram according to the at least one first data; the first histogram represents the distribution of the first data;

[0016] A sending unit is used to send the first histogram to a first edge computing node, so that the first edge computing node performs training of the tree structure model in the first task based on the received histogram.

[0017] The present application also provides another model training device, including:

[0018] A receiving unit, configured to receive at least one first histogram; the first histogram represents a histogram uploaded by an Internet of Things device matching each edge computing node in at least one edge computing node; the first histogram is generated by the Internet of Things device according to at least one first data obtained by a first task; the first task represents a task of training a tree structure model based on a first root node;

[0019] A second generating unit, configured to perform merging processing on the at least one first histogram to generate a second histogram;

[0020] A training unit is used to train the tree structure model based on the second histogram through a Byzantine consensus and a decision tree verification algorithm.

[0021] An embodiment of the present invention further provides an electronic device, comprising: a processor and a memory for storing a computer program that can be run on the processor,

[0022] Wherein, the processor is used to execute the steps of any of the above methods when running the computer program.

[0023] An embodiment of the present invention further provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.

[0024] In an embodiment of the present application, when an IoT device receives a model training task published on the blockchain, the IoT device is responsible for collecting data as data samples for model training and sending it to the edge computing node for model training. New data samples can be continuously imported during the model training process, thereby improving the efficiency of model training and ensuring the resources required during the model training process. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 System architecture diagram for model training in related technologies;

[0026] Figure 2 A schematic diagram of the model training system architecture provided in one embodiment of the present application;

[0027] Figure 3 A schematic diagram of the implementation flow of a model training method provided in one embodiment of the present application;

[0028] Figure 4 A schematic diagram of the implementation flow of a model training method provided in yet another embodiment of the present application;

[0029] Figure 5 A schematic diagram of the implementation flow of a model training method provided in yet another embodiment of the present application;

[0030] Figure 6 A schematic diagram of the implementation flow of a model training method provided in yet another embodiment of the present application;

[0031] Figure 7 A schematic diagram of the implementation flow of a model training method provided in yet another embodiment of the present application;

[0032] Figure 8 A schematic diagram of the implementation flow of a model training method provided in yet another embodiment of the present application;

[0033] Fig. 9 A schematic diagram of transmitting a first histogram according to a ring global protocol provided in an embodiment of the present application;

[0034] Fig.10 A schematic diagram of the implementation flow of a model training method provided in one embodiment of the present application;

[0035] Fig.11 A schematic diagram of the structure of a model training device provided in one embodiment of the present application;

[0036] Fig.12 A schematic diagram of the structure of a model training device provided in yet another embodiment of the present application;

[0037] Fig.13 Schematic diagram of the hardware structure of the electronic device according to the embodiment of the present application. DETAILED DESCRIPTION

[0038] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0039] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.

[0040] It should be noted that the technical solutions described in the embodiments of the present invention can be arbitrarily combined without conflict.

[0041] In addition, in the examples of the present invention, "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0042] Before describing the technical solutions of the embodiments of the present application in detail, a brief description of the machine learning model architecture in the related art is first given.

[0043] In real life, the number of smart home devices shows an increasing trend, and the increase in the number of smart home devices will generate huge data. In related technologies, the concept of smart home based on big data is mainly composed of IoT devices, mobile terminals, modern wireless communications, cloud and edge computing, big data analysis and artificial intelligence. Therefore, maintaining seamless connection between mobile terminals and using big data analysis and artificial intelligence technology to obtain user usage habits, so as to provide better services and products, has become an urgent problem to be solved. In related technologies, a hierarchical crowdsourcing federated learning (FL) system is proposed to build a machine learning model, so as to provide better services and optimize the functions of related equipment in smart home scenarios. Figure 1 As shown, Figure 1 The system architecture diagram of model training in the related art is shown, wherein: Figure 1 The system shown mainly consists of three components, manufacturers, clients, and blockchain, where manufacturers are used to propose a requirement for a crowdsourced FL task, clients interested in the crowdsourced FL task submit the model generated by training based on sample data to the blockchain, and finally, the blockchain acts as a centralized server to collect the clients' models, and the selected edge nodes calculate and generate a global FL model for the manufacturer.

[0044] like Figure 1The system architecture shown has three main technical problems. First, in the related art, in order to transfer intensive calculations, mobile terminals are usually used as data flow and training devices. In actual applications, although mobile terminals have strong computing power, the performance of mobile terminals, such as the power, network status, and storage resources of mobile terminals, is limited. Therefore, during the convolutional layer training of mobile terminals, there is a high probability that the device will be disconnected, the storage space is insufficient, and other situations will occur, resulting in problems such as the inability to store training samples. In addition, since the mobile terminal and the Internet of Things device are in a many-to-many relationship, it is difficult to achieve functions such as fine-grained data synchronization and access control. Specifically, a user may have multiple mobile terminals. Therefore, during the model training process, multiple mobile terminals need to be connected to the same mobile terminal at the same time, and the storage of training samples of multiple mobile terminals and the synchronization of the training process are also problems that need to be solved. In addition, since during the training process, the mobile terminal needs to obtain the original training data from the Internet of Things device, a large amount of privacy data is transmitted between the Internet of Things device and the mobile terminal and between the mobile terminals, making it difficult to ensure data security.

[0045] Second, in Figure 1 In the system architecture shown, there is still the problem of the applicability of collaborative training of deep neural networks in the blockchain and IoT device architecture. The applicability problem is mainly reflected in the complex structure of deep neural networks, large models, and many iterations. Therefore, the local models stored in the blockchain need to use off-chain storage technology during the update process, which increases the complexity of the system, and also requires additional configuration of access control policies. Through the access control policy, the edge nodes have appropriate permissions to access the local model updates stored in IPFS for each IoT device before the model aggregation task can be performed. In the collaborative training process, a large number of intermediate parameters need to be transmitted, the local neural network needs to train the model for two rounds, and the aggregation model update is also required, which brings huge computing consumption and communication costs to the mobile terminal for parameter model training. The incentives provided by the service provider for the training task cannot make up for the consumption of mobile terminals and edge nodes during the model training process. In the model training process, IoT devices and sensor networks are more oriented to the collected state data, basic data analysis and management, and deep data analysis and application. They have no significant advantages in processing the main data in deep neural networks, such as a large number of state parameters and tabular data.

[0046] In addition, traditional machine learning algorithms are more or less based on static sample assumptions. As the statistical information obtained by IoT devices continues to grow and the resources of IoT devices are limited, it is impossible to store all historical data in hardware resources. Therefore, they cannot be used in the real environment where IoT devices continuously import new statistical samples.

[0047] In order to solve the Figure 1 The technical problems existing in the system architecture shown in the figure, the embodiment of the present application provides a system architecture, such as Figure 2 As shown, Figure 2 The schematic diagram of the model training system architecture of the embodiment of the present application is shown. Figure 2 As shown, the system architecture provided by the embodiment of the present application is mainly composed of three parts, namely, the Internet of Things service provider, the Internet of Things device user and the blockchain platform, as follows:

[0048] IoT service providers propose machine learning models to predict customer consumption, behavior and improve IoT devices. Customers with IoT devices can participate in FL tasks. As more and more customers participate in crowdsourced FL tasks, the sample data of FL tasks will increase accordingly, and IoT service providers will be able to obtain more accurate machine learning task models.

[0049] IoT device users can apply to participate in FL tasks. Authenticated IoT devices can be assigned edge computing nodes to receive update information. In addition, the dynamic joining and exit of IoT devices is supported during the model training process. For IoT devices that join the FL task midway during the model training process, they can start model training after downloading the previous block information from the edge computing node. In addition, when the training model uploaded by the IoT device is verified by the edge computing node, it can get corresponding rewards, thereby attracting different IoT devices to join the model training task.

[0050] The edge computing nodes of the blockchain platform are responsible for calculations. By receiving the histogram information uploaded by the corresponding IoT devices, the edge computing nodes can build a global histogram through mutual communication, and finally reach a consensus on leaf node splitting.

[0051] The present application is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0052] The present application embodiment provides a model training method, Figure 3 A flow chart of the model training method of the embodiment of the present application is shown as follows: Figure 3 As shown, the method includes:

[0053] S301: Based on a first task published in the blockchain, obtain at least one first data; the first task represents the task of training a tree structure model; the first data represents the data collected by the Internet of Things device.

[0054] Here, when the IoT device selects the first task from the blockchain, it is necessary to obtain at least one first data as the training sample data of the first task, wherein the IoT device can use the collected data as the training sample data. In practical applications, there are training tasks for the drill rod structure model published by different IoT service providers in the blockchain, and the IoT device can select one of the tasks in the blockchain to start model training. In practical applications, the attributes of different tasks can be determined through the task publishing records of the IoT service provider, as shown in Table 1, which shows the training task records published by the IoT service provider.

[0055] Table 1

[0056]

[0057] When the IoT device selects a model training task in the blockchain, it can determine the first task by referring to the task reward in the training task record. In practical applications, the IoT device is allowed to join the first task midway. The IoT device that joins midway can participate in the model training after downloading the data of the root node, where the root node is given by the first task.

[0058] S302: Generate a first histogram according to the at least one first data; the first histogram represents the distribution of the first data.

[0059] Here, at least one first data acquired by the IoT device is counted to generate a first histogram, and the distribution of different first data can be determined through the content recorded in the first histogram. For example, when the data collected by the IoT device is temperature data, as the environment in which the IoT device is located warms up, the corresponding collected temperature data will also change. By counting the temperature data collected by the IoT device to form a first histogram, the collection status of different temperature data can be intuitively determined, so that the temperature change law of the environment can be further determined.

[0060] In one embodiment, if Figure 4 As shown, generating a first histogram according to the at least one first data includes:

[0061] S401: dividing the at least one first data into a first data set and a second data set according to a set first segmentation point.

[0062] Here, the IoT device divides at least one first data collected by the IoT device into a first data set and a second data set according to a set first segmentation point, wherein the set first segmentation point can be represented by V (splitting feature, splitting threshold). In actual applications, in the process of model training based on the first data collected by the IoT device, the first edge computing node will also calculate the first segmentation point and then segment the first data to generate corresponding child nodes. Therefore, when the IoT device performs first data segmentation, the first segmentation point can be used to segment the data.

[0063] S402: Generate a first histogram according to the first data set and the second data set.

[0064] Here, a first histogram is generated by statistics of the first data set and the second data set. In practical applications, the first histogram represents the distribution of the first data by a series of vertical stripes or line segments of unequal heights. In the embodiment of the present application, the horizontal axis represents the value range of different data, and the vertical axis represents the distribution. Therefore, the first histogram is a compressed approximate representation of the real number set S, wherein the real number set S is a set composed of at least one first data. Through the first histogram, it can be obtained Among them, |S| represents the number of data points in the real number set S, B represents the number of vertical stripes in the first histogram, that is, the number of bins in the first histogram, and y i Represents the total number of samples that fall into the corresponding bin in the first histogram.

[0065] In one embodiment, if Figure 5 As shown, the method also includes:

[0066] S501: In the case where there is second data, determine a first interval in the first histogram into which the second data falls; the second data represents data newly collected by the Internet of Things device.

[0067] Here, when the IoT device executes the first task, it will continuously collect new data, and the IoT device will update the histogram according to the newly collected second data. In practical applications, the interval ranges corresponding to different vertical stripes in the first histogram are different, so it is necessary to determine the first interval in which the second data falls in the first histogram, and the first interval in which the second data falls in the first histogram can be determined by an online clustering algorithm.

[0068] S502: Update the first histogram according to the first interval and the first data volume.

[0069] Here, after determining the first interval in which the second data falls in the first histogram, it is necessary to count the first data amount of the second data falling in the first interval, and determine the height of the vertical stripes corresponding to the first interval in the first histogram according to the first data amount of the second data, thereby completing the update of the first histogram. The updated first histogram can simultaneously record the distribution of the first data previously collected by the IoT device, and can also record the distribution of the second data newly collected by the IoT device, thereby improving the data processing efficiency.

[0070] In one embodiment, if Figure 6 As shown, the method also includes:

[0071] S601: When the first interval corresponding to the second data exceeds the interval range of the first histogram, determine the second interval and the third interval; the second interval represents the interval with the smallest number of samples in the first histogram; the third interval represents the interval with the smallest number of samples in the intervals adjacent to the second interval.

[0072] Here, when the first interval corresponding to the second data exceeds the interval range of the first histogram, it indicates that the second data is not within the current threshold range of the first histogram, and the first histogram needs to be reconstructed so that the first histogram can record the distribution of the second data. Determine the second interval with the smallest number of samples in the first histogram, that is, determine the interval where the lowest vertical stripe in the first histogram is located, and determine the third interval with the smallest number of samples in the interval adjacent to the second interval in the first histogram, that is, the interval where the lowest vertical stripe in the left and right adjacent vertical stripes of the second interval is located is the third interval. In practical applications, when there is only one adjacent interval to the second interval, the third interval corresponds to the adjacent interval of the second interval. For example, the second interval has only one left adjacent interval, and the left adjacent interval is determined as the third interval.

[0073] S602: Merge the second interval and the third interval in the first histogram to generate a fourth interval.

[0074] Here, the second interval and the third interval in the first histogram are merged to generate a new fourth interval, wherein the interval range of the fourth interval corresponds to the range of the second interval and the third interval, and the height of the longitudinal stripes corresponding to the fourth interval is the sum of the height of the longitudinal stripes of the second interval and the height of the longitudinal stripes of the third interval. When the second interval and the third interval are merged, the interval quantity of the first histogram will be reduced accordingly on the original basis. For example, when the first histogram originally has 4 intervals, when the second interval and the third interval are merged, the first histogram will become 3 intervals. After the first histogram is reconstructed, the first histogram can be updated according to the first interval corresponding to the second data on the first histogram and the first data amount. In practical applications, with the addition of the first interval corresponding to the second data in the first histogram, the first histogram changes from the merged 3 intervals to 4 intervals, which is consistent with the number of intervals of the original first histogram, thereby ensuring that the first histogram can reflect the distribution of the first data and improve data processing efficiency.

[0075] In one embodiment, the method further comprises:

[0076] Based on the Laplace mechanism, noise of a set intensity is added to the first histogram.

[0077] Here, after the IoT device generates a corresponding first histogram according to at least one first data collected, based on the Laplace mechanism, noise of a set intensity is added to the first histogram, wherein the algorithm expression corresponding to the Laplace mechanism is k(D)=f(D)+lap(Δf / ε), wherein f∈F, and the sensitivity of F is defined as S(F)=max D1,D2 (∑ f∈F |f(D1)-f(D2)|), in practical applications, the first histogram processed by the Laplace mechanism is a differential privacy histogram, which is conducive to protecting the differential privacy of the first data, thereby improving the security of the data. In practical applications, since the first histogram is a statistical result after generalization processing, the privacy budget ε can be set to a relatively large value, and then the first histogram is slightly disturbed, so as to ensure the effect of the model training process.

[0078] In one embodiment, after generating the first histogram according to the at least one first data, the method further comprises:

[0079] The data statistical information recorded in the first histogram is stored.

[0080] Here, since the first data acquired by the IoT device is constantly growing, it is impossible to store all the data in the hardware resources, and in order to enable the new data acquired by the IoT device to be added to the model training process, in an embodiment of the present application, the data statistical information recorded in the first histogram is stored, so that the IoT device will not store too much data due to participating in the first task, and at the same time reduce the consumption of storage resources of the IoT device during the participation in the first task.

[0081] S303: Send the first histogram to a first edge computing node, so that the first edge computing node performs training of the tree structure model in the first task based on the received histogram.

[0082] Here, after the IoT device generates the first histogram, the first histogram is sent to the first edge node, so that the first edge node can perform model training through the first histogram sent by the IoT device. In the system architecture provided in the embodiment of the present application, the IoT device is responsible for collecting sample data required for training the model, and the first edge node is responsible for performing model training based on the sample data collected by the IoT device, thereby reducing the burden on the IoT device and further improving the efficiency of model training and data processing.

[0083] In one embodiment, before sending the first histogram to the first edge computing node, the method further includes:

[0084] Reporting first information to the first edge computing node; wherein,

[0085] The first information represents device information of the IoT device; the first edge node is paired with the IoT device based on the first information.

[0086] Here, there are multiple edge computing nodes in the system architecture provided in the embodiment of the present application. Therefore, before the Internet of Things device sends the first histogram to the first edge computing node, it is necessary to report the first information to the first edge computing node to pair the Internet of Things device with the edge computing node. In actual applications, the Internet of Things device needs to provide different device information such as serial number. After authentication, the Internet of Things device can be successfully matched with the first edge node, so that the first edge computing node can receive the histogram uploaded by the Internet of Things device. By pairing the edge computing node with the Internet of Things device, different edge computing nodes can process different data in a more orderly manner, and the security of data during transmission can be further improved.

[0087] In the above embodiment, the IoT device is used to collect sample data for model training and does not participate in model training, thereby avoiding additional overhead for the IoT device. In addition, the IoT device can update the histogram in a timely manner based on the newly collected data. The histogram is independent of the amount of sample data, thereby avoiding excessive consumption of storage resources of the IoT device. In addition, adding smaller Laplace noise to the histogram can better protect the privacy and security of the data and improve the security of the data.

[0088] In the embodiment of the present application, another model training method is also provided, such as Figure 7 As shown, the method is applied to a first edge computing node, and the method includes:

[0089] S701: Receive at least one first histogram; the first histogram represents a histogram uploaded by an IoT device that matches each edge computing node in at least one edge computing node; the first histogram is generated by the IoT device based on at least one first data obtained by a first task; the first task represents a task of training a tree structure model based on a first root node.

[0090] Here, the first edge computing node can match multiple IoT devices, thereby receiving the first histograms uploaded by multiple IoT devices matching the first edge computing node, wherein the first histogram is generated by the IoT device according to at least one first data obtained by the first task. Since the first edge computing node receives the first histogram generated by the IoT device according to the first task, the first edge computing node can perform the first task according to the received first histogram. In actual applications, the first task is published to the blockchain by different IoT service providers. The first task is to generate a model based on the root node training provided by the IoT service provider. In order to avoid the IoT service provider directly sending the root node to the IoT device, or storing the root node in the cloud, etc., the IoT service provider will publish the initialization parameters to the blockchain. When the first edge computing node performs model training for the first task, it can obtain the corresponding initialization parameters from the blockchain, including the first root node.

[0091] In one embodiment, if Figure 8 As shown, when receiving at least one first histogram, the method includes:

[0092] S801: Receive first information reported by a first IoT device; the first information represents device information of the first IoT device.

[0093] Here, in order to further ensure the security of data transmission, the first edge computing node needs to verify the first Internet of Things device, and the first edge computing node receives the first information reported by the first Internet of Things device, wherein the first information represents the device information of the first Internet of Things device. For example, the first edge computing node receives the serial number of the first Internet of Things device, etc.

[0094] S802: Authenticate the first IoT device based on the first information, and pair with the first IoT device after the authentication is successful.

[0095] Here, the first edge computing node will authenticate the first IoT device based on the first information. For example, the first edge computing node will determine whether the first IoT device is a registered device based on the first information, or whether the first information received by the first edge computing node is forged, etc. After the first IoT device passes the authentication of the first edge computing node, the first edge computing node will be paired with the first IoT device.

[0096] S803: In a paired state with the first IoT device, receiving a first histogram uploaded by the first IoT device.

[0097] Here, the first edge computing node and the first Internet of Things device are in a paired state, indicating that the first edge computing node trusts the first Internet of Things device and trusts the data uploaded by the first Internet of Things device. Therefore, the first edge computing node will receive the first histogram uploaded by the first Internet of Things device, thereby ensuring that the uploaded data is secure data and improving data security.

[0098] S702: performing merging processing on the at least one first histogram to generate a second histogram.

[0099] Here, the second histogram is a global histogram. In practical applications, there will be multiple edge computing nodes participating in the model training of the first task, and each edge computing node can be paired with multiple IoT devices. Therefore, for a first edge computing node, it can receive the first histograms uploaded by multiple matching IoT devices, exchange and merge the first histograms received by different edge computing nodes, so as to construct a global histogram, that is, the second histogram includes the first histograms uploaded by all IoT devices participating in the first task. In practical applications, the generation of the second histogram is based on merging different first histograms, so as to merge the first histograms uploaded by all IoT devices into the second histogram. In practical applications, the merging of the first histograms can be achieved using the MergeHistogram() method.

[0100] In one embodiment, when the at least one histogram is merged to generate a second histogram, the method includes:

[0101] According to the ring global protocol, a first histogram uploaded by a second Internet of Things device is obtained from at least one second edge computing node; the second Internet of Things device represents other Internet of Things devices other than the first Internet of Things device matching the first edge node.

[0102] Here, the first edge computing node needs to generate a second histogram based on at least one histogram, wherein the second histogram is a global histogram, that is, in addition to obtaining at least one first histogram uploaded by the first IoT device matching the first edge computing node, the first edge computing node also needs to obtain at least one first histogram received by the second edge computing node, wherein the at least one first histogram received by the second edge computing node is uploaded by the second IoT device, and the second IoT device refers to other IoT devices other than the first IoT device matching the first edge computing node. In practical applications, since the capabilities of each IoT device are different, such as network conditions, power, computing resources, etc., the time spent by the edge computing node matching the IoT device to receive the uploaded first histogram is relatively large. In order to further save data transmission time and improve data transmission efficiency, in the embodiment of the present application, a transmission method of a ring global protocol is used to transmit the first histogram between different edge computing nodes while the edge computing node is waiting for the IoT device. The ring global protocol is applicable to multiple non-intersecting data subsets exchanging data, and the data transmission volume is independent of the number of nodes. Therefore, the edge computing node can obtain the first histogram received by other edge computing nodes in the shortest time. In the embodiment of the present application, if Fig. 9 As shown, Fig. 9 The schematic diagram of the first histogram transmission according to the ring global protocol is shown. Each edge computing node forms a ring according to the index. Each edge computing node has a logical left neighbor and a right neighbor. Assuming that each edge computing node matches K IoT devices, when each edge computing node obtains That is, one of the K IoT devices uploads the first histogram to the edge computing node and starts transmitting the first histogram. Each edge computing node sends At the same time, the edge computing node continues to wait for the first histogram uploaded by other matching IoT devices, and the first round of transmission is completed. After receiving the first histogram uploaded by another matching IoT device, the edge computing node aggregates the first histogram received in this round and the first histogram received from the left neighbor in the previous round and sends it to the right neighbor, until each edge computing node has the first histogram of all edge computing nodes, and then generates the second histogram.

[0103] S703: Based on the second histogram, the tree structure model is trained through a Byzantine consensus and a decision tree verification algorithm.

[0104] Here, the first edge node trains the tree structure model according to the second histogram through the Byzantine consensus and decision tree verification algorithm, wherein the splitting scheme of the tree structure model is generated based on the decision tree verification algorithm, and the Byzantine consensus is used to determine whether the splitting scheme of the tree structure model passes the verification. In practical applications, the Byzantine consensus can be RAFT, etc., and the trained model is directly stored on the blockchain. In practical applications, since the decision tree verification algorithm is used for model training, less redundant intermediate information is generated, and there is no need to solve the problem of insufficient computing resources on the blockchain, and the Byzantine consensus through multiple edge computing nodes can further ensure security. In practical applications, the trained model is suitable for data mining tasks of large-scale state data.

[0105] In one embodiment, if Fig.10 As shown, the tree structure model is trained based on the second histogram through Byzantine consensus and decision tree verification algorithm, including:

[0106] S1001: Determine, according to a task type of the first task, a first segmentation point corresponding to each edge computing node in the at least one edge computing node; the first segmentation point represents a segmentation point of at least one first data carried in the second histogram.

[0107] Here, according to the task type of the first task, the first segmentation point corresponding to each edge computing node in at least one edge computing node is determined. In practical applications, the first task can be divided into a classification task and a regression task. For different task types, the method for the edge computing node to determine the first segmentation point is different. When the first task is a classification task, the algorithm expression for calculating the first segmentation point is:

[0108]

[0109] Among them, IG j represents the information gain of the jth attribute, w represents the split value, w1 and w2 represent the upper and lower bounds of the attribute value respectively. H is the conditional entropy and are the conditional entropy of the left sample set and the right sample set after being divided according to attribute j, O is the decision tree node currently being split, Y is the output (prediction value) of the current decision tree, P(w1≤X j ≤w) is attribute X j The probability of the value being [w1,w).

[0110] When the first task is a regression task, the algorithm expression corresponding to the first segmentation point is:

[0111] Where VG is the variance gain, σ j is the conditional variance of the sample set on attribute j. According to the specific type of the first task, the corresponding method for determining the first segmentation point is selected.

[0112] S1002: Determine a first gain corresponding to a first segmentation point of each edge computing node in at least one edge computing node.

[0113] Here, the first gain corresponding to the first split point of each edge computing node in at least one edge computing node is determined, wherein the first gain can represent the data complexity of the first histogram before and after the split and the change value of the data complexity of the split node, and the first gain can be calculated by entropy or Gini value. Entropy describes the degree of disorder of data. The larger the entropy, the higher the degree of disorder and the lower the corresponding purity. The algorithm expression corresponding to entropy is: Among them, p i It represents the proportion of the number of data in the i-th category. Assuming that there are two categories of data and the number of data in the two categories is the same, the purity of the corresponding split point is the lowest and the entropy is 1. If the data at the split point belongs to the same category, the purity of the corresponding distribution point is the highest and the entropy is 0. The algorithm expression corresponding to the Gini value is: Among them, p i It represents the proportion of the number of data in the i-th category. Similarly, taking the case where there are two categories of data and the number of data in the two categories is the same, when the number of data in the two categories is the same, the Gini value is 0.5. When the data at the corresponding split points belong to the same category, the Gini value is 0. The larger the Gini value, the lower the purity of the data.

[0114] S1003: Determine the first node quantity; the first node quantity represents the number of edge computing nodes whose corresponding first gains are less than the first gain corresponding to the set edge computing node.

[0115] Here, when the edge computing node determines the corresponding first segmentation point, each first segmentation point corresponds to a different segmentation scheme, and these segmentation schemes need to be verified by the Byzantine formula. In the embodiment of the present application, each edge computing node needs to confirm the segmentation scheme, and also needs to compare the verified scheme with the segmentation scheme of the first segmentation point corresponding to the edge computing node. Determine the number of first nodes, wherein the number of first nodes represents the number of edge computing nodes whose corresponding first gain is less than the first gain corresponding to the set edge computing node. The set edge computing node here is the Leader node selected based on the setting rule of the Byzantine formula, then the nodes other than the Leader node in the edge computing node are Follower nodes, and the Leader node will broadcast the segmentation scheme corresponding to the first segmentation point calculated by itself to the Follower node, and the Follower node will compare its corresponding first gain with the second gain corresponding to the Leader node. When the first gain of the Follower node is less than the second gain of the Leader node, it is deemed that the Follower node agrees with the segmentation scheme corresponding to the first segmentation point proposed by the Leader node. When the first gain of the Follower node is greater than the second gain of the Leader node, it is considered that the Follower node rejects the segmentation scheme corresponding to the first segmentation point proposed by the Leader node. The number of first nodes is determined by comparing the first gain of the Follower node with the second gain of the Leader node.

[0116] S1004: When the number of the first nodes is greater than or equal to a first set threshold, store the set first split point of the first edge node in a newly created block.

[0117] Here, when the number of first nodes is greater than or equal to the first set threshold, for example, when the number of first nodes is greater than or equal to two-thirds of the number of all edge computing nodes, it is deemed that most Follower nodes agree with the splitting scheme corresponding to the first split point of the Leader node. Then the first split point of the Leader node is stored in the newly created block to complete the training of a branch of the tree structure model.

[0118] In one embodiment, when the number of the first nodes is less than the set threshold, the method further includes:

[0119] A third edge computing node among at least one third edge computing node is updated to the set edge computing node; the third edge computing node represents an edge computing node whose corresponding first gain is greater than the first gain corresponding to the set edge computing node.

[0120] Here, when the number of first nodes is less than the set threshold, that is, most of the Follower nodes do not agree with the splitting scheme corresponding to the first segmentation point of the Leader node. In this case, one of the at least one third edge computing nodes is updated to the set edge computing node, wherein the third edge computing node represents an edge node whose corresponding first gain is greater than the first gain corresponding to the set edge computing node, that is, a new Leader node is selected from the Follower nodes that reject the splitting scheme corresponding to the first segmentation point of the previous Leader node. In practical applications, the Follower nodes that reject the splitting scheme corresponding to the first segmentation point of the Leader node are randomly set to a suspended working time period, and when the Follower node that resumes working first is used as the new Leader node, the previous Leader node will be transformed into a Follower node. After the new Leader node is determined, the splitting scheme corresponding to the first segmentation point of the Leader node is broadcast to other Follower nodes, and the splitting scheme proposed by the new Leader node is continuously verified through the Follower nodes.

[0121] In one embodiment, the method further comprises:

[0122] When the first setting condition is met, the model training is stopped; wherein,

[0123] The first setting condition is any one of the following:

[0124] The amount of second data contained in the first histogram received in the first edge computing node is less than a second set threshold;

[0125] The first gain corresponding to the first edge computing node and the first gain corresponding to the set edge computing node are both less than a third set threshold;

[0126] The depth of the tree structure model generated by training is equal to or greater than the maximum depth specified by the first task.

[0127] Here, when the first set condition is met, the model training is stopped, and the model submitted by the first edge computing node to the blockchain is used as the training result of the first task, wherein the first set condition can be that the amount of second data contained in the first histogram received by the first edge computing node is less than the second set threshold value. Here, since the first edge computing node can receive the first histogram uploaded by the matched multiple IoT devices as training samples, the first histogram can record the distribution of the first data collected by the IoT devices, so that the amount of data used as the data sample for model training can be obtained from the first histogram. When the amount of second data contained in the first histogram received by the first edge computing node is too small, the split proposal is easy to strengthen the noise data, and because the amount of second data is too small, the complexity of the decision tree growth will be reduced, so that the influence of overfitting can be reduced to a certain extent. Another condition for stopping model training can be that the first gain corresponding to the first edge computing node and the first gain corresponding to the set edge computing node are both less than the third set threshold value, wherein the size of the first gain can represent the complexity of the data, and when the first gain is too small, it indicates that the data purity is relatively large. The last condition for stopping model training is that the depth of the tree structure model generated by training is greater than or equal to the maximum depth specified in the first task. In other words, the tree structure model generated by training has met the needs of the IoT service provider, so the model training is stopped.

[0128] In the above embodiment, model training is performed by using the histogram uploaded by the IoT device received by the edge computing node, and the model training is performed on the edge computing node side. In addition, the histogram data is exchanged under the condition of constant communication volume, which can improve the data processing efficiency and transmission efficiency within limited resources, thereby helping to improve the effect of model training. In the process of model training, the effect of model training can be improved by integrating the decision tree verification algorithm with the Byzantine consensus.

[0129] In order to implement the model training method of the embodiment of the present invention, the embodiment of the present invention also provides a model training device, such as Fig.11 As shown, the device comprises:

[0130] An acquisition unit 1101 is used to acquire at least one first data based on a first task published in a blockchain; the first task represents a task of training a tree structure model; and the first data represents data collected by an IoT device;

[0131] A first generating unit 1102 is configured to generate a first histogram according to the at least one first data; the first histogram represents the distribution of the first data;

[0132] The sending unit 1103 is configured to send the first histogram to the first edge computing node, so that the first edge computing node performs training of the tree structure model in the first task based on the received histogram.

[0133] In one embodiment, when generating the first histogram according to the at least one first data, the first generating unit 1102 is further configured to:

[0134] According to the set first segmentation point, the at least one first data is divided into a first data set and a second data set;

[0135] A first histogram is generated according to the first data set and the second data set.

[0136] In one embodiment, the device is further used for:

[0137] In the case where there is second data, determining a first interval in which the second data falls in the first histogram; the second data represents data newly collected by the Internet of Things device;

[0138] The first histogram is updated according to the first interval and a first data amount of the second data.

[0139] In one embodiment, the device is further used for:

[0140] In the case where the first interval corresponding to the second data exceeds the interval range of the first histogram, a second interval and a third interval are determined; the second interval represents the interval with the smallest number of samples in the first histogram; the third interval represents the interval with the smallest number of samples in the intervals adjacent to the second interval;

[0141] The second interval and the third interval are combined in the first histogram to generate a fourth interval.

[0142] In one embodiment, before sending the first histogram to the first edge computing node, the sending unit 1103 is further configured to:

[0143] Reporting first information to the first edge computing node; wherein,

[0144] The first information represents device information of the IoT device; the first edge node is paired with the IoT device based on the first information.

[0145] In one embodiment, after generating the first histogram according to the at least one first data, the generating unit 1102 is further configured to:

[0146] The data statistical information recorded in the first histogram is stored.

[0147] In one embodiment, the device is further used for:

[0148] Based on the Laplace mechanism, noise of a set intensity is added to the first histogram.

[0149] In actual application, the acquisition unit 1101, the first generation unit 1102, and the sending unit 1103 can be implemented by a processor in the model training device. Of course, the processor needs to run the program stored in the memory to implement the functions of the above-mentioned program modules.

[0150] It should be noted that the above Fig.11 When the model training device provided in the embodiment performs model training, only the division of the above-mentioned program modules is used as an example. In practical applications, the above-mentioned processing can be assigned to different program modules as needed, that is, the internal structure of the device is divided into different program modules to complete all or part of the processing described above. In addition, the model training device provided in the above embodiment and the model training method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0151] The present application also provides another model training device, such as Fig.12 As shown, the device comprises:

[0152] The receiving unit 1201 is used to receive at least one first histogram; the first histogram represents a histogram uploaded by an IoT device matching each edge computing node in at least one edge computing node; the first histogram is generated by the IoT device according to at least one first data obtained by the first task; the first task represents a task of training a tree structure model based on a first root node;

[0153] The second generating unit 1202 is used to merge the at least one first histogram to generate a second histogram;

[0154] The training unit 1203 is used to train the tree structure model based on the second histogram through Byzantine consensus and decision tree verification algorithm.

[0155] In one embodiment, when the receiving unit 1201 receives at least one first histogram, the device is further configured to:

[0156] Receive first information reported by a first Internet of Things device; the first information represents device information of the first Internet of Things device;

[0157] Authenticating the first IoT device based on the first information, and pairing with the first IoT device after the authentication is passed;

[0158] In a paired state with the first Internet of Things device, a first histogram uploaded by the first Internet of Things device is received.

[0159] In one embodiment, when the second generating unit 1202 performs the merging process on the at least one histogram to generate the second histogram, it is further configured to:

[0160] According to the ring global protocol, a first histogram uploaded by a second Internet of Things device is obtained from at least one second edge computing node; the second Internet of Things device represents other Internet of Things devices other than the first Internet of Things device matching the first edge node.

[0161] In one embodiment, when the training unit 1203 trains the tree structure model based on the second histogram through the Byzantine consensus and decision tree verification algorithm, it is further used to:

[0162] Determine, according to the task type of the first task, a first segmentation point corresponding to each edge computing node in the at least one edge computing node; the first segmentation point represents a segmentation point of at least one first data carried in the second histogram;

[0163] Determine a first gain corresponding to a first segmentation point of each edge computing node in at least one edge computing node;

[0164] Determine the first number of nodes; the first number of nodes represents the number of edge computing nodes whose corresponding first gains are less than the first gain corresponding to the set edge computing node;

[0165] When the number of the first nodes is greater than or equal to a first set threshold, the set first segmentation point of the first edge node is stored in the newly created block.

[0166] In one embodiment, when the number of the first nodes is less than the set threshold, the training unit 1203 is further configured to:

[0167] A third edge computing node among at least one third edge computing node is updated to the set edge computing node; the third edge computing node represents an edge computing node whose corresponding first gain is greater than the first gain corresponding to the set edge computing node.

[0168] In one embodiment, the device is further used for:

[0169] When the first setting condition is met, the model training is stopped; wherein,

[0170] The first setting condition is any one of the following:

[0171] The amount of second data contained in the first histogram received by the first edge computing node is less than a second set threshold;

[0172] The first gain corresponding to the first edge computing node and the first gain corresponding to the set edge computing node are both less than a third set threshold;

[0173] The depth of the tree structure model generated by training is equal to or greater than the maximum depth specified by the first task.

[0174] In actual application, the receiving unit 1201, the second generating unit 1202, and the training unit 1203 can be implemented by a processor in the model training device. Of course, the processor needs to run the program stored in the memory to implement the functions of the above program modules.

[0175] It should be noted that the above Fig.12 When the model training device provided in the embodiment performs model training, only the division of the above-mentioned program modules is used as an example. In practical applications, the above-mentioned processing can be assigned to different program modules as needed, that is, the internal structure of the device is divided into different program modules to complete all or part of the processing described above. In addition, the model training device provided in the above embodiment and the model training method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0176] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiment of the present application, the embodiment of the present application further provides an electronic device, Fig.13 Schematic diagram of the hardware structure of the electronic device of the present application embodiment. Fig.13 As shown, the electronic equipment includes:

[0177] Communication interface 1, capable of exchanging information with other devices such as network devices;

[0178] The processor 2 is connected to the communication interface 1 to realize information interaction with other devices, and is used to execute the model training method provided by one or more technical solutions when running the computer program. The computer program is stored in the memory 3.

[0179] Of course, in actual application, the various components in the electronic device are coupled together through the bus system 4. It can be understood that the bus system 4 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 4 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Fig.13 Various buses are labeled as bus system 4.

[0180] The memory 3 in the embodiment of the present application is used to store various types of data to support the operation of the electronic device. Examples of such data include: any computer program used to operate on the electronic device.

[0181] It can be understood that the memory 3 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAM bus random access memory (DRRAM, Direct Rambus Random Access Memory).The memory 3 described in the embodiments of the present application is intended to include but is not limited to these and any other suitable types of memories.

[0182] The method disclosed in the above embodiment of the present application can be applied to the processor 2, or implemented by the processor 2. The processor 2 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 2 or the instruction in the form of software. The above processor 2 may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 2 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, which is located in the memory 3, and the processor 2 reads the program in the memory 3 and completes the steps of the above method in combination with its hardware.

[0183] When the processor 2 executes the program, the corresponding processes in the various methods of the embodiments of the present application are implemented, which will not be repeated here for the sake of brevity.

[0184] In an exemplary embodiment, the present application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, for example, a memory 3 storing a computer program, and the computer program can be executed by a processor 2 to complete the steps of the aforementioned method. The computer-readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface storage, optical disk, or CD-ROM.

[0185] In the several embodiments provided in the present application, it should be understood that the disclosed devices, terminals and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0186] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0187] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be separately configured as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0188] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium, which, when executed, executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, disks or optical disks.

[0189] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.

[0190] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A model training method, characterized in that: Applied to an IoT device, the method comprises: Based on a first task published by an IoT service provider in a blockchain, obtaining at least one first data; the first task represents a task of training a tree structure model; the first data represents data collected by the IoT device; Generate a first histogram according to the at least one first data; the first histogram represents the distribution of the first data; The first histogram is sent to a first edge computing node, so that the first edge computing node generates a second histogram based on the received first histogram, and trains the tree structure model in the first task based on the second histogram and the initialization parameters obtained from the blockchain.

2. The method according to claim 1, characterized in that: The step of generating a first histogram according to the at least one first data comprises: According to the set first segmentation point, the at least one first data is divided into a first data set and a second data set; A first histogram is generated according to the first data set and the second data set.

3. The method according to claim 2, characterized in that The method further comprises: In the case where there is second data, determining a first interval in which the second data falls in the first histogram; the second data represents data newly collected by the Internet of Things device; The first histogram is updated according to the first interval and a first data amount of the second data.

4. The method according to claim 3, characterized in that The method further comprises: In the case where the first interval corresponding to the second data exceeds the interval range of the first histogram, a second interval and a third interval are determined; the second interval represents the interval with the smallest number of samples in the first histogram; the third interval represents the interval with the smallest number of samples in the intervals adjacent to the second interval; The second interval and the third interval are combined in the first histogram to generate a fourth interval.

5. The method according to claim 1, characterized in that Before sending the first histogram to the first edge computing node, the method further includes: Reporting first information to the first edge computing node; wherein, The first information represents device information of the Internet of Things device; the first edge computing node is paired with the Internet of Things device based on the first information.

6. The method according to claim 1, characterized in that After generating the first histogram according to the at least one first data, the method further includes: The data statistical information recorded in the first histogram is stored.

7. The method according to claim 2, characterized in that The method further comprises: Based on the Laplace mechanism, noise of a set intensity is added to the first histogram.

8. A model training method, characterized in that: Applied to a first edge computing node; the method comprises: Receive at least one first histogram; the first histogram represents a histogram uploaded by an IoT device matching each edge computing node in at least one edge computing node; the first histogram is generated by the IoT device according to at least one first data obtained by the first task; the first task represents a task of training a tree structure model based on a first root node, and is published in a blockchain by an IoT service provider; Performing merging processing on the at least one first histogram to generate a second histogram; Based on the second histogram and initialization parameters, the tree structure model is trained through Byzantine consensus and decision tree verification algorithm; the initialization parameters are obtained from the blockchain.

9. The method according to claim 8, characterized in that When receiving at least one first histogram, the method comprises: Receive first information reported by a first Internet of Things device; the first information represents device information of the first Internet of Things device; Authenticating the first IoT device based on the first information, and pairing with the first IoT device after the authentication is passed; In a paired state with the first Internet of Things device, a first histogram uploaded by the first Internet of Things device is received.

10. The method according to claim 8, characterized in that When the at least one histogram is merged to generate a second histogram, the method includes: According to the ring global protocol, a first histogram uploaded by a second Internet of Things device is obtained from at least one second edge computing node; the second Internet of Things device represents other Internet of Things devices other than the first Internet of Things device matching the first edge computing node.

11. The method according to claim 8, characterized in that The step of training the tree structure model based on the second histogram by using a Byzantine consensus and a decision tree verification algorithm includes: Determine, according to the task type of the first task, a first segmentation point corresponding to each edge computing node in the at least one edge computing node; the first segmentation point represents a segmentation point of at least one first data carried in the second histogram; Determine a first gain corresponding to a first segmentation point of each edge computing node in at least one edge computing node; Determine the first number of nodes; the first number of nodes represents the number of edge computing nodes whose corresponding first gains are less than the first gain corresponding to the set edge computing node; When the number of the first nodes is greater than or equal to a first set threshold, the set first segmentation point of the edge computing node is stored in a newly created block.

12. The method according to claim 11, characterized in that When the number of the first nodes is less than the set threshold, the method further includes: A third edge computing node among at least one third edge computing node is updated to the set edge computing node; the third edge computing node represents an edge computing node whose corresponding first gain is greater than the first gain corresponding to the set edge computing node.

13. The method according to any one of claims 8 to 12, characterized in that: The method further comprises: When the first setting condition is met, the model training is stopped; wherein, The first setting condition is any one of the following: The amount of second data contained in the first histogram received by the first edge computing node is less than a second set threshold; The first gain corresponding to the first edge computing node and the first gain corresponding to the set edge computing node are both less than a third set threshold; The depth of the tree structure model generated by training is equal to or greater than the maximum depth specified by the first task.

14. A model training device, characterized in that: include: An acquisition unit, configured to acquire at least one first data based on a first task published in the blockchain by an Internet of Things service provider; The first task represents the task of training a tree structure model; The first data represents data collected by the IoT device; A first generating unit, configured to generate a first histogram according to the at least one first data; The first histogram represents the distribution of the first data; A sending unit is used to send the first histogram to the first edge computing node, so that the first edge computing node generates a second histogram based on the received first histogram, and trains the tree structure model in the first task based on the second histogram and the initialization parameters obtained from the blockchain.

15. A model training device, characterized in that: include: A receiving unit, configured to receive at least one first histogram; The first histogram represents a histogram uploaded by an IoT device matched with each edge computing node of at least one edge computing node; The first histogram is generated by the IoT device according to at least one first data acquired by the first task; The first task represents a task of training a tree structure model based on the first root node, and is published in the blockchain by the IoT service provider; A second generating unit, configured to perform merging processing on the at least one first histogram to generate a second histogram; A training unit is used to train the tree structure model through a Byzantine consensus and a decision tree verification algorithm based on the second histogram and initialization parameters; the initialization parameters are obtained from the blockchain.

16. An electronic device, characterized in that: include: a processor and a memory for storing a computer program capable of being executed on the processor, Wherein, when the processor is used to run the computer program, it executes the steps of the method described in any one of claims 1 to 7 or 8 to 13.

17. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 or 8 to 13 are implemented.