Class identification method and device, rule base construction method and device and electronic equipment
The training data is perturbed and encrypted through differential privacy technology and searchable encryption technology, and an encryption rule base is constructed, which solves the problems of data leakage and insufficient security in the existing technology, and achieves an efficient and safe category identification process.
Patent Information
- Application Number
- CN202310214518.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-07
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2043-03-07
AI Technical Summary
The existing technology has the risk of data leakage when building the rule base, and the data security is poor, especially the difficulty in balancing the sequence length with data availability and privacy protection.
Using differential privacy technology and searchable encryption technology, by perturbing and encrypting the training data, we build an encryption rule base, generate query vectors and search keys, and use trapdoors and indexes for secure search and matching to ensure that the recognition accuracy is not reduced. Improve data security.
Effectively protect user privacy, reduce the risk of data leakage, and improve data security while maintaining recognition accuracy and search efficiency.
Smart Images

Figure CN118626519A
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and specifically to a category identification method and device, a rule base construction method and device, and an electronic device. Background Art
[0002] Big data technology is a technology for processing large-scale data, which covers data screening, data analysis, data mining and other aspects. With the rapid development of artificial intelligence in various applications, big data technology that complements artificial intelligence has gradually matured. Category recognition is one of the main application directions of artificial intelligence. At present, dimensionality reduction technology is usually used to process training data, reduce the dimension of training data to a fixed dimension, and then perturb and mine the fixed-dimensional training data to find the rule sequence to build a rule base. When category recognition is required, the rule base is searched and matched to obtain the recognition result. The current method of building a rule base and category recognition has the risk of data leakage and poor data security. Summary of the invention
[0003] The embodiments of the present application disclose a category identification method and device, a rule base construction method and device, an electronic device, and a storage medium, which can improve data security and reduce the risk of data leakage.
[0004] The present application embodiment discloses a category identification method, including:
[0005] Generate a query vector according to the data to be queried and the dictionary corresponding to the rule base; the rule base includes one or more encrypted rule sequences, each of which includes a category label and at least one data feature label, and the dictionary includes each category label and each data feature label in the rule base;
[0006] Generate a trapdoor according to the query vector and a search key corresponding to the rule base;
[0007] Determine a target rule sequence according to the trapdoor and the indexes corresponding to each of the rule sequences; wherein the index corresponding to the first rule sequence is generated according to the first rule sequence and the search key, and the first rule sequence is any of the rule sequences;
[0008] The ciphertext of the target rule sequence is decrypted to obtain the target category label contained in the target rule sequence, and the target category corresponding to the to-be-queried data is determined according to the target category label.
[0009] The present application embodiment discloses a category identification device, the device comprising:
[0010] A query vector generation module, used to generate a query vector according to the data to be queried and a dictionary corresponding to a rule base; the rule base includes one or more encrypted rule sequences, each of which includes a category label and at least one data feature label, and the dictionary includes each category label and each data feature label in the rule base;
[0011] A trapdoor generation module, used to generate a trapdoor according to the query vector and the search key corresponding to the rule base;
[0012] A retrieval module, used to determine a target rule sequence according to the trapdoor and the indexes corresponding to each of the rule sequences; wherein the index corresponding to the first rule sequence is generated according to the first rule sequence and the search key, and the first rule sequence is any of the rule sequences;
[0013] The decryption module is used to decrypt the ciphertext of the target rule sequence to obtain the target category label contained in the target rule sequence, and determine the target category corresponding to the data to be queried according to the target category label.
[0014] An embodiment of the present application discloses an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor implements the category identification method as described above.
[0015] An embodiment of the present application discloses a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the category identification method as described above is implemented.
[0016] The present application embodiment discloses a method for constructing a rule base, including:
[0017] Preprocessing the sample data set to obtain a first sequence set, wherein the first sequence set includes M sample sequences in numerical format, each of the sample sequences includes a category label and at least one data feature label; M is a positive integer;
[0018] Perturbing the first sequence set to obtain a second sequence set;
[0019] Performing frequent mining on the second sequence set to determine one or more regular sequences;
[0020] A rule base is constructed according to the one or more rule sequences, and the one or more rule sequences contained in the rule base are encrypted.
[0021] The present application embodiment discloses a rule base construction device, the device comprising:
[0022] A preprocessing module, used to preprocess the sample data set to obtain a first sequence set, wherein the first sequence set includes M sample sequences in numerical format, each of the sample sequences includes a category label and at least one data feature label; M is a positive integer;
[0023] a perturbation module, configured to perturb the first sequence set to obtain a second sequence set;
[0024] A mining module, configured to perform frequent mining on the second sequence set to determine one or more regular sequences;
[0025] A construction module is used to construct a rule base according to the one or more rule sequences, and encrypt the one or more rule sequences contained in the rule base.
[0026] An embodiment of the present application discloses an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor implements the rule base construction method as described above.
[0027] An embodiment of the present application discloses a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the rule base construction method as described above is implemented.
[0028] The embodiment of the present application discloses a category identification method and device, an electronic device, and a storage medium. A query vector is generated according to the dictionary corresponding to the data to be queried and the rule library; the rule library includes one or more encrypted rule sequences, each rule sequence includes a category label and at least one data feature label, and the dictionary includes each category label and each data feature label in the rule library; a trapdoor is generated according to the query vector and the search key corresponding to the rule library; a target rule sequence is determined according to the trapdoor and the index corresponding to each rule sequence; the ciphertext of the target rule sequence is decrypted to obtain the target category label contained in the target rule sequence, and the target category corresponding to the data to be queried is determined according to the target category label. In the embodiment of the present application, a query vector is generated using the dictionary of the rule library, and a search is performed in the rule library according to the trapdoor generated using the search key and the index corresponding to each rule sequence to find the target rule vector matching the query vector, and a searchable encryption technology is used to realize the search and matching of the encrypted rule library, so as to realize the secure retrieval and matching of the rule library without affecting the recognition accuracy, avoid the situation of data leakage in the rule library, improve data security, and reduce the risk of data leakage.
[0029] The embodiment of the present application discloses a method and device for constructing a rule base, an electronic device, and a storage medium, preprocessing a sample data set to obtain a first sequence set, perturbing the first sequence set to obtain a second sequence set, and then frequently mining the second sequence set to determine one or more rule sequences, and then constructing a rule base based on the one or more rule sequences, and encrypting the one or more rule sequences contained in the rule base. In the embodiment of the present application, the sample data set is converted into a first sequence set in a numerical format, and the first sequence set is perturbed, thereby enhancing the privacy of the data, and encrypting the constructed rule base, improving data security, and reducing the risk of data leakage. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0031] Figure 1 A schematic diagram of the process of building a rule base in related technologies;
[0032] Figure 2 An application scenario diagram of a category identification method and a rule base construction method in an embodiment;
[0033] Figure 3 is a flow chart of a category identification method in one embodiment;
[0034] Figure 4 A flowchart of a category identification method in another embodiment;
[0035] Figure 5 A flowchart of a category identification method in another embodiment;
[0036] Figure 6 is a flow chart of preprocessing a sample data set in one embodiment;
[0037] Figure 7 is a flow chart of perturbing a first sample sequence set in one embodiment;
[0038] Figure 8 A flowchart of frequently mining a second sample sequence set in one embodiment;
[0039] Fig. 9 A flowchart of a method for building a rule base in one embodiment;
[0040] Fig.10 is a block diagram of a category identification device in one embodiment;
[0041] Fig.11 A block diagram of a rule base construction device in one embodiment;
[0042] Fig.12 FIG. 4 is a structural block diagram of an electronic device in an embodiment. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0044] It should be noted that the terms "including" and "having" and any variations thereof in the embodiments of the present application and the accompanying drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.
[0045] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first sequence set may be referred to as a second sequence set, and similarly, a second sequence set may be referred to as a first sequence set. Both the first sequence set and the second sequence set are sequence sets, but they are not the same sequence set.
[0046] An introduction to some professional terms involved in this application:
[0047] Differential privacy: A cryptographic technique that aims to maximize the accuracy of data queries when querying from a statistical database while minimizing the chance of identifying its records.
[0048] Searchable encryption technology: a technology that allows ciphertext to be retrieved while ensuring security.
[0049] Trapdoor: refers to a secret entrance into a program, through which access can be gained without going through the usual security check access process.
[0050] Privacy budget: A parameter that controls the strength of data privacy protection. The smaller the privacy budget, the better the privacy protection effect, but the greater the noise added to the data, the smaller the research value of the disturbed data.
[0051] Global Sensitivity: The global sensitivity of a function represents the maximum change in the query results of the function when a data group is modified.
[0052] Support: It indicates the frequency of a data item appearing in the entire data set. The greater the support, the higher the frequency of the data item appearing.
[0053] The realization and application of artificial intelligence often rely on the analysis and mining of massive amounts of training data, and the collected training data often contains users' personal sensitive data. When using the rule base or artificial intelligence model built based on the training data, it is also easy to cause the user's privacy to be leaked. In related technologies, the risk of user privacy leakage can be reduced by using differential privacy technology to protect training data.
[0054] Figure 1 FIG. 1 is a flow chart of building a rule base in related technologies. Figure 1 As shown, in the related art, the method for constructing a rule base may mainly include the following steps:
[0055] Step 102: Perform dimensionality reduction processing on the sequences in the training data set.
[0056] Step 104: for each sequence in the training data set after the dimensionality reduction process, randomly select a data item for perturbation.
[0057] Step 106: construct a prefix tree based on the perturbed training data set.
[0058] Step 108: deeply traverse the prefix tree to mine a candidate sequence set.
[0059] Step 110, mining frequent sequences according to the candidate sequence set, and perturbing the support during the mining process.
[0060] Step 112: construct a rule base based on the frequent sequences obtained by mining.
[0061] In the related art, for a training data set in the form of a sequence, a dimensionality reduction technique can be used to reduce the dimensionality of the training data set, and the sequence in the training data set can be reduced to a fixed dimension. For example, the JL (Johnson-Lindenstrauss) dimensionality reduction technique can be used to construct a projection matrix based on the JL lemma, and the projection matrix can be used to reduce the sequences of different dimensions in the training data set to a fixed dimension. After the sequence in the training data set is reduced in dimensionality, for each sequence in the training data set after the dimensionality reduction, a data item can be randomly selected as the user's sensitive information, and the traditional random response mechanism can be used to perturb it. After the perturbation of the training data set is completed, a prefix tree can be constructed based on the perturbed training data set, and a candidate sequence set can be mined by deeply traversing the prefix tree, and frequent sequences can be mined from the candidate sequence set. At the same time, during the mining process, the support of the candidate sequence in the candidate sequence set is perturbed, and the candidate sequence whose support exceeds the threshold is determined as a frequent sequence, and a rule base is constructed. The rule base is stored in plain text, and when the rule base needs to be used for category recognition, the rule base in plain text is retrieved and matched.
[0062] Regarding the solution of using differential privacy technology to build a rule base in related technologies, there are mainly the following problems:
[0063] (1) For training data in sequence form, current solutions do not consider the relationship between sequence length and data availability. They simply convert sequences of different lengths into sequences of fixed dimension by means of dimensionality reduction, and simply use random response mechanisms to perturb the training data, resulting in reduced availability of sequence data after perturbation.
[0064] (2) The intermediate quantities (such as support) generated in the process of frequent sequence mining may still observe the user's data characteristics, resulting in indirect leakage of user privacy. In the related art, noise is added to the support of the candidate sequence during the frequent sequence mining process. This scheme ignores the situation where the threshold exposes user privacy, and the use of the traditional Laplace mechanism is likely to change the size relationship between the threshold and the support, resulting in an increase in the probability of false filtering, reducing the recognition accuracy of the rule base constructed subsequently, and having a significant impact on the availability of the classification results obtained by recognition;
[0065] (3) The rule base stores the sequence of rules that represent user data. If the rule base is stored in plain text, if the rule base is stolen by a malicious attacker, the user's private data will be directly exposed. The attacker can use the rule base to launch more targeted attacks. Currently, there is no effective protection for the rule base.
[0066] The embodiments of the present application disclose a category identification method and device, a rule base construction method and device, an electronic device, and a storage medium. Based on differential privacy technology and searchable encryption technology, effective data protection is achieved, which can improve data security and reduce the risk of data leakage.
[0067] Figure 2 FIG. 1 is an application scenario diagram of a category identification method and a rule base construction method in an embodiment. Figure 2 As shown, the category identification method can be applied to a terminal device 10, which may include but is not limited to a mobile phone, a wearable device (smart glasses, smart watches, etc.), a tablet computer, a laptop computer, a PC (Personal Computer), etc.; the rule base construction method can be applied to a terminal device 10 or a server 20, and the server 20 can be a single server or a server cluster composed of multiple servers. The category identification method and the rule base construction method can be applied to the same electronic device, such as both applied to a terminal device 10 such as a mobile phone, a wearable device, and a tablet computer; the category identification method and the rule base construction method can also be applied to different electronic devices respectively, such as the rule base construction method can be applied to a server 20, and the category identification method can be applied to a terminal device 10. After the server 20 has constructed the rule base, it can send the relevant data of the rule base to the terminal device 10, and the terminal device 10 can store it. The terminal device 10 can use the stored rule base for category identification.
[0068] In one embodiment, the electronic device may first construct a rule base. The electronic device may preprocess the sample data set to obtain a first sequence set, the first sequence set including M sample sequences in numerical format, each sample sequence including a category label and at least one data feature label, and M is a positive integer. The first sequence set may be perturbed to obtain a second sequence set, and then the second sequence set may be frequently mined to determine one or more rule sequences, and then a rule base may be constructed based on the one or more rule sequences, and one or more rule sequences contained in the rule base may be encrypted. The rule sequences in the rule base may be stored in the form of ciphertext.
[0069] In one embodiment, after the rule base is constructed, the electronic device can use the rule base for category identification. The electronic device can generate a query vector based on the data to be queried and the dictionary corresponding to the rule base; the rule base includes one or more encrypted rule sequences, each rule sequence includes a category label and at least one data feature label, and the dictionary includes each category label and each data feature label in the rule base. A trapdoor can be generated based on the query vector and the search key corresponding to the rule base; the target rule sequence is determined based on the trapdoor and the index corresponding to each rule sequence; wherein the index corresponding to the first rule sequence is generated based on the first rule sequence and the search key, and the first rule sequence is any rule sequence. The ciphertext of the target rule sequence is then decrypted to obtain the target category label contained in the target rule sequence, and the target category corresponding to the data to be queried is determined based on the target category label.
[0070] like Figure 3 As shown, in one embodiment, a category identification method is provided, which can be applied to electronic devices, which may include but are not limited to mobile phones, wearable devices (smart glasses, smart watches, etc.), tablet computers, laptops, PCs, etc. The category identification method may include the following steps:
[0071] Step 310: Generate a query vector according to the data to be queried and the dictionary corresponding to the rule base.
[0072] An encrypted rule base is stored in the electronic device. The rule base may include one or more encrypted rule sequences. Each rule sequence may include a category label and at least one data feature label. The category label may be used to characterize the category of data, and the data feature label may be used to characterize the data feature. A rule sequence includes a category label and at least one data feature label, and the at least one data feature label may be used to characterize the data feature corresponding to the category label. The label format of the category label and the data feature label may include but is not limited to any one of a numerical format, a character format, etc.
[0073] In the embodiment of the present application, the application scenario of the rule base for category recognition may not be limited, that is, the category type used by the rule base for recognition may not be limited, which mainly depends on the sample data set used in the process of building the rule base. For example, the rule base can be used to predict the user behavior (or user behavior recognition) of the terminal user, and each user behavior may belong to a category and correspond to a category label, such as watching videos, playing games, listening to music, reading novels, chatting and other user behaviors can correspond to different category labels respectively; for another example, the rule base can be used for scene recognition, and each scene may belong to a category and correspond to a category label, such as learning scenes, running scenes, walking scenes, working scenes and other life scene recognition, or indoor scenes, outdoor scenes, upstairs scenes, downstairs scenes and other positioning scene recognition, or backlight scenes, night scenes, portrait scenes, scenery scenes and other shooting scene recognition, etc.; for another example, the rule base can also be used for emotion category recognition, such as happy, disappointed, excited, crying and other emotion categories, but not limited to this.
[0074] In different application scenarios, the category labels and data feature labels contained in the rule base can represent different meanings. For example, the rule base can be applied to user behavior prediction, and each category label in the rule base can be used to represent different user behavior categories, and each data feature label can be used to represent different device status characteristics of the terminal device, such as time characteristics (such as what time), location characteristics (such as indoors or outdoors, whether it is at a permanent residence, at home or at work, etc.), battery status characteristics (such as remaining power, whether it is in a charging state, etc.), external device characteristics (such as the status of connected headphones, etc.), network connection characteristics (whether it is connected to Bluetooth, whether it is connected to Wi-Fi, etc.), but not limited to this; the rule sequence in the rule base can reflect the association between each user behavior category and the device status characteristics.
[0075] The electronic device can obtain the data to be queried, and the data to be queried may refer to data that needs to be categorized. In the related art, the rule base is stored in plain text, and the data to be queried can be converted into data feature tags to obtain a query sequence, and the query sequence is used to search and match in the rule base to find a target rule sequence that matches the query sequence. The category represented by the category tag contained in the target rule sequence is the target category corresponding to the data to be queried. In the embodiment of the present application, the rule base is stored in ciphertext, so it is impossible to directly use the data to be queried to search and match the rule base. The embodiment of the present application is based on searchable encryption technology to achieve secure search and matching of the encrypted rule base.
[0076] The electronic device can generate a query vector based on the data to be queried and the dictionary corresponding to the rule base. The dictionary corresponding to the rule base may include each category label and each data feature label in the rule base, that is, the dictionary may include all category labels and all data feature labels in the rule base, and the category labels and data feature labels contained in the dictionary may be arranged in sequence. For example, if the category label and the data feature label are in numerical format, the category labels and data feature labels contained in the dictionary may be arranged in order from small to large numerical values; or, if the category label and the data feature label are in character format, the category labels and data feature labels contained in the dictionary may be arranged in order according to the order of the first letter in the 26 letters, etc., but is not limited to this.
[0077] As an implementation method, the data to be queried may include one or more feature data items, each of which is a feature data. For example, the data to be queried includes "'Indoors', 'Headphones connected', 'Wi-Fi connected'", where three feature data items "Indoors", "Headphones connected", and "Wi-Fi connected" may be included. Each feature data item in the data to be queried may be converted into a corresponding target data feature label to obtain a query sequence, and the target data feature label included in the query sequence may be used as a keyword to search in a dictionary corresponding to the rule base to generate a query vector based on the search result. A label conversion relationship may be stored in an electronic device, and the label conversion relationship may be used to define a correspondence between data items and labels, including a correspondence between category data items and category labels, and a correspondence between feature data items and data feature labels. Based on the label conversion relationship, each feature data item in the data to be queried may be converted into a corresponding target data feature label to obtain a query sequence.
[0078] Exemplarily, the label conversion relationship may be as shown in Table 1.
[0079] Table 1
[0080] Label 1~24 25~26 27~28 29~33 34~35 36~37 meaning time Permanent place indoor Battery level Charging status Headphone status Label 38~39 40~41 42 43 44 …… meaning Bluetooth status Wi-Fi Status Watch Video Read the news Listen to music ……
[0081] Among them, 1 to 41 are data feature labels, 42 to 44 are category labels, 1 to 24 correspond to 24 hours one by one; 25 means at the permanent residence, 26 means not at the permanent residence; 27 means indoors, 28 means not indoors; 29 to 33 respectively represent the remaining power of 0% to 20%, 21% to 40%, 41% to 60%, 61% to 80%, 81% to 100%; 34 means in charging state, 35 means not in charging state; 36 means connected to headphones, 37 means not connected to headphones; 38 means connected to Bluetooth, 39 means not connected to Bluetooth; 40 means connected to Wi-Fi, 41 means not connected to Wi-Fi. It should be noted that Table 1 is only an example of a label conversion relationship and is not used to limit the specific label conversion relationship.
[0082] Step 320: Generate a trapdoor according to the query vector and the search key corresponding to the rule base.
[0083] The electronic device can store a search key corresponding to the rule base, which refers to a key that supports searchable encryption. A trapdoor can be generated based on the query vector and the search key corresponding to the rule base. The trapdoor can be used as an access entry to the rule base to achieve search and matching of the encrypted rule base.
[0084] Step 330: Determine the target rule sequence according to the trapdoors and the indexes corresponding to each rule sequence.
[0085] The electronic device may also store indexes corresponding to each rule sequence in the rule base, and the indexes corresponding to the rule sequence may be generated according to the rule sequence and the search key, and the indexes corresponding to each rule sequence may be used to characterize the sequence characteristics of each rule sequence. Taking the first rule sequence as an example, the first rule sequence may be any rule sequence, and the indexes corresponding to the first rule sequence are generated according to the first rule sequence and the search key.
[0086] According to the generated trapdoor and the index corresponding to each rule sequence in the rule base, each rule sequence can be searched and matched to find a target rule sequence matching the data to be queried. The target rule sequence matching the data to be queried may refer to the rule sequence in the rule base that is most similar to the query sequence obtained by converting the data to be queried.
[0087] As a specific implementation, the index corresponding to the first rule sequence can be generated based on the dictionary of the rule base, the first rule sequence and the search key. Since the trapdoor is generated based on the query vector and the search key, that is, the trapdoor is based on the query sequence, the dictionary and the search key, by using the trapdoor and the indexes corresponding to each rule sequence, the target rule sequence matching the data to be queried can be searched from the encrypted rule base, thereby ensuring the accuracy of the search.
[0088] Step 340 , decrypt the ciphertext of the target rule sequence to obtain the target category label contained in the target rule sequence, and determine the target category corresponding to the to-be-queried data according to the target category label.
[0089] The electronic device can decrypt the ciphertext of the target rule sequence according to a pre-stored decryption key to obtain the target rule sequence in plain text, and obtain the category label contained in the target rule sequence as the target category label. The target category label can be converted into corresponding category data, and the target category corresponding to the data to be queried can be determined according to the category data.
[0090] In some embodiments, the category labels in each rule sequence can be arranged according to a set arrangement position. For example, the category label can be arranged at the very end of the rule sequence, or the category label can be arranged at the very front of the rule sequence, etc., but not limited to this. The label item of the target rule sequence at the set arrangement position can be obtained, and the content of the label item is the target category label. The target category label is then converted into category data according to the label conversion relationship to determine the target category. For example, the label item at the very end of the target rule sequence can be obtained, and the content of the label item is "42", then the target category label is 42, then according to the label conversion relationship shown in Table 1, the target category can be "watch video".
[0091] As a specific implementation, the rule base can be applied to user behavior prediction, the category label can be used to characterize the user behavior category, and the data feature label can be used to characterize the device status feature. The data to be queried may include device status data, and the device status data may include one or more of time information, location information, battery status information, device information of external devices, network connection information, etc. Among them, the location information may include geographic location information, whether it is a permanent residence, whether it is indoors, etc.; the battery status information may include the remaining power, whether it is in a charging state, whether it is in a power saving mode, etc.; the device information of the external device may include whether the external device is connected, the device type of the connected external device, etc.; the network connection information may include whether Bluetooth is connected, whether Wi-Fi is connected, the current network signal strength, etc.
[0092] The electronic device can collect device status data, and use the collected device status data as the data to be queried, search and match in the encrypted rule base, and predict user behavior. The data to be queried can be converted into a query sequence first. For example, if the data to be queried is "indoors, connected to headphones, connected to Wi-Fi", it can be converted into a query sequence 27-36-40. The query sequence can be used as a keyword to search in the dictionary corresponding to the rule base and generate a query vector. For example, according to the dictionary, a query vector can be generated. A trapdoor can be generated based on the query vector and the search key, and the target rule sequence can be determined based on the trapdoor and the index corresponding to each rule sequence, and then the ciphertext of the target rule sequence is decrypted to obtain the target category label contained in the target rule sequence. For example, if the target category label is 42, it can be determined that the target category corresponding to the data to be queried is "watching videos". Therefore, based on the device status data "indoors, connected to headphones, connected to Wi-Fi", the electronic device can predict that the user's possible user behavior is "watching videos".
[0093] In some embodiments, after determining the target category corresponding to the data to be queried, a target operation can be performed according to the target category, and the target operation can be used to provide services corresponding to the target category. Taking user behavior prediction as an example, if the electronic device predicts that the user behavior is "watching videos" based on the collected device status data, a video recommendation operation can be performed, and the video recommendation operation can be used to recommend currently popular video data to the user, or video data that matches the user's interests. While protecting user privacy, more targeted services are provided to users to improve user experience.
[0094] In an embodiment of the present application, a query vector is generated using a dictionary of the rule base, and a search is performed in the rule base based on a trapdoor generated using a search key and an index corresponding to each rule sequence to find a target rule vector that matches the query vector. Searchable encryption technology is used to search and match the encrypted rule base, and secure retrieval and matching of the rule base is achieved without affecting recognition accuracy, thereby avoiding data leakage in the rule base, improving data security, and reducing the risk of data leakage.
[0095] like Figure 4 As shown, in another embodiment, a category identification method is provided, which can be applied to the above electronic device. The category identification method may include the following steps:
[0096] Step 402, convert the data to be queried into N target data feature labels; N is a positive integer.
[0097] The data to be queried may include N feature data items, and the N feature data items may be converted into corresponding target data feature labels to obtain N target data feature labels. Further, the N feature data items may be converted into N target data feature labels according to the label conversion relationship.
[0098] Step 404: determine the arrangement position corresponding to each target data feature label in the dictionary, and generate a query vector according to the arrangement positions corresponding to the N target data feature labels.
[0099] After constructing the rule base, the electronic device can generate a dictionary corresponding to the rule base. The category labels and data feature labels contained in each rule sequence in the rule base can be extracted, the extracted category labels and data feature labels can be deduplicated, and the deduplicated category labels and data feature labels can be extracted in sequence to obtain a dictionary corresponding to the rule base. Optionally, the arrangement of each category label and each data feature label in the dictionary is not limited here. For example, if the category label and the data feature label are in numerical format, the category labels and data feature labels contained in the dictionary can be arranged in order from small to large. The dictionary length of the dictionary is the total number of category labels and data feature labels contained in the dictionary.
[0100] Exemplarily, the rule sequence included in the rule base may be as shown in Table 2.
[0101] Table 2
[0102] Sequence number Rule Sequence <![CDATA[f 1 ]]> 27-36-42 <![CDATA[f 2 ]]> 27-36-40-42 <![CDATA[f 3 ]]> 26-41-43 <![CDATA[f 4 ]]> 26-37-41-43
[0103] The data feature labels and category labels contained in each rule sequence contained in the rule base can be extracted as keywords, and the obtained keywords are deduplicated, and a dictionary ψ is generated based on the deduplicated keywords. Taking the rule base shown in Table 2 as an example, the rule sequence f can be extracted. 1 ~f 4 The data feature labels and category labels contained in are used as keywords: 27, 36, 42, 27, 36, 40, 42, 26, 41, 43, 26, 37, 41, 43. After removing duplicate keywords, the remaining keywords include: 27, 36, 42, 40, 26, 41, 43, 37, which can be arranged in order from small to large values to obtain a dictionary ψ = [26, 27, 36, 37, 40, 41, 42, 43], and the dictionary length Sizeψ = 8.
[0104] After the data to be queried is converted into N target data feature labels, a query vector can be generated according to the dictionary corresponding to the rule base and the N target data feature labels. The arrangement position corresponding to each target data feature can be determined in the dictionary, and a query vector can be generated according to the arrangement positions corresponding to the N target data feature labels. The vector length of the query vector can be the same as the dictionary length of the dictionary. The N target data feature labels can be used as keywords to search in the dictionary. If the target data feature label exists in the dictionary, the arrangement position of the target data feature label in the dictionary is determined, and the item in the query vector whose corresponding position is the same as the arrangement position is set to the first value. The other items in the query vector, except for the items set to the first value, can be set to the second value. For example, the data to be queried is converted into 3 target data feature labels: 27, 36, and 40, and their arrangement positions in the dictionary are 2, 3, and 5, respectively. Then, the second, third, and fifth items in the query vector can be set to 1, and the other items can be set to 0 to obtain the query vector.
[0105] Step 406: Generate a trapdoor according to the query vector and the search key corresponding to the rule base.
[0106] In some embodiments, the search key corresponding to the rule base may include a reversible diagonal matrix and an inverse matrix of the reversible diagonal matrix, and the order of the reversible diagonal matrix may be the same as the dictionary length of the dictionary. A reversible diagonal matrix H having an order equal to the dictionary length may be randomly generated, and an inverse matrix H- may be calculated based on the reversible diagonal matrix H. 1 , the reversible diagonal matrix H and the inverse matrix H-1 Used as a search key for the rule base. For example, the random generation order = dictionary length Size ψ =8 reversible diagonal matrix H:
[0107]
[0108] The inverse matrix H can be calculated based on the reversible diagonal matrix H -1 :
[0109]
[0110] In some embodiments, a trapdoor may be generated based on the query vector and the inverse matrix of the reversible diagonal matrix. The trapdoor may be the dot product of the inverse matrix of the reversible diagonal matrix and the query vector. The calculation formula of the trapdoor may be as shown in formula (1):
[0111]
[0112] Among them, Γ represents the trapdoor, H -1 represents the inverse matrix of a reversible diagonal matrix, Represents the query vector.
[0113] Step 408: Calculate the query score corresponding to each rule sequence according to the trapdoor and the index corresponding to each rule sequence.
[0114] In some embodiments, the index corresponding to the first rule sequence is generated according to the identification vector and the search key of the first rule sequence, the first rule sequence is any rule sequence in the rule base, the identification vector of the first rule sequence can be used to characterize the first rule sequence, and different rule sequences have different identification vectors. The identification vector corresponding to each rule sequence can be generated first, and then the index corresponding to each rule sequence is generated according to the identification vector and the search key corresponding to each rule sequence.
[0115] As a specific implementation, the identification vector of the first rule sequence is generated according to the arrangement position of the category labels and data feature labels contained in the first rule sequence in the dictionary, and the vector length of the identification vector is the same as the dictionary length of the dictionary. The category labels and data feature labels contained in the first rule sequence can be used as keywords to search in the dictionary. If the category label or data feature label exists in the dictionary, the arrangement position of the category label or data feature label in the dictionary is determined, and the item in the identification vector whose corresponding position is the same as the arrangement position is set to the first value. The other items in the directional vector, except for the items set to the first value, can be set to the second value. For example, if the first rule sequence is 27-36-42, and the arrangement positions in the dictionary are 2, 3, and 7 respectively, then the 2nd, 3rd, and 7th items in the query vector can be set to 1, and the other items can be set to 0, and the identification vector [0,1,1,0,0,0,1,0] can be obtained.
[0116] Exemplarily, taking the rule base shown in Table 2 as an example, the dictionary ψ=[26, 27, 36, 37, 40, 41, 42, 43], the identification vectors corresponding to each rule sequence can be generated as shown in Table 3.
[0117] Table 3
[0118] Sequence number Rule Sequence Logo vector <![CDATA[f 1 ]]> 27-36-42 [0,1,1,0,0,0,1,0] <![CDATA[f 2 ]]> 27-36-40-42 [0,1,1,0,1,0,1,0] <![CDATA[f 3 ]]> 26-41-43 [1,0,0,0,0,1,0,1] <![CDATA[f 4 ]]> 26-37-41-43 [1,0,0,1,0,1,0,0]
[0119] The search key includes a reversible diagonal matrix and an inverse matrix of the reversible diagonal matrix. The index corresponding to the first regular sequence is generated based on the transposed matrix of the first regular sequence and the reversible diagonal matrix. Further, the index corresponding to the first regular sequence is generated based on the identification vector of the first regular sequence and the transposed matrix of the reversible diagonal matrix. The index corresponding to the first regular sequence can be the dot product result of the transposed matrix of the reversible diagonal matrix and the identification vector of the first regular sequence. The formula for generating the index corresponding to the regular sequence can be shown as formula (2):
[0120]
[0121] in, Represents a regular sequence f i The corresponding identity vector, H T Represents the transposed matrix of the reversible diagonal matrix H, Index i represents f i Corresponding indexes. Exemplarily, taking the identification vectors of the rule sequences shown in Table 3 as an example, the generated indexes corresponding to the rule sequences may be as shown in Table 4.
[0122] Table 4
[0123] Sequence number index <![CDATA[f 1 ]]> [0,2,2,0,0,0,2,0] <![CDATA[f 2 ]]> [0,2,2,0,2,0,2,0] <![CDATA[f 3 ]]> [0,2,2,0,2,0,2,0] <![CDATA[f 4 ]]> [0,2,2,0,2,0,2,0]
[0124] For each rule sequence in the rule base, the query score corresponding to the rule sequence can be calculated based on the trapdoor and the index corresponding to the rule sequence. The higher the query score of the rule sequence, the better it matches the data to be queried. Taking the first rule sequence as an example, the query score corresponding to the first rule sequence can be the dot product of the index corresponding to the first rule sequence and the trapdoor. The calculation formula for the query score corresponding to the rule sequence can be shown as formula (3):
[0125]
[0126] Among them, score i Rule sequence f i The corresponding query score.
[0127] Step 410: determine the rule sequence with the highest query score as the target rule sequence.
[0128] The query scores corresponding to the various rule sequences may be compared, and the rule sequence with the highest query score may be determined, and the rule sequence with the highest query score may be determined as the target rule sequence.
[0129] Table 5
[0130] Sequence number Query score <![CDATA[f 1 ]]> 1 <![CDATA[f 2 ]]> 1.5 <![CDATA[f 3 ]]> 0 <![CDATA[f 4 ]]> 0
[0131] Among them, the rule sequence f 2 The corresponding query score is the highest, then the rule sequence f can be determined 2 is the target rule sequence that matches the data to be queried.
[0132] Step 412, decrypt the ciphertext of the target rule sequence to obtain the target category label contained in the target rule sequence, and determine the target category corresponding to the data to be queried according to the target category label.
[0133] Take the target rule sequence as the rule sequence f 2 For example, we can use the rule sequence f 2 Decrypt the ciphertext to get the regular sequence f 2 :27-36-40-42. The regular sequence f can be obtained 2 The category label 42 determines that the target category corresponding to the to-be-queried data is “watching videos”.
[0134] In some embodiments, after constructing the rule base, an encryption key and a decryption key can be generated, and each rule sequence in the rule base can be encrypted according to the encryption key. When performing category identification, after finding the target rule sequence that matches the data to be queried, the ciphertext of the target rule sequence can be decrypted according to the decryption key.
[0135] As a specific implementation, the encryption key may include an encryption key pair, the decryption key may include a decryption key pair, the encryption key pair may include a first encryption key and a second encryption key, and the decryption key may include a first decryption key and a second decryption key. A first prime number and a second prime number may be randomly generated, and a first encryption key may be determined based on the first prime number and the second prime number, and a third prime number may be randomly selected as the second encryption key, and the third prime number may satisfy a numerical condition associated with the first encryption key. A first decryption key may be determined based on the first encryption key and the second encryption key, and the first encryption key may be used as the second decryption key.
[0136] Furthermore, a first prime number γ and a second prime number δ can be randomly generated, and the product of the first prime number and the second prime number is used as a first encryption key, the first encryption key n = γ × δ, then in, The Euler function representing the first encryption key n. A third prime number λ can be randomly selected as the second encryption key, and the third prime number λ satisfies the numerical condition: and in, Represents λ and The first decryption key v can be determined according to the first encryption key n and the second encryption key λ, and the first decryption key v satisfies The second decryption key may be equal to the first encryption key n. An encryption key pair (n, λ) and a decryption key pair (v, n) may be obtained.
[0137] Each rule sequence in the rule base can be encrypted according to the encryption key pair (n, λ), and the encrypted ciphertext in, Represents a regular sequence f i The plain text content of Represents the rule sequence f i Encrypted ciphertext.
[0138] After determining the target rule sequence, the ciphertext of the target rule sequence can be decrypted according to the decryption key pair (v, n). The decryption formula can be shown as formula (4):
[0139]
[0140] Among them, f max represents the target rule sequence, represents the ciphertext of the target rule sequence, Represents the plaintext content of the target rule sequence.
[0141] In the embodiment of the present application, the rule base is protected and securely retrieved using a searchable encryption method, and the ciphertext retrieval method is used, which not only ensures the privacy of the user and improves data security, but also does not affect the recognition accuracy of the category. In addition, since the dictionary length corresponding to the rule base is small, the search and matching efficiency can be improved, which has obvious efficiency advantages compared to traditional cryptographic methods.
[0142] Before using the encrypted rule base for category recognition, differential privacy technology is used to build the rule base and encrypt the rule base. Figure 5 As shown, in another embodiment, a category identification method is provided, which can be applied to the above electronic device. The method may include the following steps:
[0143] Step 502: preprocess the sample data set to obtain a first sequence set. The first sequence set includes M sample sequences in numerical format, each sample sequence includes a category label and at least one data feature label; M is a positive integer.
[0144] The sample data set can be used as training data for building a rule base. The sample data set may include a large number of data elements. Each data element may include a category data item and at least one feature data item. The category data item is used to characterize the category corresponding to the data element, and the feature data item is used to characterize the data feature corresponding to the data element. Different sample data sets can be used for rule bases applied to different scenarios.
[0145] For example, for a rule base applied to user behavior prediction, the data element in the sample data set may include at least one device state feature data item and a user behavior category data item. The format of each data element in the sample data set may be {"time", "whether in the permanent residence", "whether indoors", "battery level", "charging status", "headphone status", "Bluetooth status", "Wi-Fi status", "specific event"}, where "time", "whether in the permanent residence", "whether indoors", "battery level", "charging status", "headphone status", "Bluetooth status", "Wi-Fi status" are device state feature data items, and "specific event" is a user behavior category data item.
[0146] For example, the sample data set may include the following data elements:
[0147] {"9:00","null","Indoors","null","null","Headphones connected","null","Wi-Fi connected","Watching video"};
[0148] {"22:00","null","Indoors","93%","null","Headphones connected","null","Wi-Fi connected","Watching video"};
[0149] {"17:00","not at the usual place","not indoors","75%","null","headphones not connected","null","Wi-Fi is off","watching news"};
[0150] {"null","not at the usual place","not indoors","null","null","headphones connected","null","Wi-Fi off","watching news"};
[0151] {"8:00","not at residence","not indoors","null","null","headphones connected","Bluetooth connected","Wi-Fi off","listening to music"}.
[0152] In some embodiments, preprocessing the sample data set may include two stages: stage one, format conversion of the sample data set; stage two, data serialization, serializing each data in the data set obtained by format conversion. Figure 6 As shown, step 502, preprocessing the sample data set to obtain a first sequence set, may include steps 602-604.
[0153] Step 602, transform the sample data set according to the label conversion relationship to transform the category data items contained in each data element into corresponding category labels, and transform the feature data items contained in each data element into corresponding data feature labels, so as to obtain a data sequence corresponding to each data element.
[0154] The data elements in the sample data set can be in text format, and the category labels and data feature labels can be in numerical format. The data elements in text format can be converted into data sequences in numerical format. The label conversion relationship can define the correspondence between data items and labels, and each label can represent different data meanings. Based on the label conversion relationship, the category data items of each data element in the sample data set can be converted into corresponding category labels, and the feature data items contained in each data element can be converted into corresponding data feature labels. Assuming that the sample data set D contains X data elements, where X is a positive integer, the sample data set D in text format can be converted into a data set N in numerical format = {(r 11 , r 12 , ..., r 1l ), (r 21 , r 22 , ..., r 2l ),...,(r x1 , r x2 , ..., r xl )}, where (r x1 , r x2, ..., r xl ) is the data sequence corresponding to the Xth data element, r x1 、r x2 、r xl Etc. represent data feature labels or category labels.
[0155] Exemplarily, taking the label conversion relationship shown in Table 1 as an example, the sample data set containing 5 data elements in the above example can be converted into a data set N = {(9, 27, 36, 40, 42), (22, 27, 33, 36, 40, 42), (17, 26, 28, 32, 37, 41, 43), (26, 28, 36, 41, 43), (8, 26, 28, 36, 38, 41, 44)}.
[0156] Step 604: Generate M sample sequences according to the X data sequences corresponding to the X data elements to obtain a first sequence set including the M sample sequences; the sample sequence is a subsequence of any data sequence, and the M sample sequences are non-repetitive and include all subsequences of the X data sequences with category labels.
[0157] The sample data set includes X data elements. The M sample sequences included in the first sequence set are all subsequences with category labels in the X data sequences obtained by format conversion, and the arrangement order of each label item in the sample sequence is consistent with the arrangement order in the data sequence.
[0158] In some embodiments, for each category, all data sequences corresponding to the category can be found, and all data feature labels contained in each data sequence corresponding to the category are fully arranged and combined, and serialized according to the corresponding positions of each data feature label and category label in the data element, so as to obtain all subsequences with category labels corresponding to the category as sample sequences corresponding to the category. Taking the first category as an example, the first category can be any category, and the first category corresponds to the first category label. All data sequences corresponding to the first category can be found, that is, all data sequences containing the first category label can be found, and then all subsequences with the first category label can be determined from all data sequences containing the first category label, so as to obtain the sample sequence corresponding to the first category.
[0159] For example, taking the category label “42” in the dataset N={(9, 27, 36, 40, 42), (22, 27, 33, 36, 40, 42), (17, 26, 28, 32, 37, 41, 43), (26, 28, 36, 41, 43), (8, 26, 28, 36, 38, 41, 44)} as an example, we can first find the data sequence (9, 27, 36, 40, 42) containing the category label “42”. The data sequence (9, 27, 36, 40, 42) can be fully arranged and combined with the data feature labels "9", "27", "36", and "40" of the data sequence, and serialized according to the corresponding positions of the data feature labels "9", "27", "36", and "40" in the data element to obtain a subsequence containing the category label "42". The obtained subsequence can be shown in Table 6.
[0160] Table 6
[0161] Sequence number <![CDATA[s 1 ]]> <![CDATA[s 2 ]]> <![CDATA[s 3 ]]> <![CDATA[s 4 ]]> subsequence 9-42 27-42 36-42 40-42 Sequence number <![CDATA[s 5 ]]> <![CDATA[s 6 ]]> <![CDATA[s 7 ]]> <![CDATA[s 8 ]]> subsequence 9-27-42 9-36-42 9-40-42 27-36-42 Sequence number <![CDATA[s 9 ]]> <![CDATA[s 10 ]]> <![CDATA[s 11 ]]> <![CDATA[s 12 ]]> subsequence 27-40-42 36-40-42 9-27-36-42 9-27-40-42 Sequence number <![CDATA[s 13 ]]> <![CDATA[s 14 ]]> <![CDATA[s 15 ]]> subsequence 27-36-40-42 9-36-40-42 9-27-36-40-42
[0162] For the data sequence (22, 27, 33, 36, 40, 42), the same method can be used to obtain a subsequence containing the category label "42". If there are multiple identical subsequences in the same category, only one of the subsequences is retained, thereby obtaining a non-repeating sample sequence corresponding to each category. For example, for the data sequence (22, 27, 33, 36, 40, 42), repeated subsequences such as subsequences 27-42 and 27-36-42 can also be obtained, which can be directly discarded. After obtaining the sample sequence corresponding to each category, the sample sequence corresponding to each category can be added to the first sequence set T = {s 1 ,s 2 ,s 3 , ..., s M}.
[0163] As another implementation, all subsequences with category labels contained in the X data sequences may be directly determined, and the determined subsequences with category labels are deduplicated to obtain M sample sequences to form the first sequence set.
[0164] In an embodiment of the present application, a sample data set in text format can be converted into a sample sequence in numerical format, thereby increasing the privacy of the training data and improving data security.
[0165] Step 504: perturb the first sequence set to obtain a second sequence set.
[0166] In an embodiment of the present application, a rule base may be constructed based on differential privacy technology, and noise may be added to a first sequence set to perturb the first sequence set to obtain a second sequence set.
[0167] As an implementation method, for each sample sequence in the first sequence set, a specific number of label items may be randomly selected from the sample sequence for perturbation. For example, one label item may be randomly selected from each sample sequence for perturbation. Perturbing the label item may be randomly changing the value of the label item. For example, if the sample sequence is "29-42", the label item "29" may be selected for perturbation, and a value may be randomly selected from 29 to 33.
[0168] As another implementation, a target number of sample sequences may be randomly selected from the first sequence set, and each label item of the selected sample sequence may be perturbed. For example, three sample sequences 27-40-42, 9-27-36-40-42, and 36-38-41-44 may be randomly selected, and each label item in the three random sample sequences may be perturbed.
[0169] like Figure 7 As shown, in one embodiment, step 504 perturbs the first sequence set to obtain the second sequence set, which may include steps 702-704.
[0170] Step 702: Determine the disturbance probability corresponding to each sample sequence according to the sequence length of each sample sequence.
[0171] The sequence length of a sample sequence refers to the number of label items contained in the sample sequence, that is, the sum of the number of data feature labels and category labels contained in the sample sequence. For example, the sample sequence is 27-40-42, and the sequence length is 3; the sample sequence is 36-38-41-44, and the sequence length is 5. The perturbation probability corresponding to each sample sequence can be determined based on the sequence length of each sample sequence. The more perturbation probabilities corresponding to a sample sequence, the greater the possibility of being selected for perturbation.
[0172] In some embodiments, for each category, the perturbation probability of each sample sequence corresponding to the category can be determined according to the sequence length of each sample sequence corresponding to the category. Taking the first category as an example, the first category can be any category, the first category corresponds to the first category label, the sequence length of each first sample sequence corresponding to the first category label can be obtained, the first sample sequence is a sample sequence containing the first category label, the total sequence length corresponding to the first category label can be determined according to the sequence length of each first sample sequence, and then the perturbation score corresponding to each first sample sequence is determined according to the sequence length of each first sample sequence and the total length of the sequence, and the perturbation probability corresponding to each first sample sequence can be determined according to the perturbation score corresponding to each first sample sequence based on the exponential basis.
[0173] The sum of the sequence lengths of each first sample sequence can be calculated to obtain the total sequence length corresponding to the first category label. As a specific implementation, the total sequence length can be calculated using formula (5):
[0174]
[0175] Among them, r i Represents the category label; Indicates that it contains the category label r i The sample sequence s j The sequence length, Indicates that it contains the category label r i The number of sequences of sample sequences, Represents the category label r i The total length of the corresponding sequence.
[0176] After determining the total length of the sequence corresponding to the first category label, the disturbance score corresponding to each first sample sequence can be determined according to the sequence length of each first sample sequence and the total length of the sequence. The disturbance score can be positively correlated with the disturbance probability. The sample sequence with a higher disturbance score is more likely to be selected for disturbance. Optionally, the longer the sequence length of the first sample sequence is, the higher the corresponding disturbance score can be, which increases the probability that the sample sequence with a longer sequence length is selected for disturbance, thereby improving the data availability of the disturbed sample sequence.
[0177] As a specific implementation, for each first sample sequence, the ratio of the sequence length of the first sample sequence to the total sequence length can be calculated, and then the ratio is added with 1 to obtain the disturbance score corresponding to the first sample sequence. The disturbance score corresponding to each first sample sequence can be calculated using formula (6):
[0178]
[0179] in, Indicates that it contains the category label r i The sample sequence s k The sequence length is Represents the category label r i The corresponding total sequence length, u(s k ) represents the sample sequence s k The corresponding perturbation score.
[0180] Exemplarily, taking the sample sequences shown in Table 6 as an example, the disturbance scores corresponding to each sample sequence can be obtained as shown in Table 7.
[0181] Table 7
[0182] Sequence number <![CDATA[s 1 ]]> <![CDATA[s 2 ]]> <![CDATA[s 3 ]]> <![CDATA[s 4 ]]> Perturbation score 1.04255 1.04255 1.04255 1.04255 Sequence number <![CDATA[s 5 ]]> <![CDATA[s 6 ]]> <![CDATA[s 7 ]]> <![CDATA[s 8 ]]> Perturbation score 1.06383 1.06383 1.06383 1.06383 Sequence number <![CDATA[s 9 ]]> <![CDATA[s 10 ]]> <![CDATA[s 11 ]]> <![CDATA[s 12 ]]> Perturbation score 1.06383 1.06383 1.08511 1.08511 Sequence number <![CDATA[s 13 ]]> <![CDATA[s 14 ]]> <![CDATA[s 15 ]]> Perturbation score 1.08511 1.08511 1.10638
[0183] From the disturbance scores shown in Table 7, it can be known that the longer the sequence length of the sample sequence is, the higher the corresponding disturbance score may be.
[0184] After determining the disturbance scores corresponding to each first sample sequence, the disturbance probability corresponding to each first sample sequence may be determined based on the exponential basis according to the disturbance scores corresponding to each first sample sequence. As an implementation method, the first global sensitivity may be determined according to the disturbance scores corresponding to each first sample sequence, and then the disturbance probability corresponding to each first sample sequence may be determined based on the exponential function according to the first privacy budget, the first global sensitivity and the disturbance scores corresponding to each first sample sequence.
[0185] The first global sensitivity may refer to the global sensitivity corresponding to the function u (i.e., formula (6)) for calculating the disturbance score. The first global sensitivity may be the maximum value of the absolute value of the difference between the disturbance scores of any two first sample sequences. The calculation formula of the first global sensitivity may be as shown in formula (7):
[0186] Δu=max|u(s χ )-u(s Ω )| Formula (7);
[0187] Among them, u(s χ ) and u(s Ω ) are any two containing category labels r i The perturbation fraction of the sample sequence .
[0188] The first privacy budget can be a preset value, such as the first privacy budget ε 1 =0.4, etc., but not limited to this.
[0189] As a specific implementation, based on an exponential function with e as the base, according to the first privacy budget, the first global sensitivity and the disturbance score corresponding to each first sample sequence, the exponential result corresponding to each first sample sequence can be calculated, and the sum of the exponential results corresponding to each first sample sequence can be calculated, and the ratio of the exponential results corresponding to each first sample sequence to the sum can be determined to obtain the disturbance probability corresponding to each first sample sequence. The calculation formula of the disturbance probability of the sample sequence can be shown as formula (8):
[0190]
[0191] Among them, Pr(s k ) represents the category label r i The sample sequence s k The corresponding perturbation probability, exp() represents the exponential function with base e, Δu is the first global sensitivity, ε 1 represents the first privacy budget, Represents the number of sequences containing sample sequences with category label ri, Calculate the sample sequence s k The corresponding index result.
[0192] Exemplarily, taking the sample sequence shown in Table 6 as an example, the disturbance probability corresponding to each sample sequence can be obtained as shown in Table 8.
[0193] Table 8
[0194] Sequence number <![CDATA[s 1 ]]> <![CDATA[s 2 ]]> <![CDATA[s 3 ]]> <![CDATA[s 4 ]]> Perturbation probability 0.06171 0.06171 0.06171 0.06171 Sequence number <![CDATA[s 5 ]]> <![CDATA[s 6 ]]> <![CDATA[s 7 ]]> <![CDATA[s 8 ]]> Perturbation probability 0.06596 0.06596 0.06596 0.06596 Sequence number <![CDATA[s 9 ]]> <![CDATA[s 10 ]]> <![CDATA[s 11 ]]> <![CDATA[s 12 ]]> Perturbation probability 0.06596 0.06596 0.07051 0.07051 Sequence number <![CDATA[s 13 ]]> <![CDATA[s 14 ]]> <![CDATA[s 15 ]]> Perturbation probability 0.07051 0.07051 0.07537
[0195] In the embodiment of the present application, a perturbation scheme that satisfies differential privacy is provided. By constructing a perturbation score function, the perturbation score function takes into account the sequence length of the sample sequence and the total length of the sequence of the corresponding category, and determines the perturbation probability of each sample sequence according to the perturbation score of each sample sequence calculated, which not only improves data security, reduces the risk of data leakage, but also improves data availability. In addition, the random response mechanism used in the related art is improved, the length of each sample sequence is taken into account, and an exponential mechanism is introduced to determine the perturbation probability. Compared with the sequence perturbation scheme in the related art, the data security is higher and the data availability is higher.
[0196] Step 704: Based on the perturbation probability corresponding to each sample sequence, randomly select a target number of sample sequences from the first sequence set for perturbation.
[0197] In some embodiments, the target number may be the sum of the number of disturbances corresponding to each category label, the category label may correspond to the number of disturbances one by one, the number of disturbances corresponding to different category labels may be the same or different, and the number of disturbances corresponding to each category label may be determined according to the number of sequences corresponding to each category label. For each category label, a sample sequence of the number of disturbances corresponding to the category label may be randomly selected for disturbance.
[0198] Taking the first category label as an example, the first category label is any category label, the first category label corresponds to the first category, and the perturbation quantity corresponding to the first category label can be determined according to the sequence quantity of the first sample sequence corresponding to the first category label, the first sample sequence is a sample sequence containing the first category label, and then based on the perturbation probability corresponding to each first sample sequence, the first sample sequence of the perturbation quantity is randomly selected as the sample sequence to be perturbed, and the sample sequence to be perturbed is perturbed.
[0199] As a specific implementation, the number of disturbances corresponding to the first category label can be determined according to the ratio of the number of sequences in the first sample sequence to a disturbance parameter, and the disturbance parameter can be preset. in, Represents the category label ri The corresponding number of disturbances, Indicates that it contains the category label r i The number of sample sequences of , ξ represents the perturbation parameter. For example, assuming ξ takes the value of 5, then the category label r can be determined i The corresponding number of perturbations is 3, and 3 perturbations containing category labels r can be randomly selected i The sample sequence is used as the sample sequence to be disturbed.
[0200] In some embodiments, perturbing a sample sequence to be disturbed may include: determining the selection probability of each value situation corresponding to each label item according to the number of value situations corresponding to each label item contained in the target sample sequence to be disturbed and the probability parameter corresponding to the number of value situations; and perturbing the value of each label item based on the selection probability of each value situation corresponding to each label item.
[0201] The target sample sequence to be disturbed can be any sample sequence to be disturbed. Each label item has a different meaning and a corresponding value. For example, the label item representing time information corresponds to a value of 1 to 24, with a total of 24 value conditions, that is, the number of value conditions is 24. The label item representing battery power corresponds to a value of 29 to 33, with a total of 5 value conditions, that is, the number of value conditions is 5.
[0202] Different probability parameters can be set for different numbers of value situations. As a specific implementation, the tag items can be divided into binary tag items and multi-value tag items according to the number of value situations corresponding to the tag items, wherein the binary tag items are tag items with a value situation number of 2, and the multi-value tag items are tag items with a value situation number greater than 2. For example, the number of value situations corresponding to the tag item representing the battery power is 5, that is, a multi-value tag item, and the number of value situations corresponding to the tag item representing the Bluetooth status is 2, that is, a binary tag item. The binary tag item can correspond to the first probability parameter, and the multi-value tag item can correspond to the second probability parameter.
[0203] For each label item of the target sample sequence to be disturbed, the selection probability of each value situation corresponding to the label item can be determined according to the number of value situations corresponding to the label item and the probability parameter. If the label item is a binary label item, the selection probability of each value situation corresponding to the label item can be determined using formula (9):
[0204]
[0205] Among them, r l represents the label item in the target sample sequence to be disturbed, Represents the label item r l Another value of , f represents the first probability parameter, and 0<f<1, Pc(rl =r l ) indicates that the value is r l The probability of selection, Indicates the value is For example, taking the label item representing whether the user is indoors, the values include 27 and 28. The value of this label item in the target perturbation sample sequence is 27, so the selection probability corresponding to the value 27 is The probability of selection corresponding to the value 28 is This means that when the perturbation occurs, the label item has The probability remains unchanged, The probability of is changed to 28. For binary label items, the privacy budget can be derived as
[0206] If the label item is a multi-value label item, assume that the label item r l Total In the case of value selection, for the label item r l , except for the current value in the target disturbed sample sequence r l For other values other than Among them, p represents the second probability parameter, that is, the label item r in the target sample sequence to be disturbed l have The probability of being disturbed to some other value in the value range. For the value r in the target sample sequence to be disturbed l The selection probability can be the difference between 1 and the second probability parameter. For example, the number of value cases corresponding to the label item representing the battery power is 5, and the current value in the target sample sequence to be disturbed is 33. Then, when disturbing, the label item has The probability of being disturbed is 29, The probability of being disturbed is 30, The probability of being perturbed is 31, The probability of being perturbed is 32, and the probability of 1-p remains unchanged at 33. For multi-valued label items, the privacy budget can be derived as
[0207] Optionally, after the disturbed sample sequence is disturbed, the disturbed sample sequence in the first sequence set may be replaced with the disturbed sample sequence, that is, the target number of sample sequences in the first sequence set are replaced with the disturbed sample sequence, thereby obtaining a second sequence set. Optionally, the original sample sequence in the first sequence set may also remain unchanged, and the disturbed sample sequence is directly added to the first sequence set, thereby obtaining a second sequence set.
[0208] In an embodiment of the present application, each label item included in the disturbed sample sequence can be disturbed according to the number of value situations corresponding to each label item included in the disturbed sample sequence and the probability parameter corresponding to the number of value situations, thereby ensuring the rationality of each label item during the disturbance, increasing data privacy, improving data security, and improving data availability.
[0209] Step 506: Perform frequent mining on the second sequence set to determine one or more regular sequences.
[0210] Frequent mining refers to mining the sample sequences that frequently appear in the second sequence set. By mining the second sequence set frequently, the frequent sample sequences in the second sequence set can be mined and used as regular sequences. The frequent sample sequence can be a sample sequence whose prefix support is greater than the support threshold. The category label can be arranged at the end of the sample sequence, and the prefix of the sample sequence can refer to the various label items (i.e., data feature labels) arranged before the category label.
[0211] In the embodiment of the present application, in the process of frequently mining the second sequence set, the support and the support threshold can be disturbed, and frequent sample sequences can be mined for each category. Figure 8 As shown, in one embodiment, step 506 performs frequent mining on the second sequence set to determine one or more regular sequences, which may include steps 802-808.
[0212] Step 802: Add threshold noise to the support threshold to obtain a disturbance threshold.
[0213] A support threshold may be pre-set, and the support threshold may be used to evaluate whether a prefix appears frequently. In an embodiment of the present application, the support threshold may be disturbed, and threshold noise may be added to the support threshold to obtain a disturbance threshold.
[0214] As an implementation method, the electronic device may generate threshold noise according to the second privacy budget, and superimpose the support threshold and the threshold noise to obtain a disturbance threshold. The second privacy budget may be set according to actual needs. For example, if the second privacy budget ε3 = 0.8, the privacy budget for a given support threshold may be The generated threshold noise may satisfy a first constraint condition, which may include that the threshold noise is greater than 0. The calculation formula of the disturbance threshold may be shown in formula (10):
[0215] α′=α+noi α Formula (10);
[0216] Among them, a represents the support threshold, noiα represents the threshold noise, and α' represents the perturbation threshold.
[0217] Step 804: Obtain at least one support set corresponding to the second category label.
[0218] The second category label can be any category label, and each category label can correspond to at least one support set. In some embodiments, for each category label, a support set corresponding to each prefix length can be obtained, that is, for each category label, the support set corresponds to the prefix length one by one. The prefix length is the number of data feature labels arranged before the category label in the sample sequence. For example, for category label 42, the maximum sequence length is 6, and there are 5 prefix lengths in total. Then, 5 support sets corresponding to category label 42 can be obtained, and the support set may include the support corresponding to the prefix length of each prefix corresponding to the category label 42 (such as 9, 27, 36, 42, 40, 17, etc.).
[0219] In some embodiments, a projection database corresponding to each prefix length may be pre-constructed, and the projection database corresponding to each prefix length may be constructed based on a sample sequence having each prefix length, and the projection database may map the relationship between each label item in the sample sequence. A first support set corresponding to a second category label may be obtained from a projection database corresponding to a first prefix length, the first prefix length being greater than 0 and less than the maximum sequence length corresponding to the second category label, and the first prefix length may be any prefix length corresponding to the second category label.
[0220] For example, for a sample sequence containing category label 42, for prefix length Len pre =3, can be obtained from the prefix length Len pre =3, obtain the support corresponding to each prefix (that is, the data feature label in the sample sequence containing the category label 42), and obtain the support set C = {t 1 , t 2 , ..., t n}. For example, for a sample sequence containing a class label 42, for a prefix length Len pre =3, the obtained support set C can be shown in Table 9.
[0221] Table 9
[0222] Prefix 9 22 27 28 33 36 37 40 Support 3 4 6 1 4 6 1 7
[0223] For other prefix lengths of the second category label, the support set can be obtained from the corresponding projection database in the same manner.
[0224] Step 806: perturb at least one support set.
[0225] Each support set obtained can be perturbed, and noise can be added to the support in the support set. For each support set, the mean support and the second global sensitivity can be calculated according to each support included in the support set, and a probability density function can be constructed according to the mean support, the second global sensitivity and the second privacy budget. Then, based on the probability density function, the support noise corresponding to each support in the support set is determined, and then the corresponding support noise is added to each support in the support set to obtain the perturbed support set.
[0226] The mean support can be calculated using formula (11):
[0227]
[0228] Where s represents the size of the support set C (i.e., the number of supports contained), μc represents the mean support of the support set C, and t j represents the support of the j-th prefix in the support set C.
[0229] The second global sensitivity refers to the global sensitivity of the support set. The second global sensitivity can be the maximum absolute value of the difference between any two support values in the support set. The calculation formula of the second global sensitivity can be shown as formula (12):
[0230] Δf=max{|t χ -t Ω |} Formula (12);
[0231] Where Δf represents the second global sensitivity of the support set C, t χ and t Ω are any two supports in the support set C.
[0232] After calculating the support mean and the second global sensitivity of the support set, a probability density function can be constructed according to the support mean, the second global sensitivity and the second privacy budget, and based on the probability density function, the support noise corresponding to each support of the support set is determined. The generated support noise satisfies the Laplace distribution. As a specific implementation method, the probability density function can be shown as formula (13) and formula (14):
[0233]
[0234]
[0235] Wherein, Pq() represents a probability density function. According to the above probability density function, the support noise corresponding to each support of the support set can be generated respectively, and the generated support noise satisfies the second constraint condition, which includes that the support noise is greater than or equal to 0 and less than or equal to the threshold noise. For example, for the support t j , based on the above probability density function, generate support noise The generated support noise can be determined Whether the second constraint is satisfied. If the second constraint is satisfied, the support t j Add support noise Get the support after disturbance; if the second constraint is not met, the support noise can be regenerated Until the generated support noise Satisfy the second constraint. Calculate the support t after perturbation j ' can be shown as formula (15):
[0236]
[0237] Using the above method, we can get the perturbed support set C′={t 1 ′, t 2 ′,...,t n ′}.
[0238] Exemplarily, the perturbed support set C′ may be as shown in Table 10.
[0239] Table 10
[0240] Prefix 9 22 27 28 33 36 37 40 Support 3.8617 4.9642 6.3528 1.4278 4.5892 6.6528 1.7426 7.2923
[0241] Step 808: mining a frequent sample sequence corresponding to the second category label from the second sequence set according to the perturbed support set and the perturbation threshold, and using the frequent sample sequence as a regular sequence.
[0242] Each support included in the perturbed support set can be compared with the perturbation threshold, and the prefix with support greater than the perturbation threshold can be determined, and the frequent sample sequence can be mined from the second sequence set based on the prefix with support greater than the perturbation threshold. Taking the first support set corresponding to the second category label as an example, the first support set corresponds to the first prefix length. According to the first support set after perturbation and the perturbation threshold, the frequent sample sequence corresponding to the second category label and satisfying the first prefix length can be mined from the second sequence set. Each support of the first support set after perturbation is compared with the perturbation threshold, and the prefix with support greater than the perturbation threshold is determined, and the sample sequence corresponding to the first prefix length is obtained based on the prefix with support greater than the perturbation threshold, which is the frequent sample sequence.
[0243] For example, taking the perturbed support set C′ shown in Table 10 as an example, assuming that the support threshold is 5 and the perturbation threshold is 5.9732, prefixes with support greater than the perturbation threshold can be found to include 27, 36, and 40, and a frequent sample sequence with a prefix length of 3 can be found in the second sequence set: 27-36-40-42.
[0244] The support sets corresponding to the second category labels and other prefix lengths can also be perturbed in the same manner as above, and the corresponding frequent sample sequences can be mined from the second sequence set based on the perturbed support sets and the perturbation threshold.
[0245] For each category label, the same method as the second category label can be used to mine frequent sample sequences corresponding to each category label from the second sequence set. The mined frequent sample sequences can be used as rule sequences, and the rule base can be constructed using the rule sequences.
[0246] It should be noted that for each support set, the threshold noise can be regenerated to obtain the perturbation threshold; alternatively, the same perturbation threshold can be used for the support set corresponding to each category label; alternatively, the perturbation threshold is generated only once, and the support sets corresponding to all category labels are compared using the perturbation threshold.
[0247] In the embodiment of the present application, in the process of frequent mining of sample sequences, bounded noise is added to the support threshold and the support, and the noise size is limited by the first constraint and the second constraint, so that the size relationship between the support threshold and the support before and after the disturbance does not change, reducing the probability of erroneous filtering and ensuring the rationality of the data. Compared with the frequent mining method in the related art, the availability of data can be improved, and the mining results of frequent mining are more accurate.
[0248] Step 508: construct a rule base according to one or more rule sequences, and encrypt the one or more rule sequences contained in the rule base.
[0249] Step 510: Generate a dictionary corresponding to the rule base, and generate a search key corresponding to the rule base.
[0250] Step 512: Generate an index corresponding to each rule sequence according to each rule sequence and the search key.
[0251] Step 514, converting the data to be queried into N target data feature labels.
[0252] Step 516, determining the arrangement position corresponding to each target data feature label in the dictionary, and generating a query vector according to the arrangement positions corresponding to the N target data feature labels.
[0253] Step 518: Generate a trapdoor according to the query vector and the search key corresponding to the rule base.
[0254] Step 520, calculating the query score corresponding to each rule sequence according to the trapdoor and the index corresponding to each rule sequence.
[0255] Step 522: determine the rule sequence with the highest query score as the target rule sequence.
[0256] Step 524, decrypt the ciphertext of the target rule sequence to obtain the target category label contained in the target rule sequence, and determine the target category corresponding to the to-be-queried data according to the target category label.
[0257] The description of steps 508 to 524 may refer to the relevant description in the above embodiments, and will not be repeated here.
[0258] In the embodiments of the present application, based on differential privacy technology and searchable encryption technology, data privacy is enhanced throughout the entire process from building a rule base to using the rule base for category identification, thereby protecting the user's privacy information, enhancing data security, and reducing the risk of data leakage.
[0259] like Fig. 9 As shown, in one embodiment, a rule base construction method is provided, which can be applied to the above electronic device. The rule base construction method may include the following steps:
[0260] Step 910: preprocess the sample data set to obtain a first sequence set, the first sequence set including M sample sequences in numerical format, each sample sequence including a category label and at least one data feature label, where M is a positive integer.
[0261] In one embodiment, the sample data set includes at least X data elements, where X is a positive integer. Step 910 may include: performing a conversion process on the sample data set according to a label conversion relationship to convert the category data item contained in each data element into a corresponding category label, and converting the feature data item contained in each data element into a corresponding data feature label, to obtain a data sequence corresponding to each data element; generating M sample sequences according to the X data sequences corresponding to the X data elements, to obtain a first sequence set including the M sample sequences; the sample sequence is a subsequence of any data sequence, and the M sample sequences are non-repetitive and include all subsequences with category labels in the X data sequences.
[0262] Step 920: perturb the first sequence set to obtain a second sequence set.
[0263] In one embodiment, step 920 may include: determining the perturbation probability corresponding to each sample sequence according to the sequence length of each sample sequence; and randomly selecting a target number of sample sequences from the first sequence set for perturbation based on the perturbation probability corresponding to each sample sequence.
[0264] In one embodiment, the steps of determining the disturbance probability corresponding to each sample sequence according to the sequence length of each sample sequence include: obtaining the sequence length of each first sample sequence corresponding to the first category label; determining the total sequence length corresponding to the first category label according to the sequence length of each first sample sequence; determining the disturbance score corresponding to each first sample sequence according to the sequence length of each first sample sequence and the total sequence length; and determining the disturbance probability corresponding to each first sample sequence according to the disturbance score corresponding to each first sample sequence based on an exponential basis. Wherein, the first category label is any category label, and the first sample sequence is a sample sequence containing the first category label.
[0265] In one embodiment, the steps are based on an exponential basis, and the disturbance probability corresponding to each first sample sequence is determined according to the disturbance score corresponding to each first sample sequence, including: determining the first global sensitivity according to the disturbance score corresponding to each first sample sequence; based on the exponential function, determining the disturbance probability corresponding to each first sample sequence according to the first privacy budget, the first global sensitivity and the disturbance score corresponding to each first sample sequence.
[0266] In one embodiment, the steps of randomly selecting a target number of sample sequences from a first sequence set for perturbation based on the perturbation probability corresponding to each sample sequence include: determining the perturbation number corresponding to the first category label according to the number of first sample sequences corresponding to the first category label; randomly selecting a perturbation number of first sample sequences as sample sequences to be perturbed based on the perturbation probability corresponding to each first sample sequence; and perturbing the sample sequences to be perturbed; wherein the sum of the perturbation numbers corresponding to each category label is the target number.
[0267] In one embodiment, the step of perturbing the sample sequence to be disturbed includes: determining the selection probability of each value situation corresponding to each label item according to the number of value situations corresponding to each label item contained in the target sample sequence to be disturbed and the probability parameter corresponding to the number of value situations; and perturbing the value of each label item based on the selection probability of each value situation corresponding to each label item. Wherein, the target sample sequence to be disturbed is any sample sequence to be disturbed,
[0268] Step 930: Perform frequent mining on the second sequence set to determine one or more regular sequences.
[0269] In one embodiment, step 930 includes: adding threshold noise to the support threshold to obtain a perturbation threshold; obtaining at least one support set corresponding to a second category label, where the second category label is any category label; perturbing at least one support set; and mining a frequent sample sequence corresponding to the first category label from the second sequence set based on the perturbed support set and the perturbation threshold, and using the frequent sample sequence as a regular sequence.
[0270] In one embodiment, the step of adding threshold noise to the support threshold to obtain a disturbance threshold includes: generating the threshold noise according to the second privacy budget; superimposing the support threshold and the threshold noise to obtain the disturbance threshold, and the threshold noise satisfies the first constraint condition, and the first constraint condition includes that the threshold noise is greater than 0.
[0271] In one embodiment, the category label is arranged at the end of the sample sequence; the step of obtaining at least one support set corresponding to the second category label includes: obtaining a first support set corresponding to the second category label from a projection database corresponding to a first prefix length; the prefix length is the number of data feature labels arranged before the category label in the sample sequence; the first prefix length is greater than 0 and less than the maximum sequence length corresponding to the second category label; the projection database is constructed based on the sample sequence with the first prefix length;
[0272] The step mines a frequent sample sequence corresponding to the first category label from the second sequence set according to the perturbed support set and the perturbation threshold, including: mining a frequent sample sequence corresponding to the second category label and satisfying the first prefix length from the second sequence set according to the perturbed first support set and the perturbation threshold.
[0273] In one embodiment, the step of perturbing at least one support set includes: calculating the support mean and the second global sensitivity according to each support included in the support set; determining the support noise corresponding to each support according to the support mean and the each support based on the probability density function; adding the corresponding support noise to each support in the support set to obtain the perturbed support set. Wherein, the support noise satisfies the Laplace distribution, and the support noise satisfies the second constraint condition, and the second constraint condition includes that the support noise is greater than or equal to 0, and less than or equal to the threshold noise.
[0274] Step 940: construct a rule base according to one or more rule sequences, and encrypt the one or more rule sequences contained in the rule base.
[0275] In one embodiment, the rule base construction method further includes: generating a dictionary corresponding to the rule base; generating a search key corresponding to the rule base; and generating an index corresponding to each rule sequence according to each rule sequence and the search key contained in the rule base.
[0276] In one embodiment, the steps of generating a dictionary corresponding to the rule base include: extracting category labels and data feature labels contained in each rule sequence in the rule base; deduplicating the extracted category labels and data feature labels, and arranging the deduplicated category labels and data feature labels in sequence to obtain a dictionary corresponding to the rule base.
[0277] In one embodiment, an index corresponding to each rule sequence is generated according to each rule sequence and search key contained in a rule base, including: generating an identification vector corresponding to the first rule sequence according to the arrangement position of the category labels and data feature labels contained in the first rule sequence in the dictionary, the vector length of the identification vector is the same as the dictionary length of the dictionary; the first rule sequence is any rule sequence; and generating an index corresponding to the first rule sequence according to the identification vector and search key corresponding to the first rule sequence.
[0278] It should be noted that the description of the rule base construction method provided in the embodiment of the present application can refer to the relevant description of the category identification method provided in the above embodiments, and will not be repeated here.
[0279] In the embodiment of the present application, the sample data set is converted into a first sequence set in a numerical format, and the first sequence set is disturbed, thereby enhancing the privacy of the data, and encrypting the constructed rule base, improving data security, and reducing the risk of data leakage. Based on differential privacy technology and searchable encryption technology, the entire process from the construction of the rule base to the use of the rule base for category identification enhances the privacy of the data, protects the user's privacy information, enhances data security, and reduces the risk of data leakage.
[0280] like Fig.10 As shown, in one embodiment, a category identification device 1000 is provided, which can be applied to the above electronic device. The category identification device 1000 includes: a query vector generation module 1010, a trapdoor generation module 1020, a retrieval module 1030 and a decryption module 1040.
[0281] The query vector generation module 1010 is used to generate a query vector according to the dictionary corresponding to the data to be queried and the rule base; the rule base includes one or more encrypted rule sequences, each rule sequence includes a category label and at least one data feature label, and the dictionary includes each category label and each data feature label in the rule base.
[0282] The trapdoor generation module 1020 is used to generate a trapdoor according to the query vector and the search key corresponding to the rule base.
[0283] The retrieval module 1030 is used to determine the target rule sequence according to the trapdoor and the indexes corresponding to each rule sequence; wherein the index corresponding to the first rule sequence is generated according to the first rule sequence and the search key, and the first rule sequence is any rule sequence.
[0284] The decryption module 1040 is used to decrypt the ciphertext of the target rule sequence to obtain the target category label contained in the target rule sequence, and determine the target category corresponding to the to-be-queried data according to the target category label.
[0285] In one embodiment, the data to be queried includes device status data, which includes one or more of time information, location information, battery status information, device information of external devices, and network connection information; data feature tags are used to characterize device status features; and category tags are used to characterize user behavior categories.
[0286] In one embodiment, the category identification device 1000 further includes a dictionary generation module.
[0287] The dictionary generation module is used to extract the category labels and data feature labels contained in each rule sequence in the rule base; deduplicate the extracted category labels and data feature labels, and arrange the deduplicated category labels and data feature labels in sequence to obtain the dictionary corresponding to the rule base.
[0288] In one embodiment, the query vector generation module 1010 is also used to convert the data to be queried into N target data feature labels, where N is a positive integer; determine the arrangement position corresponding to each target data feature label in the dictionary, and generate a query vector according to the arrangement positions corresponding to the N target data feature labels; the vector length of the query vector is the same as the dictionary length of the dictionary.
[0289] In one embodiment, the index corresponding to the first rule sequence is generated based on the identification vector and search key of the first rule sequence; the identification vector of the first rule sequence is generated based on the arrangement positions of the category labels and data feature labels contained in the first rule sequence in the dictionary, and the vector length of the identification vector is the same as the dictionary length of the dictionary.
[0290] In one embodiment, the search key includes a reversible diagonal matrix and an inverse matrix of the reversible diagonal matrix; the order of the reversible diagonal matrix is the same as the dictionary length of the dictionary; the index corresponding to the first regular sequence is generated based on the first regular sequence and the transposed matrix of the reversible diagonal matrix.
[0291] The trapdoor generation module 1020 is further configured to generate a trapdoor according to the query vector and the inverse matrix of the reversible diagonal matrix.
[0292] In one embodiment, the search module 1030 is further configured to calculate the query score corresponding to each rule sequence according to the trapdoor and the index corresponding to each rule sequence; and determine the rule sequence with the highest query score as the target rule sequence.
[0293] In one embodiment, the category identification device 1000 further includes a preprocessing module, a perturbation module, a mining module, and a construction module.
[0294] The preprocessing module is used to preprocess the sample data set to obtain a first sequence set, wherein the first sequence set includes M sample sequences in numerical format, each sample sequence includes a category label and at least one data feature label; M is a positive integer.
[0295] The perturbation module is used to perturb the first sequence set to obtain a second sequence set.
[0296] The mining module is used to perform frequent mining on the second sequence set to determine one or more regular sequences.
[0297] The building module builds a rule base according to one or more rule sequences and encrypts the one or more rule sequences contained in the rule base.
[0298] In one embodiment, the sample data set includes X data elements, where X is a positive integer. The preprocessing module is further used to perform conversion processing on the sample data set according to the label conversion relationship, so as to convert the category data items contained in each data element into the corresponding category label, and convert the feature data items contained in each data element into the corresponding data feature label, so as to obtain a data sequence corresponding to each data element; based on the X data sequences corresponding to the X data elements, M sample sequences are generated to obtain a first sequence set including the M sample sequences; the sample sequence is a subsequence of any data sequence, and the M sample sequences are non-repetitive and include all subsequences with category labels in the X data sequences.
[0299] In one embodiment, the disturbance module includes a disturbance probability determination unit and a sequence disturbance unit.
[0300] The disturbance probability determination unit is used to determine the disturbance probability corresponding to each sample sequence according to the sequence length of each sample sequence.
[0301] The sequence perturbation unit is used to randomly select a target number of sample sequences from the first sequence set for perturbation based on the perturbation probability corresponding to each sample sequence.
[0302] In one embodiment, the disturbance probability determination unit is further used to obtain the sequence length of each first sample sequence corresponding to the first category label; the first category label is any category label, and the first sample sequence is a sample sequence containing the first category label; according to the sequence length of each first sample sequence, the total length of the sequence corresponding to the first category label is determined; according to the sequence length of each first sample sequence and the total length of the sequence, the disturbance score corresponding to each first sample sequence is determined; based on the exponential basis, the disturbance probability corresponding to each first sample sequence is determined according to the disturbance score corresponding to each first sample sequence.
[0303] In one embodiment, the disturbance probability determination unit is further used to determine the first global sensitivity according to the disturbance scores corresponding to each first sample sequence; based on the exponential function, the disturbance probability corresponding to each first sample sequence is determined according to the first privacy budget, the first global sensitivity and the disturbance scores corresponding to each first sample sequence.
[0304] In one embodiment, the sequence perturbation unit is further used to determine the perturbation quantity corresponding to the first category label according to the sequence quantity of the first sample sequence corresponding to the first category label; the first category label is any category label, and the first sample sequence is a sample sequence containing the first category label; based on the perturbation probability corresponding to each first sample sequence, randomly select the first sample sequence with a perturbation quantity as the sample sequence to be perturbed; perturb the sample sequence to be perturbed; wherein the sum of the perturbation quantities corresponding to each category label is the target quantity.
[0305] In one embodiment, the sequence perturbation unit is further used to determine the selection probability of each value situation corresponding to each label item according to the number of value situations corresponding to each label item contained in the target sample sequence to be disturbed and the probability parameter corresponding to the number of value situations; the target sample sequence to be disturbed is any sample sequence to be disturbed; based on the selection probability of each value situation corresponding to each label item, the value of each label item is perturbed.
[0306] In one embodiment, the mining module includes a threshold perturbation unit, a support acquisition unit, a support perturbation unit, and a mining unit.
[0307] The threshold perturbation unit is used to add threshold noise to the support threshold to obtain a perturbation threshold.
[0308] The support acquisition unit is used to acquire at least one support set corresponding to the second category label; the second category label is any category label.
[0309] The support perturbation unit is used to perturb at least one support set.
[0310] The mining unit mines the frequent sample sequence corresponding to the second category label from the second sequence set according to the perturbed support set and the perturbation threshold, and uses the frequent sample sequence as a regular sequence.
[0311] In one embodiment, the threshold perturbation unit is further used to generate threshold noise according to the second privacy budget; the support threshold is superimposed on the threshold noise to obtain a perturbation threshold, and the threshold noise satisfies a first constraint condition, and the first constraint condition includes that the threshold noise is greater than 0.
[0312] In one embodiment, the category label is arranged at the very end of the sample sequence. The support acquisition unit is further used to obtain a first support set corresponding to the second category label from a projection database corresponding to the first prefix length; the prefix length is the number of data feature labels arranged before the category label in the sample sequence; the first prefix length is greater than 0 and less than the maximum sequence length corresponding to the second category label; the projection database is constructed based on a sample sequence with a first prefix length. The mining unit is further used to mine a frequent sample sequence corresponding to the second category label and satisfying the first prefix length from the second sequence set based on the disturbed first support set and the disturbance threshold.
[0313] In one embodiment, the support perturbation unit is also used to calculate the support mean and the second global sensitivity according to each support included in the support set; construct a probability density function according to the support mean, the second global sensitivity and the second privacy budget; based on the probability density function, determine the support noise corresponding to each support; the support noise satisfies the Laplace distribution, and the support noise satisfies the second constraint, and the second constraint includes that the support noise is greater than or equal to 0 and less than or equal to the threshold noise; add the corresponding support noise to each support in the support set to obtain the perturbed support set.
[0314] In the embodiments of the present application, based on differential privacy technology and searchable encryption technology, data privacy is enhanced throughout the entire process from building a rule base to using the rule base for category identification, thereby protecting the user's privacy information, enhancing data security, and reducing the risk of data leakage.
[0315] like Fig.11 As shown, in one embodiment, a rule base construction device 1100 is provided, which can be applied to the above electronic device. The rule base construction device 1100 may include: a pre-processing module 1110 , a perturbation module 1120 , a mining module 1130 and a construction module 1140 .
[0316] The preprocessing module 1110 is used to preprocess the sample data set to obtain a first sequence set, where the first sequence set includes M sample sequences in numerical format, each sample sequence includes a category label and at least one data feature label; M is a positive integer;
[0317] The perturbation module 1120 is configured to perturb the first sequence set to obtain a second sequence set.
[0318] The mining module 1130 is configured to perform frequent mining on the second sequence set to determine one or more regular sequences.
[0319] The construction module 1140 is used to construct a rule base according to one or more rule sequences, and encrypt the one or more rule sequences included in the rule base.
[0320] In one embodiment, the sample data set includes X data elements, where X is a positive integer. The preprocessing module 1110 is further used to perform conversion processing on the sample data set according to the label conversion relationship, so as to convert the category data items contained in each data element into the corresponding category label, and convert the feature data items contained in each data element into the corresponding data feature label, so as to obtain a data sequence corresponding to each data element; generate M sample sequences according to the X data sequences corresponding to the X data elements, so as to obtain a first sequence set including the M sample sequences; the sample sequence is a subsequence of any data sequence, and the M sample sequences are non-repetitive and include all subsequences with category labels in the X data sequences.
[0321] In one embodiment, the perturbation module 1120 includes a perturbation probability determination unit and a sequence perturbation unit.
[0322] The disturbance probability determination unit is used to determine the disturbance probability corresponding to each sample sequence according to the sequence length of each sample sequence.
[0323] The sequence perturbation unit is used to randomly select a target number of sample sequences from the first sequence set for perturbation based on the perturbation probability corresponding to each sample sequence.
[0324] In one embodiment, the disturbance probability determination unit is further used to obtain the sequence length of each first sample sequence corresponding to the first category label; the first category label is any category label, and the first sample sequence is a sample sequence containing the first category label; according to the sequence length of each first sample sequence, the total length of the sequence corresponding to the first category label is determined; according to the sequence length of each first sample sequence and the total length of the sequence, the disturbance score corresponding to each first sample sequence is determined; based on the exponential basis, the disturbance probability corresponding to each first sample sequence is determined according to the disturbance score corresponding to each first sample sequence.
[0325] In one embodiment, the disturbance probability determination unit is further used to determine the first global sensitivity according to the disturbance scores corresponding to each first sample sequence; based on the exponential function, the disturbance probability corresponding to each first sample sequence is determined according to the first privacy budget, the first global sensitivity and the disturbance scores corresponding to each first sample sequence.
[0326] In one embodiment, the sequence perturbation unit is further used to determine the perturbation quantity corresponding to the first category label according to the sequence quantity of the first sample sequence corresponding to the first category label; the first category label is any category label, and the first sample sequence is a sample sequence containing the first category label; based on the perturbation probability corresponding to each first sample sequence, randomly select the first sample sequence with a perturbation quantity as the sample sequence to be perturbed; perturb the sample sequence to be perturbed; wherein the sum of the perturbation quantities corresponding to each category label is the target quantity.
[0327] In one embodiment, the sequence perturbation unit is further used to determine the selection probability of each value situation corresponding to each label item according to the number of value situations corresponding to each label item contained in the target sample sequence to be disturbed and the probability parameter corresponding to the number of value situations; the target sample sequence to be disturbed is any sample sequence to be disturbed; based on the selection probability of each value situation corresponding to each label item, the value of each label item is perturbed.
[0328] In one embodiment, the mining module 1130 includes a threshold perturbation unit, a support acquisition unit, a support perturbation unit, and a mining unit.
[0329] The threshold perturbation unit is used to add threshold noise to the support threshold to obtain a perturbation threshold.
[0330] The support acquisition unit is used to acquire at least one support set corresponding to the second category label; the second category label is any category label.
[0331] The support perturbation unit is used to perturb at least one support set.
[0332] The mining unit mines the frequent sample sequence corresponding to the second category label from the second sequence set according to the perturbed support set and the perturbation threshold, and uses the frequent sample sequence as a regular sequence.
[0333] In one embodiment, the threshold perturbation unit is further used to generate threshold noise according to the second privacy budget; the support threshold is superimposed on the threshold noise to obtain a perturbation threshold, and the threshold noise satisfies a first constraint condition, and the first constraint condition includes that the threshold noise is greater than 0.
[0334] In one embodiment, the category label is arranged at the very end of the sample sequence. The support acquisition unit is further used to obtain a first support set corresponding to the second category label from a projection database corresponding to the first prefix length; the prefix length is the number of data feature labels arranged before the category label in the sample sequence; the first prefix length is greater than 0 and less than the maximum sequence length corresponding to the second category label; the projection database is constructed based on a sample sequence with a first prefix length. The mining unit is further used to mine a frequent sample sequence corresponding to the second category label and satisfying the first prefix length from the second sequence set based on the disturbed first support set and the disturbance threshold.
[0335] In one embodiment, the support perturbation unit is also used to calculate the support mean and the second global sensitivity according to each support included in the support set; construct a probability density function according to the support mean, the second global sensitivity and the second privacy budget; based on the probability density function, determine the support noise corresponding to each support; the support noise satisfies the Laplace distribution, and the support noise satisfies the second constraint, and the second constraint includes that the support noise is greater than or equal to 0 and less than or equal to the threshold noise; add the corresponding support noise to each support in the support set to obtain the perturbed support set.
[0336] In one embodiment, the rule base construction device 1100 further includes a dictionary generation module, a key generation module and an index generation module.
[0337] The dictionary generation module is used to generate the dictionary corresponding to the rule base.
[0338] The key generation module is used to generate a search key corresponding to the rule base.
[0339] The index generation module is used to generate the index corresponding to each rule sequence according to each rule sequence and the search key contained in the rule base.
[0340] In one embodiment, the dictionary generation module is also used to extract the category labels and data feature labels contained in each rule sequence in the rule base: deduplicate the extracted category labels and data feature labels, and arrange the deduplicated category labels and data feature labels in sequence to obtain a dictionary corresponding to the rule base.
[0341] In one embodiment, the index generation module is also used to generate an identification vector corresponding to the first rule sequence according to the arrangement positions of the category labels and data feature labels contained in the first rule sequence in the dictionary, and the vector length of the identification vector is the same as the dictionary length of the dictionary; the first rule sequence is any rule sequence; based on the identification vector corresponding to the first rule sequence and the search key, an index corresponding to the first rule sequence is generated.
[0342] In the embodiment of the present application, the sample data set is converted into a first sequence set in a numerical format, and the first sequence set is disturbed, thereby enhancing the privacy of the data, and encrypting the constructed rule base, improving data security, and reducing the risk of data leakage. Based on differential privacy technology and searchable encryption technology, the entire process from the construction of the rule base to the use of the rule base for category identification enhances the privacy of the data, protects the user's privacy information, enhances data security, and reduces the risk of data leakage.
[0343] Fig.12 FIG. 1 is a structural block diagram of an electronic device in an embodiment. Fig.12 As shown, the electronic device 1200 may include one or more of the following components: a processor 1210, and a memory 1220 coupled to the processor 1210, wherein the memory 1220 may store one or more computer programs, and the one or more computer programs may be configured to implement the category identification method described in the above embodiments when executed by one or more processors 1210.
[0344] The processor 1210 may include one or more processing cores. The processor 1210 uses various interfaces and lines to connect the various parts of the entire electronic device 1200, and executes various functions and processes data of the electronic device 1200 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1220, and calling data stored in the memory 1220. Optionally, the processor 1210 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmab1e GateArray, FPGA), and programmable logic array (ProgrammableLogicArray, PLA). The processor 1210 can integrate one or a combination of a central processing unit (CentralProcessing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 1210, but may be implemented separately through a communication chip.
[0345] The memory 1220 may include a random access memory (RAM) or a read-only memory (ROM). The memory 1220 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 1220 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The data storage area may also store data created by the electronic device 1200 during use, etc.
[0346] It can be understood that the electronic device 1200 may include more or fewer structural elements than those in the above structural block diagram, for example, including a power module, physical buttons, a WiFi (Wireless Fidelity) module, a speaker, a Bluetooth module, a sensor, etc., and is not limited here.
[0347] An embodiment of the present application discloses an electronic device, including a memory and a processor. The memory stores a computer program. When the computer program is executed by the processor, the processor implements the rule base construction method described in the above embodiments.
[0348] An embodiment of the present application discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the category identification method described in the above embodiments is implemented.
[0349] An embodiment of the present application discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the rule base construction method described in the above embodiments is implemented.
[0350] An embodiment of the present application discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program can be executed by a processor to implement the category identification method described in the above embodiments.
[0351] An embodiment of the present application discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program can be executed by a processor to implement the rule base construction method described in the above embodiments.
[0352] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a ROM, etc.
[0353] As used herein, any reference to memory, storage, database, or other medium may include nonvolatile and / or volatile memory. Suitable nonvolatile memory may include ROM, programmable ROM (Programmable ROM, PROM), erasable PROM (Erasable PROM, EPROM), electrically erasable PROM (Electrically Erasable PROM, EEPROM), or flash memory. Volatile memory may include random access memory (random access memory, RAM), which is used as an external cache memory. By way of illustration and not limitation, RAM may be in a variety of forms, such as static RAM (Static RAM, SRAM), dynamic RAM (Dynamic Random Access Memory, DRAM), synchronous DRAM (synchronous DRAM, SDRAM), double data rate SDRAM (Double Data Rate SDRAM, DDR SDRAM), enhanced SDRAM (Enhanced Synchronous DRAM, ESDRAM), synchronous link DRAM (Synchlink DRAM, SLDRAM), memory bus direct RAM (Rambus DRAM, RDRAM) and direct memory bus dynamic RAM (Direct Rambus DRAM, DRDRAM).
[0354] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. Those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required for the present application.
[0355] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the above-mentioned processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0356] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0357] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0358] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0359] The above is a detailed introduction to a category identification method and device, a rule base construction method and device, and an electronic device disclosed in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation method and scope of application. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A category recognition method, characterized in that: include: Generate a query vector according to the data to be queried and the dictionary corresponding to the rule base; the rule base includes one or more encrypted rule sequences, each of which includes a category label and at least one data feature label, and the dictionary includes each category label and each data feature label in the rule base; Generate a trapdoor according to the query vector and a search key corresponding to the rule base; Determine a target rule sequence according to the trapdoor and the indexes corresponding to each of the rule sequences; wherein the index corresponding to the first rule sequence is generated according to the first rule sequence and the search key, and the first rule sequence is any of the rule sequences; The ciphertext of the target rule sequence is decrypted to obtain the target category label contained in the target rule sequence, and the target category corresponding to the to-be-queried data is determined according to the target category label.
2. The method according to claim 1, characterized in that: The data to be queried includes device status data, and the device status data includes one or more of time information, location information, battery status information, device information of an external device, and network connection information; The data feature tag is used to characterize the device status feature; The category label is used to characterize the user behavior category.
3. The method according to claim 1, characterized in that Before generating a query vector according to the to-be-queried data and the dictionary corresponding to the rule base, the method further includes: Extracting category labels and data feature labels contained in each rule sequence in the rule base; The extracted category labels and data feature labels are deduplicated, and the deduplicated category labels and data feature labels are arranged in sequence to obtain a dictionary corresponding to the rule base.
4. The method according to claim 3, characterized in that The step of generating a query vector according to the data to be queried and the dictionary corresponding to the rule base includes: Convert the data to be queried into N target data feature labels, where N is a positive integer; The arrangement position corresponding to each of the target data feature labels is determined in the dictionary, and a query vector is generated according to the arrangement positions corresponding to the N target data feature labels; the vector length of the query vector is the same as the dictionary length of the dictionary.
5. The method according to claim 3, characterized in that: The index corresponding to the first rule sequence is generated according to the identification vector of the first rule sequence and the search key; The identification vector of the first rule sequence is generated according to the arrangement positions of the category labels and data feature labels contained in the first rule sequence in the dictionary, and the vector length of the identification vector is the same as the dictionary length of the dictionary.
6. The method according to claim 1, characterized in that The search key includes a reversible diagonal matrix and an inverse matrix of the reversible diagonal matrix; the order of the reversible diagonal matrix is the same as the dictionary length of the dictionary; the index corresponding to the first regular sequence is generated according to the first regular sequence and the transposed matrix of the reversible diagonal matrix; The generating a trapdoor according to the query vector and the search key corresponding to the rule base includes: A trapdoor is generated according to the query vector and the inverse matrix of the reversible diagonal matrix.
7. The method according to claim 1, characterized in that The step of determining a target rule sequence according to the trapdoor and the indexes corresponding to each rule sequence includes: Calculate the query score corresponding to each rule sequence according to the trapdoor and the index corresponding to each rule sequence; The rule sequence with the highest query score is determined as the target rule sequence.
8. The method according to any one of claims 1 to 7, characterized in that: The label formats of the category labels and data feature labels include numerical formats; before generating a query vector according to the dictionary corresponding to the data to be queried and the rule base, the method further includes: Preprocessing the sample data set to obtain a first sequence set, wherein the first sequence set includes M sample sequences in numerical format, each of the sample sequences includes a category label and at least one data feature label; M is a positive integer; Perturbing the first sequence set to obtain a second sequence set; Performing frequent mining on the second sequence set to determine one or more regular sequences; A rule base is constructed according to the one or more rule sequences, and the one or more rule sequences contained in the rule base are encrypted.
9. The method according to claim 8, characterized in that The sample data set includes X data elements, where X is a positive integer; Each of the data elements includes a category data item and at least one feature data item; The preprocessing of the sample data set to obtain a first sequence set includes: The sample data set is converted according to the label conversion relationship to convert the category data item contained in each data element into a corresponding category label, and the feature data item contained in each data element is converted into a corresponding data feature label, so as to obtain a data sequence corresponding to each data element; According to the X data sequences corresponding to the X data elements, M sample sequences are generated to obtain a first sequence set including the M sample sequences; the sample sequence is a subsequence of any of the data sequences, and the M sample sequences are non-repetitive and include all subsequences with category labels in the X data sequences.
10. The method according to claim 8, characterized in that The perturbing the first sequence set includes: Determining a disturbance probability corresponding to each sample sequence according to the sequence length of each sample sequence; Based on the disturbance probability corresponding to each sample sequence, a target number of sample sequences are randomly selected from the first sequence set for disturbance.
11. The method according to claim 10, characterized in that The determining, according to the sequence length of each sample sequence, the disturbance probability corresponding to each sample sequence includes: Obtaining the sequence length of each first sample sequence corresponding to the first category label; the first category label is any of the category labels, and the first sample sequence is a sample sequence including the first category label; Determining the total length of the sequences corresponding to the first category labels according to the sequence lengths of the first sample sequences; Determining a disturbance score corresponding to each of the first sample sequences according to the sequence length of each of the first sample sequences and the total length of the sequences; Based on an exponential basis, disturbance probabilities corresponding to the respective first sample sequences are determined according to disturbance scores corresponding to the respective first sample sequences.
12. The method according to claim 11, characterized in that The determining, based on an exponential basis and according to disturbance scores corresponding to the respective first sample sequences, disturbance probabilities corresponding to the respective first sample sequences comprises: Determining a first global sensitivity according to the disturbance scores corresponding to each of the first sample sequences; Based on an exponential function, a disturbance probability corresponding to each of the first sample sequences is determined according to the first privacy budget, the first global sensitivity, and the disturbance scores corresponding to each of the first sample sequences.
13. The method according to claim 10, characterized in that The randomly selecting a target number of sample sequences from the first sequence set for perturbation based on the perturbation probability corresponding to each sample sequence includes: Determine the number of disturbances corresponding to the first category label according to the number of sequences of the first sample sequence corresponding to the first category label; the first category label is any of the category labels, and the first sample sequence is a sample sequence containing the first category label; Based on the disturbance probability corresponding to each of the first sample sequences, randomly selecting the first sample sequences of the disturbance quantity as the sample sequences to be disturbed; Perturbing the sample sequence to be disturbed; The sum of the disturbance quantities corresponding to each of the category labels is the target quantity.
14. The method according to claim 13, characterized in that The perturbing the sample sequence to be disturbed comprises: Determine the selection probability of each value situation corresponding to each label item according to the number of value situations corresponding to each label item contained in the target sample sequence to be disturbed and the probability parameter corresponding to the number of value situations; the target sample sequence to be disturbed is any of the sample sequences to be disturbed; Based on the selection probability of each value situation corresponding to each label item, the value of each label item is disturbed.
15. The method according to claim 8, characterized in that The frequently mining the second sequence set to determine one or more regular sequences includes: Add threshold noise to the support threshold to obtain the disturbance threshold; Obtain at least one support set corresponding to a second category label; the second category label is any of the category labels; perturbing the at least one support set; According to the perturbed support set and the perturbation threshold, frequent sample sequences corresponding to the second category label are mined from the second sequence set, and the frequent sample sequences are used as regular sequences.
16. The method according to claim 15, characterized in that The adding threshold noise to the support threshold to obtain the disturbance threshold includes: generating threshold noise according to a second privacy budget; The support threshold is superimposed on the threshold noise to obtain a disturbance threshold, and the threshold noise satisfies a first constraint condition, wherein the first constraint condition includes that the threshold noise is greater than zero.
17. The method according to claim 15, characterized in that The category labels are arranged at the end of the sample sequence; and obtaining at least one support set corresponding to the second category label includes: Obtaining a first support set corresponding to the second category label from a projection database corresponding to a first prefix length; the prefix length is the number of data feature labels arranged before the category label in the sample sequence; the first prefix length is greater than 0 and less than the maximum sequence length corresponding to the second category label; the projection database is constructed based on the sample sequence having the first prefix length; The mining of frequent sample sequences corresponding to the first category label from the second sequence set according to the perturbed support set and the perturbation threshold comprises: According to the disturbed first support set and the disturbance threshold, a frequent sample sequence corresponding to the second category label and satisfying the first prefix length is mined from the second sequence set.
18. The method according to claim 16, characterized in that The perturbing the at least one support set comprises: Calculate the support mean and the second global sensitivity according to each support included in the support set; Constructing a probability density function according to the support mean, the second global sensitivity and the second privacy budget; Based on the probability density function, determine the support noise corresponding to each support; the support noise satisfies the Laplace distribution, and the support noise satisfies the second constraint condition, and the second constraint condition includes that the support noise is greater than or equal to 0 and less than or equal to the threshold noise; Corresponding support noise is added to each support in the support set to obtain a disturbed support set.
19. A method for constructing a rule base, characterized in that: include: Preprocessing the sample data set to obtain a first sequence set, wherein the first sequence set includes M sample sequences in numerical format, each of the sample sequences includes a category label and at least one data feature label; The M is a positive integer; Perturbing the first sequence set to obtain a second sequence set; Performing frequent mining on the second sequence set to determine one or more regular sequences; A rule base is constructed according to the one or more rule sequences, and the one or more rule sequences contained in the rule base are encrypted.
20. The method according to claim 19, characterized in that The sample data set includes at least X data elements, where X is a positive integer; each of the data elements includes a category data item and at least one feature data item; The preprocessing of the sample data set to obtain a first sequence set includes: The sample data set is converted according to the label conversion relationship to convert the category data item contained in each data element into a corresponding category label, and the feature data item contained in each data element is converted into a corresponding data feature label, so as to obtain a data sequence corresponding to each data element; According to the X data sequences corresponding to the X data elements, M sample sequences are generated to obtain a first sequence set including the M sample sequences; the sample sequence is a subsequence of any of the data sequences, and the M sample sequences are non-repetitive and include all subsequences with category labels in the X data sequences.
21. The method according to claim 19, characterized in that The perturbing the first sequence set includes: Determining a disturbance probability corresponding to each sample sequence according to the sequence length of each sample sequence; Based on the disturbance probability corresponding to each sample sequence, a target number of sample sequences are randomly selected from the first sequence set for disturbance.
22. The method according to claim 21, characterized in that The determining, according to the sequence length of each sample sequence, the disturbance probability corresponding to each sample sequence includes: Obtaining the sequence length of each first sample sequence corresponding to the first category label; the first category label is any of the category labels, and the first sample sequence is a sample sequence including the first category label; Determining the total length of the sequences corresponding to the first category labels according to the sequence lengths of the first sample sequences; Determining a disturbance score corresponding to each of the first sample sequences according to the sequence length of each of the first sample sequences and the total length of the sequences; Based on an exponential basis, disturbance probabilities corresponding to the respective first sample sequences are determined according to disturbance scores corresponding to the respective first sample sequences.
23. The method according to claim 19, characterized in that The frequently mining the second sequence set to determine one or more regular sequences includes: Add threshold noise to the support threshold to obtain the disturbance threshold; Obtain at least one support set corresponding to a second category label; the second category label is any of the category labels; perturbing the at least one support set; According to the perturbed support set and the perturbation threshold, frequent sample sequences corresponding to the first category label are mined from the second sequence set, and the frequent sample sequences are used as regular sequences.
24. The method according to claim 23, characterized in that The perturbing the at least one support set comprises: Calculate the support mean and the second global sensitivity according to each support included in the support set; Based on the probability density function, according to the support mean and the individual supports, the support noise corresponding to the individual supports is determined; the support noise satisfies the Laplace distribution, and the support noise satisfies the second constraint condition, and the second constraint condition includes that the support noise is greater than or equal to 0 and less than or equal to the threshold noise; Corresponding support noise is added to each support in the support set to obtain a disturbed support set.
25. The method according to any one of claims 19 to 24, characterized in that: The method further comprises: Generate a dictionary corresponding to the rule base; Generating a search key corresponding to the rule base; According to each rule sequence contained in the rule base and the search key, an index corresponding to each rule sequence is generated.
26. The method according to claim 25, characterized in that The generating a dictionary corresponding to the rule base includes: Extracting category labels and data feature labels contained in each rule sequence in the rule base; The extracted category labels and data feature labels are deduplicated, and the deduplicated category labels and data feature labels are arranged in sequence to obtain a dictionary corresponding to the rule base.
27. The method according to claim 26, characterized in that The step of generating an index corresponding to each rule sequence according to each rule sequence included in the rule base and the search key includes: According to the arrangement positions of the category labels and data feature labels contained in the first rule sequence in the dictionary, an identification vector corresponding to the first rule sequence is generated, and the vector length of the identification vector is the same as the dictionary length of the dictionary; the first rule sequence is any of the rule sequences; An index corresponding to the first rule sequence is generated according to the identification vector corresponding to the first rule sequence and the search key.
28. A category recognition device, characterized in that: The device comprises: A query vector generation module, used to generate a query vector according to the data to be queried and a dictionary corresponding to a rule base; the rule base includes one or more encrypted rule sequences, each of which includes a category label and at least one data feature label, and the dictionary includes each category label and each data feature label in the rule base; A trapdoor generation module, used to generate a trapdoor according to the query vector and the search key corresponding to the rule base; A retrieval module, used to determine a target rule sequence according to the trapdoor and the indexes corresponding to each of the rule sequences; wherein the index corresponding to the first rule sequence is generated according to the first rule sequence and the search key, and the first rule sequence is any of the rule sequences; The decryption module is used to decrypt the ciphertext of the target rule sequence to obtain the target category label contained in the target rule sequence, and determine the target category corresponding to the data to be queried according to the target category label.
29. A rule base construction device, characterized in that: The device comprises: A preprocessing module, used to preprocess the sample data set to obtain a first sequence set, wherein the first sequence set includes M sample sequences in numerical format, each of the sample sequences includes a category label and at least one data feature label; M is a positive integer; a perturbation module, configured to perturb the first sequence set to obtain a second sequence set; A mining module, configured to perform frequent mining on the second sequence set to determine one or more regular sequences; A construction module is used to construct a rule base according to the one or more rule sequences, and encrypt the one or more rule sequences contained in the rule base.
30. An electronic device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor implements the method according to any one of claims 1 to 18 or 19 to 27.
31. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 18 or 19 to 27 is implemented.
Citation Information
Patent Citations
Ciphertext searching method and system supporting access control
CN108494768A
Classification method and related device
CN111177371A
Scene-based learning service pushing method, terminal and storage medium
CN111881347A
Intelligent stadium information encryption identification method and system based on cloud server
CN115587383A
Multi-user searchable encryption method and device based on block chain
CN115603934A
