Category identification method and device, rule base construction method and device, and electronic device

By preprocessing and encrypting the rule base using differential privacy technology and searchable encryption technology, the problem of data leakage in the rule base is solved, enabling secure and efficient category recognition and rule base construction, and improving data security and recognition accuracy.

CN118626519BActive Publication Date: 2026-11-20GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310214518.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-07
Publication Date
2026-11-20
Estimated Expiration
2043-03-07

AI Technical Summary

Technical Problem

Existing technologies pose a risk of data leakage during the construction of rule bases and category recognition, resulting in poor data security and impacting recognition accuracy.

Method used

Differential privacy technology is used to preprocess and perturb the training data to generate encrypted rule sequences. Searchable encryption technology is used for secure retrieval and matching to generate query vectors and trapdoors. The target rule sequence is determined by indexing and decryption to determine the category.

Benefits of technology

Without compromising recognition accuracy, it improves data security, reduces the risk of data leakage, and ensures data privacy protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626519B_ABST
    Figure CN118626519B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a category identification method and device, a rule base construction method and device, and an electronic device. The category identification method comprises: generating a query vector according to to-be-queried data and a dictionary corresponding to a rule base; the rule base comprises one or more encrypted rule sequences; generating a trapdoor according to the query vector and a search key corresponding to the rule base; determining a target rule sequence according to the trapdoor and an index corresponding to each rule sequence; wherein the index corresponding to a first rule sequence is generated according to the first rule sequence and the search key; decrypting the ciphertext of the target rule sequence to obtain a target category label contained in the target rule sequence, and determining a target category corresponding to the to-be-queried data according to the target category label. The category identification method and device, the rule base construction method and device, and the electronic device can improve data security and reduce the risk of data leakage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data technology, specifically to a category recognition method and apparatus, a rule base construction method and apparatus, and an electronic device. Background Technology

[0002] Big data technology is a technology for processing massive amounts of data, encompassing data filtering, data analysis, and data mining. With the rapid development of artificial intelligence (AI) applications across various fields, big data technology, which complements AI, is also maturing. Category recognition is one of the main application areas of AI. Currently, it typically involves using dimensionality reduction techniques to process training data, reducing its dimensionality to a fixed number. This fixed-dimensional training data is then perturbed and mined to find rule sequences and construct a rule base. When category recognition is needed, the rule base is searched and matched to obtain the recognition result. However, current methods of constructing rule bases and performing category recognition carry the risk of data leakage and have relatively poor data security. Summary of the Invention

[0003] This application discloses a category identification method and apparatus, a rule base construction method and apparatus, an electronic device, and a storage medium, which can improve data security and reduce the risk of data leakage.

[0004] This application discloses a category identification method, including: A query vector is generated 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 is 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 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 data to be queried is determined based on the target category label.

[0005] This application discloses a category identification device, the device comprising: The query vector generation module is used to 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; The trapdoor generation module is used to generate trapdoors based on the query vector and the search key corresponding to the rule base. The retrieval module is used to determine the target rule sequence 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 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 to determine the target category corresponding to the data to be queried based on the target category label.

[0006] This application discloses an electronic device, including a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor implements the category recognition method as described above.

[0007] This application discloses a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the category recognition method described above.

[0008] This application discloses a rule base construction method, including: The sample dataset is preprocessed to obtain a first sequence set, which includes M numerically formatted sample sequences, each of which includes a category label and at least one data feature label; where M is a positive integer. The first sequence set is perturbed to obtain the second sequence set; The second set of sequences is frequently mined to identify one or more regular sequences; A rule base is constructed based on the one or more rule sequences, and the one or more rule sequences contained in the rule base are encrypted.

[0009] This application discloses a rule base construction apparatus, the apparatus comprising: A preprocessing module is used to preprocess the sample dataset 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; A perturbation module is used to perturb the first sequence set to obtain a second sequence set; A mining module is used to frequently mine the second sequence set to determine one or more regular sequences; A construction module is used to construct a rule base based on the one or more rule sequences, and to encrypt the one or more rule sequences contained in the rule base.

[0010] This application discloses an electronic device, including a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor implements the rule base construction method described above.

[0011] This application discloses a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the rule base construction method described above.

[0012] This application discloses a category recognition method, apparatus, electronic device, and storage medium. A query vector is generated based on the data to be queried and a dictionary corresponding to a rule base. The rule base includes one or more encrypted rule sequences, each rule sequence including a category label and at least one data feature label. The dictionary includes each category label and each data feature label within the rule base. A trapdoor is generated based on the query vector and a search key corresponding to the rule base. A target rule sequence is determined based on the trapdoor and the indexes 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 based on the target category label. In this application embodiment, a query vector is generated using the dictionary of the rule base. A searchable encryption technology is used to search and match the encrypted rule base. This achieves secure retrieval and matching of the rule base without affecting recognition accuracy, avoiding data leakage of the rule base, improving data security, and reducing the risk of data leakage.

[0013] This application discloses a method, apparatus, electronic device, and storage medium for constructing a rule base. The method involves preprocessing a sample dataset to obtain a first sequence set, perturbing the first sequence set to obtain a second sequence set, and then performing frequent mining on the second sequence set to identify one or more rule sequences. A rule base is then constructed based on these one or more rule sequences, and the one or more rule sequences contained in the rule base are encrypted. In this application embodiment, converting the sample dataset into a first sequence set in numerical format and perturbing the first sequence set enhances data privacy, and encrypting the constructed rule base improves data security and reduces the risk of data leakage. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0015] Figure 1 A flowchart illustrating the process of building a rule base for related technologies; Figure 2 This is an application scenario diagram of the category recognition method and rule base construction method in one embodiment; Figure 3 Here is a flowchart of a category recognition method in one embodiment; Figure 4 A flowchart of a category identification method in another embodiment; Figure 5 Here is a flowchart of the category recognition method in yet another embodiment; Figure 6 This is a flowchart illustrating the preprocessing of a sample dataset in one embodiment; Figure 7 This is a flowchart illustrating the perturbation of a first set of sample sequences in one embodiment; Figure 8 This is a flowchart illustrating frequent mining of a second sample sequence set in one embodiment; Figure 9 Here is a flowchart of a rule base construction method in one embodiment; Figure 10 This is a block diagram of a category recognition device in one embodiment; Figure 11 This is a block diagram of a rule base construction apparatus in one embodiment; Figure 12 This is a structural block diagram of an electronic device in one embodiment. Detailed Implementation

[0016] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0017] It should be noted that the terms "comprising" and "having," and any variations thereof, in the embodiments and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the steps or units listed, 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.

[0018] 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 one element from another. 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.

[0019] Here is an introduction to some of the technical terms used in this application: Differential privacy: a technique in cryptography designed to maximize the accuracy of data retrieval when querying a statistical database, while minimizing the chance of identifying the records.

[0020] Searchable encryption technology: a technology that allows for the retrieval of encrypted text while ensuring security.

[0021] A trapdoor is a secret entrance to a program, allowing access without going through the usual security checks.

[0022] 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, and the less research value the data has after perturbation.

[0023] Global sensitivity: The global sensitivity of a function represents the maximum change in the query results of that function when a data set is modified.

[0024] Support: This indicates the frequency of a data item in the entire dataset. The higher the support, the more frequently the data item appears.

[0025] The implementation and application of artificial intelligence often rely on the analysis and mining of massive amounts of training data. This training data frequently contains sensitive personal data of users, which can easily lead to privacy breaches when using rule bases or AI models built upon it. Among related technologies, employing differential privacy techniques to protect training data can reduce the risk of user privacy leaks.

[0026] Figure 1 A flowchart illustrating the process of building a rule base in related technologies. For example... Figure 1 As shown, in related technologies, the methods for constructing a rule base mainly include the following steps: Step 102: Perform dimensionality reduction on the sequences in the training dataset.

[0027] Step 104: For each sequence in the dimensionality-reduced training dataset, randomly select a data item to perturb.

[0028] Step 106: Construct a prefix tree based on the perturbed training dataset.

[0029] Step 108: Depth-first traversal of the prefix tree to mine the candidate sequence set.

[0030] Step 110: Mine frequent sequences based on the candidate sequence set, and perturb the support during the mining process.

[0031] Step 112: Construct a rule base based on the frequent sequences obtained from mining.

[0032] In related technologies, for training datasets in sequence form, dimensionality reduction techniques can be used to reduce the dimensionality of the sequences in the training dataset to a fixed dimension. For example, the Johnson-Lindenstrauss (JL) dimensionality reduction technique can be used, constructing a projection matrix based on the JL lemma and using this projection matrix to reduce sequences of different dimensions in the training dataset to a fixed dimension. After dimensionality reduction, for each sequence in the dimensionality-reduced training dataset, a data item can be randomly selected as the user's sensitive information, and perturbed using a traditional random response mechanism. After perturbing the training dataset, a prefix tree can be constructed based on the perturbed training dataset. A candidate sequence set can be mined by depth-first traversing the prefix tree, and frequent sequences can be mined from the candidate sequence set. Simultaneously, during the mining process, the support of the candidate sequences in the candidate sequence set is perturbed, and candidate sequences with support exceeding a threshold are identified as frequent sequences, and a rule base is constructed. This rule base is stored in plaintext, and when it is needed for category recognition, retrieval and matching are performed using the plaintext rule base.

[0033] Regarding the schemes that use differential privacy technology to build rule bases, the following main problems exist: (1) For training data in sequence form, the current solution does not consider the relationship between sequence length and data availability. It simply transforms sequences of different lengths into sequences of fixed dimensions by dimensionality reduction and simply uses a random response mechanism to perturb the training data, which leads to a decrease in the availability of the perturbed sequence data. (2) Intermediate values ​​(such as support) generated during frequent sequence mining may still reveal user data characteristics, leading to indirect leakage of user privacy. In related technologies, noise is added to the support of candidate sequences during frequent sequence mining. This approach ignores the possibility of thresholds exposing user privacy, and the use of traditional Laplace mechanisms may change the relationship between the threshold and support, increasing the probability of incorrect filtering, reducing the recognition accuracy of the rule base subsequently constructed, and significantly impacting the usability of the classification results obtained. (3) The rule base stores the rule order that represents user data. If the rule base is stored in plain text, and if the rule base is stolen by a malicious attacker, it will directly expose the user's privacy data. The attacker can use the rule base to launch more targeted attacks. Currently, there is no effective protection for the rule base.

[0034] This application discloses a category identification method and apparatus, a rule base construction method and apparatus, an electronic device, and a storage medium. Based on differential privacy technology and searchable encryption technology, it achieves effective data protection, improves data security, and reduces the risk of data leakage.

[0035] Figure 2 This is an application scenario diagram of the category recognition method and rule base construction method in one embodiment. For example... Figure 2As shown, the category recognition method can be applied to terminal device 10, which may include, but is not limited to, mobile phones, wearable devices (smart glasses, smartwatches, etc.), tablets, laptops, PCs (Personal Computers), etc.; the rule base construction method can be applied to terminal device 10 or server 20, where server 20 can be a single server or a server cluster composed of multiple servers. The category recognition method and the rule base construction method can be applied to the same electronic device, such as both being applied to terminal devices 10, such as mobile phones, wearable devices, and tablets; alternatively, the category recognition method and the rule base construction method can be applied to different electronic devices, such as the rule base construction method being applied to server 20 and the category recognition method being applied to terminal device 10. After the server 20 completes the rule base construction, it can send the relevant data of the rule base to terminal device 10, where it is stored. Terminal device 10 can then use the stored rule base for category recognition.

[0036] In one embodiment, the electronic device may first construct a rule base. The electronic device may preprocess the sample dataset to obtain a first sequence set, which includes M numerically formatted sample sequences, each sample sequence including a category label and at least one data feature label, where M is a positive integer. The first sequence set may be perturbed to obtain a second sequence set, which may then be subjected to frequent mining to identify one or more rule sequences. A rule base is then constructed based on these one or more rule sequences, and the one or more rule sequences contained in the rule base are encrypted. The rule sequences in the rule base may be stored in ciphertext form.

[0037] 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 including a category label and at least one data feature label. The dictionary includes each category label and each data feature label within the rule base. A trapdoor can be generated based on the query vector and the search key corresponding to the rule base. A target rule sequence is determined based on the trapdoor and the index corresponding to each rule sequence. 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 can be 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.

[0038] like Figure 3As shown, in one embodiment, a category recognition method is provided, which can be applied to electronic devices, including but not limited to mobile phones, wearable devices (smart glasses, smartwatches, etc.), tablets, laptops, PCs, etc. The category recognition method may include the following steps: Step 310: Generate a query vector based on the data to be queried and the dictionary corresponding to the rule base.

[0039] The electronic device stores an encrypted rule base, which 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 is used to characterize the category of data, and the data feature label is used to characterize the data feature. If a rule sequence includes one category label and at least one data feature label, then the at least one data feature label can be used to characterize the data feature corresponding to the category label. The label format of the category label and data feature label may include, but is not limited to, any of the following: numeric format, character format, etc.

[0040] In this embodiment, the application scenarios of the rule base for category recognition are not limited; that is, the types of categories that the rule base can identify are not limited, and it mainly depends on the sample dataset used in the process of constructing the rule base. For example, the rule base can be used for user behavior prediction (or user behavior recognition) of end users. Each user behavior can belong to a category and correspond to a category label, such as watching videos, playing games, listening to music, reading novels, chatting, etc., which can each correspond to different category labels. As another example, the rule base can be used for scene recognition. Each scene can belong to a category and correspond to a category label, such as learning scenes, running scenes, walking scenes, working scenes, etc., for daily life scene recognition, or indoor scenes, outdoor scenes, going upstairs scenes, going downstairs scenes, etc., for location scene recognition, or backlighting scenes, night scenes, portrait scenes, scenery scenes, etc., for shooting scene recognition, etc. As yet another example, the rule base can also be used for emotion category recognition, such as happy, disappointed, excited, crying, etc., but is not limited to these.

[0041] 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 used for user behavior prediction. The various category labels in the rule base can be used to represent different user behavior categories in a table. The various data feature labels can be used to represent different device status characteristics of the terminal device, such as time characteristics (e.g., time), location characteristics (e.g., indoor or outdoor, whether at home or in the office), battery status characteristics (e.g., remaining battery power, whether charging), external device characteristics (e.g., connected headphone status), and network connection characteristics (e.g., whether Bluetooth or Wi-Fi is connected), but not limited to these. The rule sequence in the rule base can reflect the correlation between various user behavior categories and device status characteristics.

[0042] Electronic devices can acquire data to be queried, which may refer to data requiring category identification. In related technologies, the rule base is stored in plaintext, and the data to be queried can be converted into data feature labels to obtain a query sequence. This query sequence is then used to search and match within the rule base to find a target rule sequence that matches the query sequence. The category represented by the category label in the target rule sequence is the target category corresponding to the data to be queried. However, in this embodiment, the rule base is stored in encrypted form, so it is not possible to directly search and match the rule base using the data to be queried. This embodiment uses searchable encryption technology to achieve secure searching and matching of the encrypted rule base.

[0043] Electronic devices can generate query vectors based on the data to be queried and the dictionary corresponding to the rule base. The dictionary corresponding to the rule base can include all category labels and data feature labels within the rule base; that is, the dictionary can include all category labels and all data feature labels within the rule base. The category labels and data feature labels contained in the dictionary can be arranged sequentially. For example, if the category labels and data feature labels are in numerical format, then the category labels and data feature labels contained in the dictionary can be arranged in ascending order of numerical value; or, if the category labels and data feature labels are in character format, then the category labels and data feature labels contained in the dictionary can be arranged sequentially according to the order of their first letter within the 26 letters of the alphabet, and so on, but are not limited to these methods.

[0044] In one implementation, the data to be queried may include one or more feature data items, each of which is a feature data item. For example, the data to be queried may include "'Indoors', 'Headphones connected', 'Wi-Fi connected'", which may include three feature data items: "Indoors", "Headphones connected", and "Wi-Fi connected". Each feature data item in the data to be queried can be converted into a corresponding target data feature label to obtain a query sequence. The target data feature labels contained in the query sequence are then used as keywords to search in the dictionary corresponding to the rule base to generate a query vector based on the search results. The electronic device may store label conversion relationships, which can be used to define the correspondence between data items and labels, including the correspondence between category data items and category labels, and the correspondence between feature data items and data feature labels. Based on this label conversion relationship, each feature data item in the data to be queried can be converted into a corresponding target data feature label to obtain a query sequence.

[0045] For example, the label conversion relationship can be shown in Table 1.

[0046] Table 1

[0047] In this table, 1-41 are data feature labels, 42-44 are category labels, and 1-24 correspond one-to-one with 24 hours; 25 indicates being at the residence, 26 indicates not being at the residence; 27 indicates being indoors, 28 indicates not being indoors; 29-33 represent remaining battery power of 0%-20%, 21%-40%, 41%-60%, 61%-80%, and 81%-100%, respectively; 34 indicates charging, 35 indicates not charging; 36 indicates headphones are connected, 37 indicates headphones are not connected; 38 indicates Bluetooth is connected, 39 indicates Bluetooth is not connected; 40 indicates Wi-Fi is connected, 41 indicates Wi-Fi is not connected. It should be noted that Table 1 is only an example of label conversion relationships and is not intended to limit specific label conversion relationships.

[0048] Step 320: Generate a trapdoor based on the query vector and the search key corresponding to the rule base.

[0049] The electronic device can store the search key corresponding to the rule base. The search key refers to the 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 serve as an access point to the rule base, enabling the search and matching of the encrypted rule base.

[0050] Step 330: Determine the target rule sequence based on the trapdoor and the index corresponding to each rule sequence.

[0051] The electronic device can also store the indexes corresponding to each rule sequence in the rule base. The indexes corresponding to each rule sequence can be generated based on the rule sequence and the search key, and can be used to characterize the sequence features of each rule sequence. Taking the first rule sequence as an example, the first rule sequence can be any rule sequence, and the index corresponding to the first rule sequence is generated based on the first rule sequence and the search key.

[0052] Based on the generated trapdoors and the indexes corresponding to each rule sequence in the rule base, a search and matching process can be performed on each rule sequence to find the target rule sequence that matches the data to be queried. This target rule sequence that matches the data to be queried can refer to the rule sequence in the rule base that is most similar to the query sequence derived from the data to be queried.

[0053] As one 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 index corresponding to each rule sequence, the target rule sequence that matches the data to be queried can be searched from the encrypted rule base, ensuring the accuracy of the search.

[0054] 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 data to be queried based on the target category label.

[0055] The electronic device can decrypt the ciphertext of the target rule sequence according to the pre-stored decryption key to obtain the target rule sequence in plaintext form. It can also obtain the category label contained in the target rule sequence as the target category label, convert the target category label into the corresponding category data, and determine the target category corresponding to the data to be queried based on the category data.

[0056] In some embodiments, the category labels in each rule sequence can be arranged according to a set position. For example, the category labels can be arranged at the end of the rule sequence or at the beginning of the rule sequence, but are not limited to this. The label item of the target rule sequence at the set position can be obtained, and the content of the label item is the target category label. Then, the target category label is converted into category data according to the label conversion relationship to determine the target category. For example, the label item at the end of the target rule sequence can be obtained. If the content of the label item is "42", then the target category label is 42. According to the label conversion relationship shown in Table 1, the target category can be "watching videos".

[0057] As one specific implementation, the rule base can be applied to user behavior prediction, category tags can be used to characterize user behavior categories, and data feature tags can be used to characterize device status characteristics. The data to be queried may include device status data, which may include one or more of the following: time information, location information, battery status information, external device information, and network connection information. Specifically, location information may include geographic location information, whether it is a permanent residence, and whether it is indoors; battery status information may include remaining battery power, whether it is charging, and whether it is in power-saving mode; external device information may include whether an external device is connected and the type of the connected external device; and network connection information may include whether Bluetooth is connected, whether Wi-Fi is connected, and the current network signal strength.

[0058] Electronic devices can collect device status data and use this data as query data. This data is then searched and matched within an encrypted rule base to predict user behavior. First, the query data can be converted into a query sequence. For example, the query data "indoors, connected headphones, connected Wi-Fi" can be converted into the query sequence 27-36-40. This query sequence can be used as keywords to search in the dictionary corresponding to the rule base, generating a query vector. A trapdoor can be generated based on the query vector and search key. Based on the trapdoor and the indexes corresponding to each rule sequence, the target rule sequence can be determined. The ciphertext of the target rule sequence is then decrypted to obtain the target category label contained within it. For example, if the target category label is 42, the target category corresponding to the query data can be determined as "watching videos." Therefore, based on the device status data "indoors, connected headphones, connected Wi-Fi," the electronic device can predict that the user's likely behavior is "watching videos."

[0059] In some embodiments, after determining the target category corresponding to the data to be queried, a target operation can be performed based on the target category. This target operation can be used to provide services corresponding to the target category. Taking user behavior prediction as an example, if an electronic device predicts that the user's behavior is "watching videos" based on collected device status data, a video recommendation operation can be performed. This video recommendation operation can be used to recommend currently popular video data or video data that matches the user's interests to the user. This provides users with more targeted services and improves the user experience while protecting user privacy.

[0060] In this embodiment, a query vector is generated using a dictionary of the rule base. Based on the trapdoor generated using the search key and the index corresponding to each rule sequence, a search is performed in the rule base to find the target rule vector that matches the query vector. Searchable encryption technology is used to perform search and matching on the encrypted rule base. This achieves secure retrieval and matching of the rule base without affecting the recognition accuracy, avoids data leakage of the rule base, improves data security, and reduces the risk of data leakage.

[0061] like Figure 4 As shown, in another embodiment, a category identification method is provided, which can be applied to the above-described electronic device. This category identification method may include the following steps: Step 402: Convert the data to be queried into N target data feature labels; where N is a positive integer.

[0062] The data to be queried may include N feature data items. Each of the N feature data items can be converted into a corresponding target data feature label, resulting in N target data feature labels. Furthermore, based on the label conversion relationship, the N feature data items can be converted into N target data feature labels.

[0063] Step 404: Determine the arrangement position of each target data feature label in the dictionary, and generate a query vector based on the arrangement positions of the N target data feature labels respectively.

[0064] 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 are then deduplicated, and the deduplicated category labels and data feature labels are sequentially listed to obtain the dictionary corresponding to the rule base. Optionally, the arrangement of the category labels and data feature labels in the dictionary is not limited. For example, if the category labels and data feature labels are in numerical format, the category labels and data feature labels in the dictionary can be arranged in ascending order of numerical value. The length of the dictionary is the total number of category labels and data feature labels contained in the dictionary.

[0065] For example, the rule sequence contained in the rule base may be as shown in Table 2.

[0066] Table 2

[0067] The data feature labels and category labels contained in each rule sequence of the rule base can be extracted as keywords, and the obtained keywords are deduplicated. A dictionary ψ is generated based on the deduplicated keywords. Taking the rule base shown in Table 2 as an example, the data feature labels and category labels contained in the rule sequences f1~f4 can be extracted as keywords: 27, 36, 42, 27, 36, 40, 42, 26, 41, 43, 26, 37, 41, 43. After deduplicating the obtained keywords, the remaining keywords include: 27, 36, 42, 40, 26, 41, 43, 37. These can be arranged in ascending order of value to obtain the dictionary ψ=[26, 27, 36, 37, 40, 41, 42, 43], with a dictionary length Sizeψ=8.

[0068] After converting the data to be queried into N target data feature labels, a query vector can be generated based on the dictionary corresponding to the rule base and the N target data feature labels. The permutation position of each target data feature in the dictionary can be determined, and the query vector is generated based on the permutation positions of the N target data feature labels. The length of the query vector can be the same as the length of the dictionary. The N target data feature labels can be used as keywords to search the dictionary. If a target data feature label exists in the dictionary, its permutation position in the dictionary is determined, and the item in the query vector with the same permutation position is set to the first value. Other items in the query vector besides those set to the first value are set to the second value. For example, if the data to be queried is converted into 3 target data feature labels: 27, 36, 40, with permutation positions of 2, 3, and 5 in the dictionary respectively, then the 2nd, 3rd, and 5th items in the query vector can be set to 1, and the other items to 0, resulting in the query vector. =[0,1,1,0,1,0,0,0] T .

[0069] Step 406: Generate a trapdoor based on the query vector and the search key corresponding to the rule base.

[0070] In some embodiments, the search key corresponding to the rule base may include an invertible diagonal matrix and its inverse, wherein the order of the invertible diagonal matrix may be the same as the length of the dictionary. An invertible diagonal matrix H of order equal to the length of the dictionary can be randomly generated, and its inverse matrix H can be calculated from the invertible diagonal matrix H. -1 The invertible diagonal matrix H and its inverse matrix H -1 Used as a search key for the rule base. For example, randomly generate an invertible diagonal matrix H of order = dictionary length Sizeψ = 8:

[0071] The inverse matrix H can be calculated from the invertible diagonal matrix H. -1 :

[0072] In some embodiments, a trapdoor can be generated based on a query vector and the inverse of an invertible diagonal matrix. The trapdoor can be the dot product of the inverse of the invertible diagonal matrix and the query vector. The formula for calculating the trapdoor is shown in equation (1): Equation (1); Where Γ represents the trapdoor, H -1 Denotes the inverse of an invertible diagonal matrix. This represents the query vector.

[0073] Step 408: Calculate the query score for each rule sequence based on the trapdoor and the index corresponding to each rule sequence.

[0074] In some embodiments, the index corresponding to the first rule sequence is generated based on the identifier vector and search key of the first rule sequence. The first rule sequence is any rule sequence in the rule base, and the identifier vector of the first rule sequence can be used to represent the first rule sequence. Different rule sequences have different identifier vectors. The identifier vectors corresponding to each rule sequence can be generated first, and then the index corresponding to each rule sequence can be generated based on the identifier vectors and search key.

[0075] In one specific implementation, the identifier 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. The length of the identifier vector is the same as the length of the dictionary. The category labels and data feature labels contained in the first rule sequence can be used as keywords to search the dictionary. If the category label or data feature label exists in the dictionary, its arrangement position in the dictionary is determined, and the item in the identifier vector whose corresponding position is the same as that arrangement position is set to the first value. Other items in the identifier vector, except for the item set to the first value, can be set to the second value. For example, if the first rule sequence is 27-36-42, and its 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, resulting in the identifier vector [0,1,1,0,0,0,1,0].

[0076] For example, taking the rule base shown in Table 2 as an example, the dictionary ψ=[26, 27, 36, 37, 40, 41, 42, 43] can generate the identifier vectors corresponding to each rule sequence as shown in Table 3.

[0077] Table 3

[0078] The search key includes an invertible diagonal matrix and its inverse. The index corresponding to the first rule sequence is generated based on the first rule sequence and the transpose of the invertible diagonal matrix. Furthermore, the index corresponding to the first rule sequence is generated based on the identifier vector of the first rule sequence and the transpose of the invertible diagonal matrix. The index corresponding to the first rule sequence can be the dot product of the transpose of the invertible diagonal matrix and the identifier vector of the first rule sequence. The formula for generating the index corresponding to the rule sequence is shown in equation (2): Equation (2); in, Represents a regular sequence f i The corresponding identifier vector, HT Let H be the transpose of the invertible diagonal matrix. f i The corresponding indexes. For example, taking the identifier vectors of each rule sequence shown in Table 3 as an example, the indexes corresponding to each rule sequence generated can be shown in Table 4.

[0079] Table 4

[0080] 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 formula for calculating the query score corresponding to the rule sequence is shown in equation (3): Equation (3); in, Regular sequence f i The corresponding query score.

[0081] Step 410: Determine the rule sequence with the highest query score as the target rule sequence.

[0082] The query scores corresponding to each rule sequence can be compared, and the rule sequence with the highest query score can be determined and set as the target rule sequence. For example, the query scores corresponding to each rule sequence can be shown in Table 5.

[0083] Table 5

[0084] If the query score corresponding to rule sequence f2 is the highest, then rule sequence f2 can be determined as the target rule sequence that matches the data to be queried.

[0085] 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 based on the target category label.

[0086] Taking rule sequence f2 as an example, the ciphertext of rule sequence f2 can be decrypted to obtain rule sequence f2: 27-36-40-42. The category label 42 of rule sequence f2 can be obtained, and it can be determined that the target category corresponding to the data to be queried is "watching videos".

[0087] In some embodiments, after constructing the rule base, an encryption key and a decryption key can be generated. Each rule sequence in the rule base can be encrypted using the encryption key. When performing category identification, after finding a target rule sequence that matches the data to be queried, the ciphertext of the target rule sequence can be decrypted using the decryption key.

[0088] In one specific implementation, the encryption key may include an encryption key pair, and 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 can be randomly generated, and a first encryption key can be determined based on the first and second prime numbers. Then, a third prime number can be randomly selected as the second encryption key, where the third prime number satisfies the numerical condition associated with the first encryption key. A first decryption key can be determined based on the first and second encryption keys, and the first encryption key can be used as the second decryption key.

[0089] Furthermore, a first prime number γ and a second prime number δ can be randomly generated. The product of the first prime number and the second prime number is used as the first encryption key, n = γ × δ. Then φ(n) = (γ_1) × (δ_1), where φ(n) represents the Euler's totient function of the first encryption key n. A third prime number λ can be randomly selected as the second encryption key. The third prime number λ satisfies the numerical conditions: 1 < λ < φ(n) and Gcd(λ, φ(n)). = 1. Where Gcd(λ, φ(n)) represents the greatest common divisor of λ and φ(n). The first decryption key v can be determined based on the first encryption key n and the second encryption key λ, where the first decryption key v satisfies λv=1 mod φ(n), and the second decryption key can be equal to the first encryption key n. Thus, the encryption key pair (n, λ) and the decryption key pair (v, n) can be obtained.

[0090] Each rule sequence in the rule base can be encrypted using the encryption key pair (n, λ), and the resulting ciphertext... ,in, Represents a regular sequence f i The plain text content, This represents the rule sequence f i The encrypted ciphertext.

[0091] 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 is shown in equation (4): Equation (4); Among them, f max Represents the target rule sequence. The ciphertext representing the target rule sequence. This represents the plaintext content of the target rule sequence.

[0092] In this embodiment, a searchable encryption method is used to protect and securely retrieve the rule base. The use of encrypted retrieval ensures user privacy, improves data security, and does not affect the accuracy of category identification. Furthermore, because the dictionary corresponding to the rule base is relatively short, search and matching efficiency is improved, offering a significant efficiency advantage compared to traditional cryptographic methods.

[0093] Before using an encrypted rule base for category recognition, a differential privacy rule base is first constructed and then encrypted. For example... Figure 5 As shown, in another embodiment, a category identification method is provided, which can be applied to the above-described electronic device. The method may include the following steps: Step 502: Preprocess the sample dataset to obtain a first sequence set. The first sequence set includes M sample sequences in numerical format, each sample sequence including a category label and at least one data feature label; M is a positive integer.

[0094] Sample datasets can be used as training data for building rule bases. A sample dataset may contain a large number of data elements, each of which may include a category data item and at least one feature data item. The category data item represents the category corresponding to the data element, and the feature data item represents the data feature corresponding to the data element. Different sample datasets can be used for rule bases applied to different scenarios.

[0095] For example, for a rule base applied to user behavior prediction, the data elements in the sample dataset may include at least one device status feature data item and a user behavior category data item. The format of each data element in the sample dataset may be {"Time", "Whether at home", "Whether indoors", "Battery level", "Charging status", "Headphone status", "Bluetooth status", "Wi-Fi status", "Specific event"}, where "Time", "Whether at home", "Whether indoors", "Battery level", "Charging status", "Headphone status", "Bluetooth status", and "Wi-Fi status" are device status feature data items, and "Specific event" is a user behavior category data item.

[0096] For example, the sample dataset may include the following data elements: {"9:00", "null", "Indoors", "null", "null", "Headphones connected", "null", "Wi-Fi connected", "Watching video"}; {"22:00", "null", "Indoors", "93%", "null", "Headphones connected", "null", "Wi-Fi connected", "Watching video"}; {"17:00", "Not at home", "Not indoors", "75%", "null", "Headphones not connected", "null", "Wi-Fi is off", "Reading news"}; {"null", "Not at home", "Not indoors", "null", "null", "Headphones connected", "null", "Wi-Fi off", "Reading news"}; {"8:00", "Not at home", "Not indoors", "null", "null", "Headphones connected", "Bluetooth connected", "Wi-Fi off", "Listening to music"}.

[0097] In some embodiments, preprocessing the sample dataset may include two stages: Stage 1, format conversion of the sample dataset; Stage 2, data serialization, serializing each data item in the format-converted dataset. For example... Figure 6 As shown, step 502 involves preprocessing the sample dataset to obtain the first sequence set, which may include steps 602-604.

[0098] Step 602: The sample dataset is transformed according to the label transformation relationship to transform the category data items contained in each data element into the corresponding category label, and the feature data items contained in each data element into the corresponding data feature label, so as to obtain the data sequence corresponding to each data element.

[0099] Data elements in a sample dataset can be in text format, while category labels and data feature labels can be in numerical format. Text-formatted data elements can be converted into numerical data sequences. Label transformation relationships define the correspondence between data items and labels, with each label representing a different data meaning. Based on these relationships, the category data item of each data element in the sample dataset can be converted into its corresponding category label, and the feature data items contained in each data element can be converted into their corresponding data feature labels. Assuming a sample dataset D contains X data elements, where X is a positive integer, the text-formatted sample dataset D can be converted into a numerical-formatted dataset N={(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 Let r be the data sequence corresponding to the Xth data element. x1r x2 r xl These represent data feature labels or category labels.

[0100] For example, taking the label conversion relationship shown in Table 1 as an example, the sample dataset containing 5 data elements in the above example can be converted into 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)}.

[0101] Step 604: Generate M sample sequences based on the X data sequences corresponding to the X data elements to obtain a first sequence set containing the M sample sequences; the sample sequences are subsequences of any data sequence, and the M sample sequences are non-repeating and contain all subsequences with category labels of the X data sequences.

[0102] The sample dataset includes X data elements. The first sequence set contains M sample sequences, which are all subsequences with category labels in the X data sequences obtained by format conversion. The order of each label item in the sample sequence is consistent with the order in the data sequence.

[0103] In some embodiments, for each category, all data sequences corresponding to that category can be found. The data feature labels contained in each data sequence corresponding to that category are then permuted and combined. The data feature labels and category labels are then serialized according to their corresponding positions in the data elements to obtain all sub-sequences with category labels corresponding to that category, which serve as the sample sequences corresponding to that category. Taking the first category as an example, the first category can be any category, and it corresponds to a 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. Then, from all data sequences containing the first category label, all sub-sequences with the first category label are determined, thus obtaining the sample sequences corresponding to the first category.

[0104] 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 feature labels “9”, “27”, “36”, and “40” of the data sequence (9, 27”, “36”, and “40”) can be fully permuted and combined, and serialized according to the corresponding positions of the data feature labels “9”, “27”, “36”, and “40” in the data elements to obtain a subsequence containing the category label “42”. The obtained subsequences are shown in Table 6.

[0105] Table 6

[0106] For the data sequence (22,27,33,36,40,42), the same method can be used to obtain subsequences containing the category label "42". If multiple identical subsequences exist within the same category, only one subsequence is retained, thus obtaining unique sample sequences for each category. For example, for the data sequence (22,27,33,36,40,42), repeated subsequences such as 27-42 and 27-36-42 can be obtained, which can be discarded directly. After obtaining the sample sequences corresponding to each category, the sample sequences corresponding to each category can be added to the first sequence set T={S1, S2, S3,…, SM}.

[0107] As another implementation, all subsequences with category labels contained in the X data sequences can be directly determined, and the determined subsequences with category labels can be deduplicated to obtain M sample sequences, which form the first sequence set.

[0108] In this embodiment, a text-formatted sample dataset can be converted into a numerical-formatted sample sequence, thereby increasing the privacy of the training data and improving data security.

[0109] Step 504: Perturb the first sequence set to obtain the second sequence set.

[0110] In this embodiment of the application, a rule base can be constructed based on differential privacy technology. Noise can be added to the first sequence set to perturb the first sequence set and obtain the second sequence set.

[0111] As one implementation method, for each sample sequence in the first sequence set, a specific number of label items can be randomly selected from the sample sequence for perturbation. For example, one label item can be randomly selected from each sample sequence for perturbation. Perturbing the label items can involve randomly changing their values. For example, if the sample sequence is "29-42", label item "29" can be selected for perturbation, and a value can be randomly selected from 29 to 33.

[0112] As another implementation, a target number of sample sequences can be randomly selected from the first sequence set, and each label item in the selected sample sequences can be perturbed. For example, three sample sequences 27-40-42, 9-27-36-40-42, and 36-38-41-44 can be randomly selected, and each label item in the three random sample sequences can be perturbed.

[0113] like Figure 7 As shown, in one embodiment, step 504 perturbs the first sequence set to obtain a second sequence set, which may include steps 702-704.

[0114] Step 702: Determine the perturbation probability corresponding to each sample sequence based on the sequence length of each sample sequence.

[0115] The sequence length of a sample sequence refers to the number of label items it contains, that is, the sum of the number of data feature labels and category labels. For example, a sample sequence of 27-40-42 has a length of 3; a sample sequence of 36-38-41-44 has a length of 5. Based on the sequence length of each sample sequence, the perturbation probability corresponding to each sample sequence can be determined. The higher the perturbation probability of a sample sequence, the greater the likelihood that it will be selected for perturbation.

[0116] In some embodiments, for each category, the perturbation probability of each sample sequence corresponding to that category can be determined based on the sequence length of each sample sequence corresponding to that category. Taking the first category as an example, the first category can be any category, and the first category corresponds to a 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 based on the sequence length of each first sample sequence. Then, based on the sequence length of each first sample sequence and the total sequence length, the perturbation score corresponding to each first sample sequence can be determined. The perturbation probability corresponding to each first sample sequence can be determined based on the perturbation score corresponding to each first sample sequence using an exponential basis.

[0117] 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 method, the total sequence length can be calculated using equation (5): Equation (5); Where, r i Indicates category label; This indicates that the category label r is included. i sample sequence s j The sequence length, This indicates that the category label r is included. i The number of sequences in the sample sequence. Represents category label r i The corresponding total length of the sequence.

[0118] After determining the total length of the sequence corresponding to the first category label, a perturbation score can be determined for each first sample sequence based on its sequence length and the total sequence length. The perturbation score is positively correlated with the perturbation probability; the higher the perturbation score, the more likely the sample sequence is to be selected for perturbation. Optionally, the longer the first sample sequence, the higher the corresponding perturbation score can be, increasing the probability that longer sample sequences are selected for perturbation, thereby improving the data usability of the perturbated sample sequences.

[0119] As a specific implementation method, for each first sample sequence, the ratio of the sequence length of the first sample sequence to the total sequence length can be calculated first, and then 1 can be added to the ratio to obtain the perturbation score corresponding to the first sample sequence. The perturbation score corresponding to each first sample sequence can be calculated using equation (6): Equation (6); in, This indicates that the category label r is included. i sample sequence s k The sequence length, Represents category label r i The corresponding total sequence length, u(s) k ) represents the sample sequence s k The corresponding perturbation score.

[0120] For example, taking the sample sequences shown in Table 6 as an example, the perturbation scores corresponding to each sample sequence can be obtained as shown in Table 7.

[0121] Table 7

[0122] As shown in Table 7, the longer the sequence length of the sample sequence, the higher the corresponding perturbation score.

[0123] After determining the perturbation score corresponding to each first sample sequence, the perturbation probability corresponding to each first sample sequence can be determined based on the exponential basis. As one implementation method, a first global sensitivity can be determined based on the perturbation score corresponding to each first sample sequence, and then the perturbation probability corresponding to each first sample sequence can be determined based on the exponential function, the first privacy budget, the first global sensitivity, and the perturbation score corresponding to each first sample sequence.

[0124] The first global sensitivity can refer to the function used to calculate the perturbation fraction. (i.e., the global sensitivity corresponding to equation (6)). This first global sensitivity can be the maximum value among the absolute differences of the perturbation scores of any two first sample sequences, and the formula for calculating the first global sensitivity is shown in equation (7): Equation (7); Where, u(s) χ ) and u(s) Ω ) is any two elements containing the category label r i The perturbation score of the sample sequence.

[0125] The first privacy budget can be a preset value, such as first privacy budget ε1=0.4, but it is not limited to this.

[0126] As one specific implementation method, it can be based on... Using an exponential function with base , based on the first privacy budget, the first global sensitivity, and the perturbation score corresponding to each first sample sequence, the exponential result corresponding to each first sample sequence is calculated. The sum of the exponential results corresponding to each first sample sequence can also be calculated, and the ratio of the exponential result corresponding to each first sample sequence to the sum can be determined to obtain the perturbation probability corresponding to each first sample sequence. The formula for calculating the perturbation probability of a sample sequence is shown in equation (8): Equation (8); Wherein, Pr(s) k ) represents the category label r i sample sequence s k The corresponding perturbation probability, exp() represents an exponential function with base e. Δu represents the first global sensitivity, and ε1 represents the first privacy budget. This indicates that the category label r is included. i The number of sequences in the sample sequence. The sample sequence s was calculated. k The corresponding index results.

[0127] For example, taking the sample sequences shown in Table 6 as an example, the perturbation probabilities corresponding to each sample sequence can be obtained as shown in Table 8.

[0128] Table 8

[0129] This application provides a perturbation scheme that satisfies differential privacy. By constructing a perturbation score function that takes into account the sequence length of the sample sequence and the total sequence length of the corresponding category, the perturbation probability of each sample sequence is determined based on the calculated perturbation score. This improves data security, reduces the risk of data leakage, and enhances data availability. Furthermore, the random response mechanism used in related technologies is improved by taking into account the length of each sample sequence and introducing an exponential mechanism to determine the perturbation probability. Compared to sequence perturbation schemes in related technologies, this approach offers higher data security and greater data availability.

[0130] 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.

[0131] In some embodiments, the target number can be the sum of the perturbation numbers corresponding to each category label. There can be a one-to-one correspondence between category labels and perturbation numbers. The perturbation numbers for different category labels may be the same or different. The perturbation number for each category label can be determined based on the number of sequences corresponding to each category label. For each category label, a sample sequence corresponding to the perturbation number of the category label can be randomly selected for perturbation.

[0132] Taking the first category label as an example, the first category label can be any category label and corresponds to the first category. The number of perturbations corresponding to the first category label can be determined based on the number of sequences of the first sample sequence corresponding to the first category label. The first sample sequence is a sample sequence containing the first category label. Then, based on the perturbation probability corresponding to each first sample sequence, the first sample sequence with the number of perturbations is randomly selected as the sample sequence to be perturbed, and the sample sequence to be perturbed is perturbed.

[0133] In one specific implementation, the number of perturbations corresponding to the first category label can be determined based on the ratio of the number of sequences in the first sample sequence to the perturbation parameter, which can be preset. The number of perturbations corresponding to the category label. ,in, Represents category label r i The corresponding number of perturbations, This indicates that the category label r is included. i The number of sequences in the sample sequence. This represents the perturbation parameter. For example, suppose... =15, If the value is 5, then the category label r can be determined. i The corresponding number of perturbations is 3, and 3 perturbations containing the category label r can be randomly selected. i The sample sequence is used as the sample sequence to be perturbed.

[0134] In some embodiments, perturbing the sample sequence to be perturbed may include: determining the selection probability of each value for each label item based on the number of possible values ​​for each label item in the target sample sequence to be perturbed and the probability parameter corresponding to the number of possible values; and perturbing the value of each label item based on the selection probability of each value for each label item.

[0135] The target perturbation sample sequence can be any sample sequence. Each label has a different meaning and corresponding value. For example, the label representing time information has a value of 1 to 24, which is 24 possible values. The label representing battery power has a value of 29 to 33, which is 5 possible values.

[0136] Different probability parameters can be set for different numbers of possible values. As a specific implementation, tags can be divided into binary tags and multi-value tags based on the number of possible values ​​they correspond to. Binary tags are those with two possible values, and multi-value tags are those with more than two possible values. For example, a tag representing battery power has five possible values, making it a multi-value tag, while a tag representing Bluetooth status has two possible values, making it a binary tag. Binary tags can correspond to a first probability parameter, and multi-value tags can correspond to a second probability parameter.

[0137] For each label item in the target perturbation sample sequence, the selection probability of each value for that label item can be determined based on the number of possible values ​​and probability parameters. If the label item is a binary label item, the selection probability of each value for that label item can be determined using equation (9): Equation (9); Where, r l This represents the label item in the target perturbation sample sequence. Indicates the label item r l In another possible value of f, f represents the first probability parameter, and 0 <f<1,Pc(r l =r l Pc(r) represents the probability of choosing the value rl. l = ) indicates the possible values. The probability of selection. For example, taking a label representing whether it is indoors as an example, the possible values ​​are 27 and 28. Assume... If the value of this label item in the target perturbation sample sequence is 27, then the selection probability corresponding to the value 27 is... The probability of choosing a value of 28 is This means that the label item has [something] during the disturbance. The probability remains constant, and we have The probability is changed to 28. For binary label items, the privacy budget can be derived as follows: .

[0138] If the label item is a multi-valued label item, assuming the label item r l Total Given the possible values ​​for each tag r, then for that tag item r... l For the case where r is not currently in the target perturbation sample sequence, l For other possible values, the probability of selection can be: Where p represents the second probability parameter, i.e., the label term r in the target perturbation sample sequence. l have The probability is perturbed to some other value within the range. For the value r in the target perturbed sample sequence... l The selection probability can be the difference between 1 and the second probability parameter. For example, if the label representing battery power has 5 possible values, and its current value in the target perturbation sample sequence is 33, then during perturbation, this label has... The probability is perturbed to 29, and there is The probability is perturbed to 30, and there is The probability is perturbed to 31, and there is The probability is perturbed to 32, and there is a 1-p probability that remains unchanged at 33. For multi-valued labels, the privacy budget can be derived as follows: .

[0139] Optionally, after perturbing the sample sequence to be perturbed, the sample sequence to be perturbed in the first sequence set can be replaced with the perturbed sample sequence. That is, the target number of sample sequences in the first sequence set are replaced with the perturbed sample sequences, thereby obtaining the second sequence set. Optionally, the original sample sequences in the first sequence set can also remain unchanged, and the perturbed sample sequences can be directly added to the first sequence set, thereby obtaining the second sequence set.

[0140] In this embodiment, each label item in the sample sequence to be perturbed can be perturbed according to the number of possible values ​​of each label item and the probability parameter corresponding to the number of possible values. This ensures the rationality of each label item during perturbing, increases data privacy, improves data security, and enhances data availability.

[0141] Step 506: Frequently mine the second sequence set to identify one or more regular sequences.

[0142] Frequent mining refers to mining frequently occurring sample sequences within a second sequence set. By performing frequent mining on the second sequence set, frequent sample sequences can be identified and used as regular sequences. These frequent sample sequences can be those whose prefix support is greater than a support threshold. If the category label can be placed at the end of the sample sequence, then the prefix of the sample sequence can refer to the various label items (i.e., data feature labels) placed before the category label.

[0143] In this embodiment of the application, during the frequent mining of the second sequence set, the support and support threshold can be perturbed, and frequent sample sequences can be mined for each category. For example... Figure 8 As shown, in one embodiment, step 506 involves frequent mining of the second sequence set to determine one or more regular sequences, which may include steps 802-808.

[0144] Step 802: Add threshold noise to the support threshold to obtain the perturbation threshold.

[0145] A support threshold can be preset, which can be used to evaluate whether a prefix occurs frequently. In this embodiment, the support threshold can be perturbed by adding threshold noise to it, resulting in a perturbed threshold.

[0146] In one implementation, the electronic device can generate threshold noise based on a second privacy budget, and then superimpose the support threshold with the threshold noise to obtain the perturbation threshold. The second privacy budget can be set according to actual needs; for example, if the second privacy budget ε1 = 0.8, then the privacy budget for a given support threshold can be... The generated threshold noise can satisfy the first constraint condition, which may include threshold noise being greater than 0. The formula for calculating the perturbation threshold is shown in equation (10): Equation (10); Where α represents the support threshold, and noi ɑ ɑ' represents threshold noise, and ɑ' represents the perturbation threshold.

[0147] Step 804: Obtain at least one set of support corresponding to the second category label.

[0148] 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 one-to-one with the prefix length. 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. Five sets of support values ​​can be obtained for category label 42. The sets of support values ​​can include the support values ​​of each prefix (such as 9, 27, 36, 42, 40, 17, etc.) corresponding to the category label 42 and the length of the prefix.

[0149] In some embodiments, a projection database corresponding to each prefix length can be pre-constructed. The projection database corresponding to each prefix length can be constructed based on sample sequences with each prefix length. The projection database can map the relationship between each label item in the sample sequence. A first support set corresponding to the second category label can be obtained from the projection database corresponding to the first prefix length. The first prefix length is greater than 0 and less than the maximum sequence length corresponding to the second category label. The first prefix length can be any prefix length corresponding to the second category label.

[0150] For example, for a sample sequence containing class label 42, for the prefix length Len pre =3, which can be determined from the prefix length Len pre In the projection database corresponding to =3, obtain the support for each prefix (i.e., the data feature labels in the sample sequence containing category label 42), and obtain the support set C = {t1, t2, ..., t3}. n For example, for a sample sequence containing category label 42, for the prefix length Len pre =3, and the obtained support set C can be shown in Table 9.

[0151] Table 9

[0152] For other prefix lengths of the second category labels, the support set can be obtained from the corresponding projection database in the same way.

[0153] Step 806: Perturb at least one set of support.

[0154] The acquired support sets can be perturbed by adding noise to the supports within each set. For each support set, the mean support and a second global sensitivity can be calculated based on the supports contained in the set. A probability density function is then constructed based on the mean support, the second global sensitivity, and the second privacy budget. Based on the probability density function, the support noise corresponding to each support in the support set is determined. Finally, the corresponding support noise is added to each support in the support set to obtain the perturbed support set.

[0155] The mean support can be calculated using equation (11): Equation (11); Where s represents the size of the support set C (i.e., the number of supports it contains), μ c t represents the mean support of the support set C. j This represents the support of the j-th prefix in the support set C.

[0156] The second global sensitivity refers to the global sensitivity of the support set. The second global sensitivity can be the maximum value of the absolute difference between any two support values ​​in the support set. The formula for calculating the second global sensitivity is shown in equation (12): Equation (12); Where Δf represents the second global sensitivity of the support set C, and t χ and t Ω Let C be any two supports in the support set.

[0157] After calculating the mean support and the second global sensitivity of the support set, a probability density function can be constructed based on the mean support, the second global sensitivity, and the second privacy budget. Based on this probability density function, the support noise corresponding to each support in the support set is determined. The generated support noise follows a Laplace distribution. As a specific implementation, the probability density function can be shown in equations (13) and (14): Equation (13); Equation (14); Here, Pq() represents the probability density function. Based on the probability density function, support noise corresponding to each support in the support set can be generated. 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 support t... j Support noise is generated based on the above probability density function. The generated support noise can be determined. Does the second constraint condition satisfy? If the second constraint condition is satisfied, then the support t is... j Add support noise The perturbated support is obtained; if the second constraint condition is not met, the support noise can be regenerated. Until the generated support noise The second constraint condition is satisfied. Calculate the support t after the perturbation. j It can be shown in equation (15): Equation (15).

[0158] Using the above method, the perturbed support set C′={t1′,t2′,...,t n ′}.

[0159] For example, the perturbed support set C′ can be shown in Table 10.

[0160] Table 10

[0161] Step 808: Based on the perturbed support set and the perturbation threshold, mine the frequent sample sequences corresponding to the second category label from the second sequence set, and use the frequent sample sequences as regular sequences.

[0162] The perturbation set of support values ​​can be compared with a perturbation threshold to identify prefixes whose support is greater than the threshold. Frequent sample sequences are then extracted from the second sequence set based on these prefixes. Taking the first support set corresponding to the second category label as an example, the first support set corresponds to a first prefix length. Based on the perturbation set of the first support and the perturbation threshold, frequent sample sequences corresponding to the second category label and satisfying the first prefix length can be extracted from the second sequence set. The support values ​​of the perturbation set of the first support are compared with the perturbation threshold to identify prefixes whose support is greater than the threshold. The sample sequences corresponding to the first prefix length are obtained from these prefixes, which are the frequent sample sequences.

[0163] For example, taking the perturbed support set C′ shown in Table 10 as an example, assuming the support threshold is 5 and the perturbation threshold is 5.9732, the prefixes with support greater than the perturbation threshold can be found to include 27, 36, and 40. Then, the frequent sample sequence with a prefix length of 3 can be found in the second sequence set: 27-36-40-42.

[0164] For the support set corresponding to the second category label and other prefix lengths, the same perturbation method as above can be used, and the corresponding frequent sample sequences can be mined from the second sequence set based on the perturbation support set and the perturbation threshold.

[0165] For each category label, the same method as for the second category label described above 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 a rule base can be constructed using these rule sequences.

[0166] It should be noted that, for each support set, threshold noise can be regenerated to obtain a perturbation threshold; alternatively, the same perturbation threshold can be used for each support set corresponding to each category label; or, a perturbation threshold can be generated only once, and the support sets corresponding to all category labels can be compared using this perturbation threshold.

[0167] In this embodiment, during the frequent mining of the sample sequence, bounded noise is added to both the support threshold and the support. The noise magnitude is limited by a first constraint and a second constraint, ensuring that the relationship between the support threshold and the support remains unchanged before and after the perturbation. This reduces the probability of incorrect filtering and guarantees the rationality of the data. Compared to frequent mining methods in related technologies, this approach improves data usability, and the mining results from frequent mining are more accurate.

[0168] Step 508: Construct a rule base based on one or more rule sequences, and encrypt one or more rule sequences contained in the rule base.

[0169] Step 510: Generate the dictionary corresponding to the rule base and the search key corresponding to the rule base.

[0170] Step 512: Generate an index corresponding to each rule sequence based on each rule sequence and the search key.

[0171] Step 514: Convert the data to be queried into N target data feature labels.

[0172] Step 516: Determine the arrangement position of each target data feature label in the dictionary, and generate a query vector based on the arrangement positions of the N target data feature labels respectively.

[0173] Step 518: Generate a trapdoor based on the query vector and the search key corresponding to the rule base.

[0174] Step 520: Calculate the query score for each rule sequence based on the trapdoor and the index corresponding to each rule sequence.

[0175] Step 522: Determine the rule sequence with the highest query score as the target rule sequence.

[0176] 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 data to be queried based on the target category label.

[0177] The descriptions of steps 508 to 524 can be found in the relevant descriptions in the above embodiments, and will not be repeated here.

[0178] In this embodiment, 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 recognition is enhanced to protect the user's privacy information, enhance data security, and reduce the risk of data leakage.

[0179] like Figure 9 As shown, in one embodiment, a rule base construction method is provided, which can be applied to the above-mentioned electronic device. The rule base construction method may include the following steps: Step 910: Preprocess the sample dataset to obtain a first sequence set. The first sequence set includes M sample sequences in numerical format, each sample sequence including a category label and at least one data feature label. M is a positive integer.

[0180] In one embodiment, the sample dataset includes at least X data elements, where X is a positive integer. Step 910 may include: transforming the sample dataset according to the label transformation relationship to convert the category data items contained in each data element into corresponding category labels, and converting the feature data items contained in each data element into corresponding data feature labels, 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 containing the M sample sequences; the sample sequence is a subsequence of any data sequence, and the M sample sequences are non-repeating and contain all subsequences with category labels from the X data sequences.

[0181] Step 920: Perturb the first sequence set to obtain the second sequence set.

[0182] In one embodiment, step 920 may include: determining the perturbation probability corresponding to each sample sequence based on 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.

[0183] In one embodiment, the step of determining the perturbation probability corresponding to each sample sequence based on the sequence length of each sample sequence includes: 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 based on the sequence length of each first sample sequence; determining the perturbation score corresponding to each first sample sequence based on the sequence length of each first sample sequence and the total sequence length; and determining the perturbation probability corresponding to each first sample sequence based on the perturbation score of each first sample sequence using an exponential basis. Here, the first category label is any category label, and the first sample sequence is a sample sequence containing the first category label.

[0184] In one embodiment, the step of determining the perturbation probability of each first sample sequence based on the perturbation score of each first sample sequence includes: determining a first global sensitivity based on the perturbation score of each first sample sequence; and determining the perturbation probability of each first sample sequence based on the first privacy budget, the first global sensitivity, and the perturbation score of each first sample sequence using an exponential function.

[0185] In one embodiment, the step of 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: determining the perturbation quantity corresponding to the first category label based on the number of sequences of the first sample sequences corresponding to the first category label; randomly selecting the first sample sequences with the perturbation quantity as the 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 quantities corresponding to each category label is the target quantity.

[0186] In one embodiment, perturbing the sample sequence to be perturbed includes: determining the selection probability of each value for each label item based on the number of possible values ​​for each label item in the target sample sequence to be perturbed and a probability parameter corresponding to the number of possible values; and perturbing the value of each label item based on the selection probability of each possible value for each label item. Wherein, the target sample sequence to be perturbed is any sample sequence to be perturbed. Step 930: Frequently mine the second sequence set to identify one or more regular sequences.

[0187] 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 the second category label, wherein the second category label is any category label; perturbing the at least one support set; and mining frequent sample sequences corresponding to the second category label from the second sequence set based on the perturbed support set and the perturbation threshold, and using the frequent sample sequences as regular sequences.

[0188] In one embodiment, the step of adding threshold noise to the support threshold to obtain a perturbation threshold includes: generating threshold noise according to a second privacy budget; superimposing the support threshold with the threshold noise to obtain a perturbation threshold, wherein the threshold noise satisfies a first constraint condition, the first constraint condition including threshold noise being greater than 0.

[0189] 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 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 sample sequences with the first prefix length; The step involves mining frequent sample sequences corresponding to the second class label from the second sequence set based on the perturbation support set and the perturbation threshold, including: mining frequent sample sequences corresponding to the second class label and satisfying the first prefix length from the second sequence set based on the perturbation first support set and the perturbation threshold.

[0190] In one embodiment, the step of perturbing at least one support set includes: calculating a support mean and a second global sensitivity based on each support contained in the support set; determining the support noise corresponding to each support based on the probability density function, the support mean, and each support; and adding the corresponding support noise to each support in the support set to obtain the perturbed support set. The support noise follows a Laplace distribution and satisfies a second constraint condition, which includes that the support noise is greater than or equal to 0 and less than or equal to a threshold noise level.

[0191] Step 940: Construct a rule base based on one or more rule sequences, and encrypt one or more rule sequences contained in the rule base.

[0192] 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 based on each rule sequence contained in the rule base and the search key.

[0193] In one embodiment, the step of generating a dictionary corresponding to the rule base includes: extracting the 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 order to obtain the dictionary corresponding to the rule base.

[0194] In one embodiment, generating an index corresponding to each rule sequence based on the rule sequences and search keys contained in the rule base includes: generating an identifier vector corresponding to the first rule sequence based on the arrangement position of the category labels and data feature labels contained in the first rule sequence in the dictionary, wherein the vector length of the identifier vector is the same as the dictionary length; the first rule sequence is any rule sequence; and generating an index corresponding to the first rule sequence based on the identifier vector corresponding to the first rule sequence and the search key.

[0195] It should be noted that the description of the rule base construction method provided in the embodiments of this application can be referred to the relevant description of the category recognition method provided in the above embodiments, and will not be repeated here.

[0196] In this embodiment, the sample dataset is converted into a first sequence set in numerical format, and the first sequence set is perturbed to enhance data privacy. Furthermore, the constructed rule base is encrypted, improving data security and reducing the risk of data leakage. Based on differential privacy technology and searchable encryption technology, the entire process from rule base construction to category recognition using the rule base enhances data privacy, protecting user privacy information, enhancing data security, and reducing the risk of data leakage.

[0197] like Figure 10 As shown, in one embodiment, a category identification device 1000 is provided, which can be applied to the above-mentioned 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.

[0198] The query vector generation module 1010 is used to 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 including a category label and at least one data feature label. The dictionary includes each category label and each data feature label in the rule base.

[0199] The trapdoor generation module 1020 is used to generate trapdoors based on the query vector and the search key corresponding to the rule base.

[0200] The retrieval module 1030 is used to determine the target rule sequence 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.

[0201] 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 to determine the target category corresponding to the data to be queried based on the target category label.

[0202] 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 characteristics; and category tags are used to characterize user behavior categories.

[0203] In one embodiment, the category recognition device 1000 further includes a dictionary generation module.

[0204] The dictionary generation module is used to extract the category labels and data feature labels contained in each rule sequence in the rule base; to remove duplicates from the extracted category labels and data feature labels, and to arrange the deduplicated category labels and data feature labels in order to obtain the dictionary corresponding to the rule base.

[0205] In one embodiment, the query vector generation module 1010 is further configured 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 respectively; the length of the query vector is the same as the length of the dictionary.

[0206] In one embodiment, the index corresponding to the first rule sequence is generated based on the identifier vector of the first rule sequence and the search key; the identifier vector of the first rule sequence is generated based on 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 identifier vector is the same as the dictionary length.

[0207] In one embodiment, the search key includes an invertible diagonal matrix and its inverse; the order of the invertible diagonal matrix is ​​the same as the length of the dictionary; the index corresponding to the first rule sequence is generated based on the first rule sequence and the transpose of the invertible diagonal matrix.

[0208] The trapdoor generation module 1020 is also used to generate trapdoors based on the query vector and the inverse of the invertible diagonal matrix.

[0209] In one embodiment, the retrieval module 1030 is further configured to calculate the query score corresponding to each rule sequence based on 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.

[0210] In one embodiment, the category identification device 1000 further includes a preprocessing module, a perturbation module, a mining module, and a construction module.

[0211] The preprocessing module is used to preprocess the sample dataset to obtain a first sequence set, which includes M numerical sample sequences. Each sample sequence includes a category label and at least one data feature label; M is a positive integer.

[0212] The perturbation module is used to perturb the first sequence set to obtain the second sequence set.

[0213] The mining module is used to frequently mine the second set of sequences to identify one or more regular sequences.

[0214] The building module constructs a rule base based on one or more rule sequences and encrypts one or more rule sequences contained in the rule base.

[0215] In one embodiment, the sample dataset includes X data elements, where X is a positive integer. The preprocessing module is further configured to transform the sample dataset according to the label transformation relationship, so as 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, 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 containing M sample sequences; the sample sequence is a subsequence of any data sequence, and the M sample sequences are non-repeating and contain all subsequences with category labels from the X data sequences.

[0216] In one embodiment, the perturbation module includes a perturbation probability determination unit and a sequence perturbation unit.

[0217] The perturbation probability determination unit is used to determine the perturbation probability corresponding to each sample sequence based on the sequence length of each sample sequence.

[0218] 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.

[0219] In one embodiment, the perturbation probability determination unit is further configured 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; the total sequence length corresponding to the first category label is determined based on the sequence length of each first sample sequence; the perturbation score corresponding to each first sample sequence is determined based on the sequence length of each first sample sequence and the total sequence length; and the perturbation probability corresponding to each first sample sequence is determined based on the perturbation score corresponding to each first sample sequence using an exponential basis.

[0220] In one embodiment, the perturbation probability determination unit is further configured to determine a first global sensitivity based on the perturbation score corresponding to each first sample sequence; and to determine the perturbation probability corresponding to each first sample sequence based on an exponential function, according to a first privacy budget, the first global sensitivity, and the perturbation score corresponding to each first sample sequence.

[0221] In one embodiment, the sequence perturbation unit is further configured to determine the perturbation quantity corresponding to the first category label based on the number of sequences 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, the first sample sequence with the perturbation quantity is randomly selected as the sample sequence to be perturbed; the sample sequence to be perturbed is perturbed; wherein, the sum of the perturbation quantities corresponding to each category label is the target quantity.

[0222] In one embodiment, the sequence perturbation unit is further configured to determine the selection probability of each value corresponding to each label item based on the number of value cases corresponding to each label item contained in the target perturbation sample sequence and the probability parameter corresponding to the number of value cases; the target perturbation sample sequence is any sample sequence to be perturbed; and the value of each label item is perturbed based on the selection probability of each value case corresponding to each label item.

[0223] In one embodiment, the mining module includes a threshold perturbation unit, a support acquisition unit, a support perturbation unit, and a mining unit.

[0224] The threshold perturbation unit is used to add threshold noise to the support threshold to obtain the perturbation threshold.

[0225] The support acquisition unit is used to acquire at least one set of support corresponding to the second category label; the second category label can be any category label.

[0226] A support perturbation unit is used to perturb at least one set of support.

[0227] The mining unit mines frequent sample sequences corresponding to the second category label from the second sequence set based on the perturbed support set and the perturbation threshold, and uses the frequent sample sequences as regular sequences.

[0228] In one embodiment, the threshold perturbation unit is further configured to generate threshold noise according to a second privacy budget; and to superimpose the support threshold with the threshold noise to obtain a perturbation threshold, wherein the threshold noise satisfies a first constraint condition, the first constraint condition including that the threshold noise is greater than 0.

[0229] In one embodiment, the category label is placed at the end of the sample sequence. The support acquisition unit is further configured to acquire 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 sample sequences with the first prefix length. The mining unit is further configured to mine frequent sample sequences corresponding to the second category label and satisfying the first prefix length from the second sequence set according to the perturbated first support set and the perturbation threshold.

[0230] In one embodiment, the support perturbation unit is further configured to: calculate the support mean and a second global sensitivity based on each support contained in the support set; construct a probability density function based on the support mean, the second global sensitivity, and the second privacy budget; determine the support noise corresponding to each support based on the probability density function; the support noise satisfies a Laplace distribution and satisfies a second constraint condition, the second constraint condition including that the support noise is greater than or equal to 0 and less than or equal to a threshold noise; and add the corresponding support noise to each support in the support set to obtain the perturbed support set.

[0231] In this embodiment, 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 recognition is enhanced to protect the user's privacy information, enhance data security, and reduce the risk of data leakage.

[0232] like Figure 11 As shown, in one embodiment, a rule base construction apparatus 1100 is provided, which can be applied to the above-described electronic device. The rule base construction apparatus 1100 may include: a preprocessing module 1110, a perturbation module 1120, a mining module 1130, and a construction module 1140.

[0233] The preprocessing module 1110 is used to preprocess the sample dataset to obtain a first sequence set, which 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. The perturbation module 1120 is used to perturb the first sequence set to obtain the second sequence set.

[0234] Mining module 1130 is used to frequently mine the second sequence set to determine one or more regular sequences.

[0235] Module 1140 is used to build a rule base based on one or more rule sequences and to encrypt one or more rule sequences contained in the rule base.

[0236] In one embodiment, the sample dataset includes X data elements, where X is a positive integer. The preprocessing module 1110 is further configured to transform the sample dataset according to the label transformation relationship, converting the category data items contained in each data element into corresponding category labels, and converting the feature data items contained in each data element into corresponding data feature labels, 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 containing the M sample sequences; each sample sequence is a subsequence of any data sequence, and the M sample sequences are non-repeating and contain all subsequences with category labels from the X data sequences.

[0237] In one embodiment, the perturbation module 1120 includes a perturbation probability determination unit and a sequence perturbation unit.

[0238] The perturbation probability determination unit is used to determine the perturbation probability corresponding to each sample sequence based on the sequence length of each sample sequence.

[0239] 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.

[0240] In one embodiment, the perturbation probability determination unit is further configured 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; the total sequence length corresponding to the first category label is determined based on the sequence length of each first sample sequence; the perturbation score corresponding to each first sample sequence is determined based on the sequence length of each first sample sequence and the total sequence length; and the perturbation probability corresponding to each first sample sequence is determined based on the perturbation score corresponding to each first sample sequence using an exponential basis.

[0241] In one embodiment, the perturbation probability determination unit is further configured to determine a first global sensitivity based on the perturbation score corresponding to each first sample sequence; and to determine the perturbation probability corresponding to each first sample sequence based on an exponential function, according to a first privacy budget, the first global sensitivity, and the perturbation score corresponding to each first sample sequence.

[0242] In one embodiment, the sequence perturbation unit is further configured to determine the perturbation quantity corresponding to the first category label based on the number of sequences 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, the first sample sequence with the perturbation quantity is randomly selected as the sample sequence to be perturbed; the sample sequence to be perturbed is perturbed; wherein, the sum of the perturbation quantities corresponding to each category label is the target quantity.

[0243] In one embodiment, the sequence perturbation unit is further configured to determine the selection probability of each value corresponding to each label item based on the number of value cases corresponding to each label item contained in the target perturbation sample sequence and the probability parameter corresponding to the number of value cases; the target perturbation sample sequence is any sample sequence to be perturbed; and the value of each label item is perturbed based on the selection probability of each value case corresponding to each label item.

[0244] In one embodiment, the mining module 1130 includes a threshold perturbation unit, a support acquisition unit, a support perturbation unit, and a mining unit.

[0245] The threshold perturbation unit is used to add threshold noise to the support threshold to obtain the perturbation threshold.

[0246] The support acquisition unit is used to acquire at least one set of support corresponding to the second category label; the second category label can be any category label.

[0247] A support perturbation unit is used to perturb at least one set of support.

[0248] The mining unit mines frequent sample sequences corresponding to the second category label from the second sequence set based on the perturbed support set and the perturbation threshold, and uses the frequent sample sequences as regular sequences.

[0249] In one embodiment, the threshold perturbation unit is further configured to generate threshold noise according to a second privacy budget; and to superimpose the support threshold with the threshold noise to obtain a perturbation threshold, wherein the threshold noise satisfies a first constraint condition, the first constraint condition including that the threshold noise is greater than 0.

[0250] In one embodiment, the category label is placed at the end of the sample sequence. The support acquisition unit is further configured to acquire 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 sample sequences with the first prefix length. The mining unit is further configured to mine frequent sample sequences corresponding to the second category label and satisfying the first prefix length from the second sequence set according to the perturbated first support set and the perturbation threshold.

[0251] In one embodiment, the support perturbation unit is further configured to: calculate the support mean and a second global sensitivity based on each support contained in the support set; construct a probability density function based on the support mean, the second global sensitivity, and the second privacy budget; determine the support noise corresponding to each support based on the probability density function; the support noise satisfies a Laplace distribution and satisfies a second constraint condition, the second constraint condition including that the support noise is greater than or equal to 0 and less than or equal to a threshold noise; and add the corresponding support noise to each support in the support set to obtain the perturbed support set.

[0252] In one embodiment, the rule base construction device 1100 further includes a dictionary generation module, a key generation module, and an index generation module.

[0253] The dictionary generation module is used to generate dictionaries corresponding to the rule base.

[0254] The key generation module is used to generate search keys corresponding to the rule base.

[0255] The index generation module is used to generate an index corresponding to each rule sequence based on the rule sequences and search keys contained in the rule base.

[0256] In one embodiment, the dictionary generation module is further configured 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 order to obtain the dictionary corresponding to the rule base.

[0257] In one embodiment, the index generation module is further configured to generate an identifier vector corresponding to the first rule sequence based on the arrangement position of the category labels and data feature labels contained in the first rule sequence in the dictionary, wherein the vector length of the identifier vector is the same as the dictionary length; the first rule sequence is any rule sequence; and generate an index corresponding to the first rule sequence based on the identifier vector corresponding to the first rule sequence and the search key.

[0258] In this embodiment, the sample dataset is converted into a first sequence set in numerical format, and the first sequence set is perturbed to enhance data privacy. Furthermore, the constructed rule base is encrypted, improving data security and reducing the risk of data leakage. Based on differential privacy technology and searchable encryption technology, the entire process from rule base construction to category recognition using the rule base enhances data privacy, protecting user privacy information, enhancing data security, and reducing the risk of data leakage.

[0259] Figure 12 This is a structural block diagram of an electronic device in one embodiment. For example... Figure 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, which may be configured to implement the category recognition method as described in the above embodiments when executed by one or more processors 1210.

[0260] Processor 1210 may include one or more processing cores. Processor 1210 connects to various parts within the electronic device 1200 using various interfaces and lines, and performs various functions and processes data of the electronic device 1200 by running or executing instructions, programs, code sets, or instruction sets stored in memory 1220, and by calling data stored in memory 1220. Optionally, processor 1210 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 1210 may integrate one or more of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 1210 and may be implemented separately using a communication chip.

[0261] The memory 1220 may include random access memory (RAM) or read-only memory (ROM). The memory 1220 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 1220 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described above. The data storage area may also store data created by the electronic device 1200 during use.

[0262] Understandably, the electronic device 1200 may include more or fewer structural elements than those shown in the above block diagram, such as a power module, physical buttons, a WiFi (Wireless Fidelity) module, a speaker, a Bluetooth module, sensors, etc., and may not be limited herein.

[0263] This application discloses an electronic device, including a memory and a processor. The memory stores a computer program, which, when executed by the processor, causes the processor to implement the rule base construction method described in the above embodiments.

[0264] This application discloses a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the category recognition method as described in the above embodiments.

[0265] This application discloses a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the rule base construction method as described in the above embodiments.

[0266] This application discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program, when executed by a processor, implements the category identification method as described in the above embodiments.

[0267] This application discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program, when executed by a processor, implements the rule base construction method as described in the above embodiments.

[0268] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, ROM, etc.

[0269] Any references to memory, storage, databases, or other media used herein may include non-volatile and / or volatile memory. Suitable non-volatile memory may include ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which is used as an external cache memory. By way of illustration and not limitation, RAM may take many forms, such as Static RAM (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), Rambus DRAM (RDRAM), and Direct Rambus DRAM (DRDRAM).

[0270] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Those skilled in the art should also recognize that the embodiments described in the specification are optional embodiments, and the actions and modules involved are not necessarily essential to this application.

[0271] In the various embodiments of this application, it should be understood that the sequence number of each process does not necessarily imply 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 this application.

[0272] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they can be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0273] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0274] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above 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.

[0275] The foregoing has provided a detailed description of a category identification method and apparatus, a rule base construction method and apparatus, and an electronic device disclosed in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A category recognition method, characterized in that, include: A query vector is generated 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 is 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 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 data to be queried is determined based on the target category label; The data to be queried includes one or more feature data items. Generating a query vector based on the data to be queried and the dictionary corresponding to the rule base includes: The data to be queried is converted into N target data feature labels; where N is a positive integer. Each of the target data feature labels is used as a keyword to search in the dictionary corresponding to the rule base, and a query vector is generated based on the search results.

2. The method according to claim 1, characterized in that, The data to be queried includes device status data, which includes one or more of the following: time information, location information, battery status information, device information of external devices, and network connection information. The data feature labels are used to characterize device status features; The category labels are used to characterize user behavior categories.

3. The method according to claim 1, characterized in that, Before generating the query vector based on the data to be queried and the dictionary corresponding to the rule base, the method further includes: Extract the 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 order to obtain the dictionary corresponding to the rule base.

4. The method according to claim 3, characterized in that, The step of using each of the target data feature tags as keywords to search in the dictionary corresponding to the rule base, and generating a query vector based on the search results, includes: 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 respectively; the length of the query vector is the same as the length of the dictionary.

5. The method according to claim 3, characterized in that, The index corresponding to the first rule sequence is generated based on the identifier vector of the first rule sequence and the search key; The identifier vector of the first rule sequence is generated based on 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 identifier vector is the same as the dictionary length.

6. The method according to claim 1, characterized in that, The search key includes an invertible diagonal matrix and its inverse; the order of the invertible diagonal matrix is ​​the same as the length of the dictionary; the index corresponding to the first rule sequence is generated based on the first rule sequence and the transpose of the invertible diagonal matrix. The step of generating a trapdoor based on the query vector and the search key corresponding to the rule base includes: A trapdoor is generated based on the query vector and the inverse of the invertible diagonal matrix.

7. The method according to claim 1, characterized in that, The step of determining the target rule sequence based on the trapdoor and the index corresponding to each rule sequence includes: Based on the trapdoor and the index corresponding to each rule sequence, calculate the query score 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 format of the category label and data feature label includes a numerical format; before generating the query vector based on the data to be queried and the dictionary corresponding to the rule base, the method further includes: The sample dataset is preprocessed to obtain a first sequence set, which includes M numerically formatted sample sequences, each of which includes a category label and at least one data feature label; where M is a positive integer. The first sequence set is perturbed to obtain the second sequence set; The second set of sequences is frequently mined to identify one or more regular sequences; A rule base is constructed based on 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 dataset includes X data elements, where X is a positive integer; Each data element includes a category data item and at least one feature data item; The preprocessing of the sample dataset to obtain the first sequence set includes: The sample dataset is transformed according to the label transformation relationship to transform the category data items contained in each data element into corresponding category labels, and to transform the feature data items contained in each data element into corresponding data feature labels, so as to obtain the 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 containing the M sample sequences; the sample sequences are subsequences of any of the data sequences, and the M sample sequences are non-repeating and contain all subsequences with category labels from the X data sequences.

10. The method according to claim 8, characterized in that, The perturbation of the first sequence set includes: The perturbation probability corresponding to each sample sequence is determined based on the sequence length of each sample sequence; Based on the perturbation probability corresponding to each sample sequence, a target number of sample sequences are randomly selected from the first sequence set for perturbation.

11. The method according to claim 10, characterized in that, The step of determining the perturbation probability corresponding to each sample sequence based on the sequence length of each sample sequence includes: Obtain the sequence length of each first sample sequence corresponding to the first category label; the first category label is any of the aforementioned category labels, and the first sample sequence is a sample sequence containing the first category label; Based on the sequence length of each of the first sample sequences, determine the total sequence length corresponding to the first category label; The perturbation score corresponding to each first sample sequence is determined based on the sequence length of each first sample sequence and the total sequence length. Based on the exponential basis, the perturbation probability corresponding to each first sample sequence is determined according to the perturbation score corresponding to each first sample sequence.

12. The method according to claim 11, characterized in that, The method of determining the perturbation probability corresponding to each first sample sequence based on the perturbation score of each first sample sequence, using an exponential basis, includes: The first global sensitivity is determined based on the perturbation scores corresponding to each of the first sample sequences; Based on the exponential function, the perturbation probability corresponding to each first sample sequence is determined according to the first privacy budget, the first global sensitivity, and the perturbation score corresponding to each first sample sequence.

13. The method according to claim 10, characterized in that, The step of 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: The number of perturbations corresponding to the first category label is determined based on the number of sequences in the first sample sequence corresponding to the first category label; the first category label can be any of the aforementioned category labels, and the first sample sequence is a sample sequence containing the first category label; Based on the perturbation probability corresponding to each of the first sample sequences, the number of perturbations of the first sample sequences is randomly selected as the sample sequences to be perturbed; The sample sequence to be perturbed is perturbed; The sum of the perturbation quantities corresponding to each category label is the target quantity.

14. The method according to claim 13, characterized in that, The perturbation of the sample sequence to be perturbed includes: Based on the number of possible values ​​corresponding to each label item in the target sample sequence to be perturbed, and the probability parameter corresponding to the number of possible values, the selection probability of each possible value for each label item is determined; the target sample sequence to be perturbed is any of the sample sequences to be perturbed. The values ​​of each label item are perturbed based on the selection probability of each value corresponding to each label item.

15. The method according to claim 8, characterized in that, The step of frequently mining the second sequence set to determine one or more regular sequences includes: Add threshold noise to the support threshold to obtain the perturbation threshold; Obtain at least one set of support corresponding to the second category label; the second category label is any of the aforementioned category labels; The at least one set of support is perturbed; Based on 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 step of adding threshold noise to the support threshold to obtain the perturbation threshold includes: Threshold noise is generated based on the second privacy budget; The support threshold is superimposed with the threshold noise to obtain the perturbation threshold, wherein the threshold noise satisfies a first constraint condition, the first constraint condition including threshold noise greater than 0.

17. The method according to claim 15, characterized in that, The category labels are arranged at the very end of the sample sequence; obtaining at least one set of support corresponding to the second category label includes: From the projection database corresponding to the first prefix length, obtain the first support set corresponding to the second category label; 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 sample sequences with the first prefix length; The step of mining frequent sample sequences corresponding to the second category label from the second sequence set based on the perturbed support set and the perturbation threshold includes: Based on the perturbed first support set and the perturbation threshold, frequent sample sequences corresponding to the second category label and satisfying the first prefix length are mined from the second sequence set.

18. The method according to claim 16, characterized in that, The perturbation of the at least one set of support includes: Calculate the mean support and the second global sensitivity based on the support set. Construct a probability density function based on the mean support, the second global sensitivity, and the second privacy budget; Based on the probability density function, the support noise corresponding to each support is determined; the support noise satisfies a Laplace distribution and satisfies a second constraint condition, the second constraint condition including that the support noise is greater than or equal to 0 and less than or equal to the threshold noise; Add corresponding support noise to each support in the support set to obtain the perturbed support set.

19. A method for constructing a rule base, characterized in that, include: The sample dataset is preprocessed to obtain a first sequence set, which includes M numerical sample sequences, each of which includes a category label and at least one data feature label. M is a positive integer; The first sequence set is perturbed to obtain the second sequence set; The second set of sequences is frequently mined to identify one or more regular sequences; A rule base is constructed based on the one or more rule sequences, and the one or more rule sequences contained in the rule base are encrypted; The method further includes: Generate a dictionary corresponding to the rule base, the dictionary including each category label and each data feature label in the rule base; The dictionary is used to generate a query vector corresponding to the data to be queried. The query vector is obtained by converting the data to be queried into N target data feature labels, and then using each target data feature label as a keyword to search in the dictionary corresponding to the rule base. The query vector is used to generate a trapdoor with the search key corresponding to the rule base, where N is a positive integer.

20. The method according to claim 19, characterized in that, The sample dataset includes at least X data elements, where X is a positive integer; each data element includes a category data item and at least one feature data item. The preprocessing of the sample dataset to obtain the first sequence set includes: The sample dataset is transformed according to the label transformation relationship to transform the category data items contained in each data element into corresponding category labels, and to transform the feature data items contained in each data element into corresponding data feature labels, so as to obtain the 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 containing the M sample sequences; the sample sequences are subsequences of any of the data sequences, and the M sample sequences are non-repeating and contain all subsequences with category labels from the X data sequences.

21. The method according to claim 19, characterized in that, The perturbation of the first sequence set includes: The perturbation probability corresponding to each sample sequence is determined based on the sequence length of each sample sequence; Based on the perturbation probability corresponding to each sample sequence, a target number of sample sequences are randomly selected from the first sequence set for perturbation.

22. The method according to claim 21, characterized in that, The step of determining the perturbation probability corresponding to each sample sequence based on the sequence length of each sample sequence includes: Obtain the sequence length of each first sample sequence corresponding to the first category label; the first category label is any of the aforementioned category labels, and the first sample sequence is a sample sequence containing the first category label; Based on the sequence length of each of the first sample sequences, determine the total sequence length corresponding to the first category label; The perturbation score corresponding to each first sample sequence is determined based on the sequence length of each first sample sequence and the total sequence length. Based on the exponential basis, the perturbation probability corresponding to each first sample sequence is determined according to the perturbation score corresponding to each first sample sequence.

23. The method according to claim 19, characterized in that, The step of frequently mining the second sequence set to determine one or more regular sequences includes: Add threshold noise to the support threshold to obtain the perturbation threshold; Obtain at least one set of support corresponding to the second category label; the second category label is any of the aforementioned category labels; The at least one set of support is perturbed; Based on 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.

24. The method according to claim 23, characterized in that, The perturbation of the at least one set of support includes: Calculate the mean support and the second global sensitivity based on the support set. Based on the probability density function, the support noise corresponding to each support is determined according to the mean support and each support; the support noise satisfies a Laplace distribution and the support noise satisfies a second constraint condition, the second constraint condition including that the support noise is greater than or equal to 0 and less than or equal to the threshold noise; Add corresponding support noise to each support in the support set to obtain the perturbed support set.

25. The method according to any one of claims 19 to 24, characterized in that, The method further includes: Generate the search key corresponding to the rule base; Based on the rule sequences 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 process of generating the dictionary corresponding to the rule base includes: Extract the 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 order to obtain the 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 based on the rule sequence contained in the rule base and the search key includes: Based on the arrangement of the category labels and data feature labels contained in the first rule sequence in the dictionary, an identifier vector corresponding to the first rule sequence is generated, wherein the length of the identifier vector is the same as the length of the dictionary; the first rule sequence can be any of the rule sequences mentioned above. An index corresponding to the first rule sequence is generated based on the identifier vector corresponding to the first rule sequence and the search key.

28. A category recognition device, characterized in that, The device includes: The query vector generation module is used to 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; The trapdoor generation module is used to generate trapdoors based on the query vector and the search key corresponding to the rule base. The retrieval module is used to determine the target rule sequence 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 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 to determine the target category corresponding to the data to be queried based on the target category label; The query vector generation module is further configured to convert the data to be queried into N target data feature labels, and use each target data feature label as a keyword to search in the dictionary corresponding to the rule base, so as to generate a query vector based on the search results; where N is a positive integer.

29. A rule base construction apparatus, characterized in that, The device includes: A preprocessing module is used to preprocess the sample dataset 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; A perturbation module is used to perturb the first sequence set to obtain a second sequence set; A mining module is used to frequently mine the second sequence set to determine one or more regular sequences; A construction module is used to construct a rule base based on the one or more rule sequences, and to encrypt the one or more rule sequences contained in the rule base; A dictionary generation module is used to generate a dictionary corresponding to the rule base. The dictionary includes various category tags and various data feature tags within the rule base. The dictionary is used to generate a query vector corresponding to the data to be queried. The query vector is obtained by converting the data to be queried into N target data feature tags, and then using each target data feature tag as a keyword to search in the dictionary corresponding to the rule base. The query vector is used to generate a trapdoor with the search key corresponding to the rule base, where N is a positive integer.

30. An electronic device, characterized in that, The device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor causes the processor to perform the method as described in 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, it implements the method as described in any one of claims 1-18 or 19-27.

Citation Information

Patent Citations

  • 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