Feature library construction method and model training method
By constructing a feature library and using horizontal federated learning to train the model, the problem of difficult manual selection in existing mobile phone junk cleaning functions is solved, realizing intelligent file cleaning recommendations and improving user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MEIZU TECH CO LTD
- Filing Date
- 2021-11-17
- Publication Date
- 2026-05-01
AI Technical Summary
Existing mobile phone junk file cleaning functions require users to spend a lot of time and effort selecting which files to keep or delete, and the existing feature database is not suitable for recognizing file cleaning levels, resulting in a poor user experience.
By acquiring a sample set of files, extracting feature words and setting weights to build a feature library, and training a model using a horizontal federated learning system, a recommendation for file cleanup levels can be achieved.
It reduces the learning curve for users, provides better cleanup recommendations, makes it easier for users to quickly free up storage space, and solves the problem of users having trouble choosing which files to clean up.
Smart Images

Figure CN114064583B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and more specifically to a feature library construction method, a model training method, a feature library construction apparatus, and a horizontal federated learning system. Background Technology
[0002] With advancements in mobile phone hardware, storage space has increased significantly, with mainstream phones typically offering 64GB, 128GB, or 512GB of storage. However, due to the increasing size of mobile applications and the frequent use of storage functions such as videos and photos, insufficient storage space remains a common problem for mobile phone users. For example, insufficient storage not only affects normal use (such as the inability to download apps or files) but can also lead to lag and other issues impacting the user experience. Therefore, the need for a junk file cleanup function remains one of the core features of mobile phones.
[0003] Currently, mobile phone junk cleaning functions are mainly implemented through a combination of manual operation and automated analysis. They generally include: one-click cleaning or suggested cleaning (cleaning will not affect the software, and the default scan will be selected; this generally refers to junk in the pure sense) and deep cleaning (cleaning may or may not affect the software or the mobile phone system, and users need to think and choose actively).
[0004] The inventors' research found that the existing methods for implementing junk file cleaning functions are not only costly in terms of manpower and resources, but also require users to spend a lot of effort to consider and choose which files to keep and which to delete when they want to clean up further, resulting in high time costs and a poor user experience. In addition, there are existing methods for identifying spam emails through models, but the feature library used by this method is not suitable for identifying file cleaning levels. Summary of the Invention
[0005] This invention provides a feature library construction method, a model training method, a feature library construction device, and a horizontal federated learning system, which can effectively solve the above-mentioned problems.
[0006] One aspect of the present invention provides a feature library construction method, the method comprising: acquiring a first file sample set, the first file sample set including multiple file samples and a cleanup level for each file sample; extracting feature words that can affect the cleanup level of each file sample from the first file sample set; filtering the extracted feature words to obtain multiple effective feature words; setting a weight for each effective feature word; and constructing a feature library for recommending cleanup levels of files based on each effective feature word and its weight.
[0007] Optionally, the step of extracting feature words that can affect the cleanup level of each file sample in the first file sample set includes: extracting feature words that can affect the cleanup level of each file sample in the first file sample set from its inherent internal attributes; and / or extracting feature words that can affect the cleanup level of each file sample in the first file sample set from its external operational attributes.
[0008] Optionally, setting the weight of each effective feature word includes: obtaining a second file sample set, which includes a training set and a test set, each including multiple file samples and a cleanliness level for each file sample; selecting target feature words from all obtained effective feature words to determine the weights; extracting features matching the target feature words from multiple file samples in the training set, using the extracted features as input and the corresponding cleanliness level as output to train a pre-set machine learning model; extracting features matching the target feature words from multiple file samples in the test set, inputting the extracted features into the trained machine learning model to obtain the output cleanliness level; determining an indicator value to characterize the quality of the trained machine learning model based on the output cleanliness level and the corresponding cleanliness level in the test set; and determining the weight of the corresponding effective feature word based on the indicator value.
[0009] Optionally, the step of selecting the target feature word for determining the weight from all the obtained effective feature words includes: randomly selecting an effective feature word with an undetermined weight from all the obtained effective feature words as the target feature word; the step of determining the weight of the corresponding effective feature word according to the indicator value includes: determining the weight of the current target feature word according to the accuracy, precision and recall of the trained machine learning model.
[0010] Optionally, the step of selecting target feature words for determining weights from all obtained valid feature words includes: randomly removing one valid feature word whose weight has not been determined from all obtained valid feature words, and using all remaining valid feature words as the target feature word; the step of determining the weight of the corresponding valid feature word according to the indicator value includes: determining the weight of the currently removed valid feature word according to the accuracy, precision, and recall of the trained machine learning model.
[0011] Another aspect of the present invention provides a model training method applied to a horizontal federated learning system comprising a central server and multiple clients. The method includes: the central server randomly acquiring a machine learning model and distributing it to each client; each client acquiring a third file sample set, the third file sample set including multiple file samples and a cleanup level for each file sample, wherein each file sample in the third file sample set is generated by the client; the client extracting features from the multiple file samples in the third file sample set that match each effective feature word in a feature library, the feature library being obtained by the feature library construction method described in any of the above embodiments; the client using the features extracted from the third file sample set as input and the corresponding cleanup level as output to train the machine learning model, calculating the model gradient of the trained machine learning model, and uploading the model gradient to the central server; the central server aggregating the model gradients uploaded by each client and distributing the aggregation result to each client; and the client updating the model parameters of the trained machine learning model according to the aggregation result.
[0012] Optionally, the central server aggregates the model gradients uploaded by each client and sends the aggregation result to each client, including: the central server obtains a model identifier based on the aggregation result and sends the aggregation result and the model identifier to each client; wherein, when the aggregation result meets the expected threshold, the model identifier is a working identifier used to characterize that the updated machine learning model can work normally; when the aggregation result does not meet the expected threshold, the model identifier is a training identifier used to characterize that the updated machine learning model needs to continue training; after the client updates the model parameters of the trained machine learning model according to the aggregation result, the method further includes: when the model identifier is a working identifier, the client listens for whether it receives a garbage collection instruction, and if so, outputs the cleanup level of the local file according to the updated machine learning model; when the model identifier is a training identifier, the client continues to train the updated machine learning model.
[0013] Optionally, the central server randomly obtains a machine learning model and distributes it to each client, including: the central server randomly obtains a machine learning model and distributes the machine learning model and the training timing of the machine learning model to each client; the client obtains a third file sample set, including: when the client detects that the current time meets the training timing, it obtains the third file sample set.
[0014] Another aspect of the present invention provides a feature library construction apparatus, the apparatus comprising: an acquisition module for acquiring a first file sample set, the first file sample set including multiple file samples and a cleanup level for each file sample; an extraction module for extracting feature words that can affect the cleanup level of each file sample from each file sample in the first file sample set; a filtering module for filtering the extracted feature words to obtain multiple effective feature words; and a construction module for setting a weight for each effective feature word and constructing a feature library for recommending cleanup levels of files based on each effective feature word and its weight.
[0015] Another aspect of the present invention provides a horizontal federated learning system, the horizontal federated learning system comprising a central server and multiple clients: the central server is used to: randomly acquire a machine learning model and distribute it to each client, aggregate the model gradients uploaded by each client, and distribute the aggregation results to each client; the clients are used to: acquire a third file sample set, extract features from multiple file samples in the third file sample set that match each effective feature word in the feature library, use the features extracted from the third file sample set as input and the corresponding cleanup level as output to train the machine learning model, calculate the model gradient of the trained machine learning model, upload the model gradient to the central server, and update the model parameters of the trained machine learning model according to the aggregation results; wherein, the third file sample set includes multiple file samples and a cleanup level for each file sample, and each file sample in the third file sample set is generated by the client, and the feature library is obtained by the feature library construction method described in any of the above embodiments.
[0016] Another aspect of the present invention provides a non-transitory computer-readable storage medium having program instructions stored thereon, which, when executed by one or more processors, are used to implement the feature library construction method of the present invention.
[0017] This invention provides a feature library selection method for recommending file cleanup levels, enabling accurate training of a cleanup level model for recommendations regardless of the machine learning model used. To provide users with better recommendations, a large number of user terminal samples are needed; therefore, this application addresses the data silos and privacy issues of various terminal users through horizontal federated learning model training. Building upon existing cleanup functions, this invention provides users with enhanced cleanup recommendation capabilities, reducing user learning costs and facilitating the cleanup of more space. Attached Figure Description
[0018] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A schematic diagram of the existing Android storage architecture is shown;
[0020] Figure 2 A schematic diagram of the existing junk file storage structure is shown;
[0021] Figure 3 This diagram illustrates the effect of the cleaning function provided by the present invention.
[0022] Figure 4 A flowchart of the feature library construction method provided in Embodiment 1 of the present invention is shown;
[0023] Figure 5 A flowchart of the feature selection process provided in Embodiment 1 of the present invention is shown;
[0024] Figure 6 A flowchart of the model training method provided in Embodiment 2 of the present invention is shown;
[0025] Figure 7 A block diagram of the feature library construction apparatus provided in Embodiment 3 of the present invention is shown;
[0026] Figure 8 A block diagram of the model training apparatus provided in Embodiment 4 of the present invention is shown. Specific Implementation
[0027] As used herein, the terms "first," "second," etc., can be used to describe elements in exemplary embodiments of the present invention. These terms are used only to distinguish one element from another, and the inherent features or order of the corresponding elements are not limited by the term. Unless otherwise defined, all terms used herein (including technical or scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. Terms defined in common dictionaries are to be interpreted as having the same meaning as in the context of the relevant technical field, and not as having an ideal or overly formal meaning, unless explicitly defined as having such a meaning in this invention.
[0028] Those skilled in the art will understand that the apparatus and methods of the present invention described herein and illustrated in the accompanying drawings are non-limiting exemplary embodiments, and the scope of the invention is defined only by the claims. Features illustrated or described in conjunction with an exemplary embodiment may be combined with features of other embodiments. Such modifications and variations are included within the scope of the invention.
[0029] In the following description, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings. In the drawings, detailed descriptions of known functions or configurations are omitted to avoid unnecessarily obscuring the key technical aspects of the invention. Furthermore, throughout the description, the same reference numerals always refer to the same circuits, modules, or units, and for the sake of brevity, repeated descriptions of the same circuits, modules, or units are omitted.
[0030] Furthermore, it should be understood that one or more of the following methods or aspects can be performed by at least one control system, control unit, or controller. The terms "control unit," "controller," "control module," or "main control module" can refer to a hardware device including a memory and a processor. The memory or computer-readable storage medium is configured to store program instructions, and the processor is specifically configured to execute the program instructions to perform one or more processes, which will be further described below. Moreover, it should be understood that, as those skilled in the art will recognize, the following methods can be performed by including a processor in conjunction with one or more other components.
[0031] With advancements in mobile phone hardware, storage space has increased significantly, with mainstream phones typically offering 64GB, 128GB, or 512GB. However, due to the increasing size of mobile applications and the more frequent use of storage for functions like videos and photos, insufficient storage remains a common problem for mobile phone users. For example, after prolonged use, insufficient storage not only affects normal use (such as the inability to download software or files) but also leads to lag and other issues impacting the user experience. Furthermore, according to relevant surveys, a large number of users in China use low-end phones, and their storage space is still less than or equal to 64GB. The 2021 CCTV 3.15 Gala exposed problems with junk file cleaning software, particularly targeting elderly users with pop-up ads. Because their phones have lower specifications and smaller storage spaces, they are often vulnerable to malicious third-party junk software, further illustrating that junk file cleaning remains a primary function of mobile phones.
[0032] Currently, mainstream junk file cleaning software generally offers the following functions: one-click cleaning or suggested cleaning (cleaning has no impact on the software, and is scanned and selected by default; this generally refers to pure junk files) and deep cleaning (cleaning may or may not affect the software or phone system, requiring users to actively consider and choose). Regarding junk file cleaning, both ordinary and advanced users often need to carefully consider which junk files or applications on their phone (deep cleaning) can be deleted or uninstalled, and which should be kept, beyond what the cleaning software actively scans and selects for one-click cleaning. Indeed, junk file cleaning is a relatively advanced operation, and users often need to be particularly careful. Therefore, many users, when their phone storage is low, simply click on the cleaning software to scan and select items that can be safely cleaned by default. If storage is still insufficient, they need to spend a lot of effort considering and selecting, or simply don't know which to delete (such as middle-aged and elderly users).
[0033] For tasks requiring significant effort to consider and select which data to delete and which not to, the current mainstream approach combines manual operation with automated analysis to determine which data generated by a particular app is junk software and which is important data that cannot be deleted. Manual operation often accounts for a substantial portion of this process.
[0034] Additionally, consider this scenario: your parents ask you to help them further clean up junk files on their phones. We will consider various factors, such as the following:
[0035] 1. Have any unused software programs been installed? --- Consider the characteristics of the parents as a group.
[0036] 2. Have any unused software packages been downloaded? --- Consider the characteristics of the parents' group.
[0037] 3. Whether any unnecessary files were downloaded—this depends on the application to which the data file belongs and the content of the file.
[0038] 4. Delete files according to their size and importance—based on file format and content, etc.
[0039] 5. Data that is not important to applications such as WeChat and TikTok—determined based on file format and content, etc.
[0040] 6. Are there any photos in the album that need to be deleted? — This depends on the content of the photos, etc.
[0041] It is evident that the current market lacks sufficient "recommendations" for third-party junk cleaning functions. Users at different levels often experience significant confusion and concern when faced with limited storage space, resulting in a high learning curve and a lack of goal-oriented guidance.
[0042] Therefore, the inventors envisioned that the existing process of manually considering which files to keep and which to delete could be automated by artificial intelligence. Furthermore, the inventors discovered that the file storage structure in most Android systems is currently... Figure 1 As shown, in this storage structure, most junk files are generated from APP Data (application data). See [link / reference]. Figure 2 The definition of junk files is relatively narrow. From a user's perspective, junk files refer to expired or useless temporary files generated during the installation, use, and uninstallation of apps. However, in a broader sense, any data that users don't want can be considered junk files. The inventors also discovered that the data generated by each user in the junk file cleanup function exhibits similarities, similarities, and differences. For example, similarity: when using WeChat, files stored in folder A may be generated by the same function, but they are user-related, meaning the same software generates similar data. (If a large number of users delete this data, it indicates a lower risk of deletion). Similarity: multiple users forwarding the same video (such as a popular video) on WeChat – commonality suggests a lower risk of deletion. Difference: private files downloaded from WeChat, etc. In other words, across a large number of data and user samples, the purpose and approach of junk file cleanup are the same in terms of cleaning up and freeing up more storage space.
[0043] Based on this, Embodiment 1 of this application provides a feature library construction method, and Embodiment 2 provides a model training method. The feature library in Embodiment 1 helps Embodiment 2 train a model for recommending file cleanup levels, allowing users to determine file cleanup levels based on this model. The solution in this application does not replace existing cleanup functions on the market, but rather adds recommendation categories through artificial intelligence methods, enabling users to make quick decisions and free up more space. For details, please refer to... Figure 3 .
[0044] Example 1
[0045] Figure 4 A flowchart of the feature library construction method provided in Embodiment 1 of the present invention is shown, as follows: Figure 4 As shown, the feature library construction method may include steps A1 to A4, wherein:
[0046] Step A1: Obtain a first file sample set, which includes multiple file samples and the cleanup level of each file sample.
[0047] The cleanup level here can be set manually based on experience; the file sample can be a text sample or an application sample.
[0048] Step A2: Extract feature words that can affect the cleanup level of each file sample from the first file sample set.
[0049] Determining whether a file on a user's phone should / can be deleted involves many aspects (such as the scenario of cleaning up junk files for parents mentioned above), making it a complex process. Characterizing the content involved in these scenarios will result in numerous features, thus requiring feature engineering for selection. First, step A2 (i.e....) can be executed. Figure 5 The first step in constructing the candidate feature set 1) is to extract the feature words that can affect the cleaning level of each file sample. That is, the extracted feature words include the complete set of factor variables that affect whether or not to clean a certain file.
[0050] As an alternative embodiment:
[0051] Step A2 may include:
[0052] Extract feature words that can influence the cleanup level of each file sample from the inherent attributes of each file sample in the first file sample set; and / or
[0053] Extract feature words that can affect the cleanup level of each file sample from the external operation attributes of each file sample in the first file sample set.
[0054] Internal attributes may include: version number, security level, file name, file path, file size, file creation time, file name, whether it was created by a system application, file type (such as folder, text, image, video, etc.), file format / extension (.mp4, .apk, etc.), etc.
[0055] External operation attributes may include: whether the directory has been moved (multiple save paths), the most recent opening time, the total number of openings, the frequency of directory / folder cleanup, the difference between deletion and creation times, creation time, deletion time, access time, etc.
[0056] Step A3 involves filtering the extracted feature words to obtain multiple valid feature words.
[0057] Filtering processes may include Figure 5The remaining steps are as follows: First, feature selection algorithms are used for feature filtering. Since the relationship between feature variables and the recommendation to clean up is not linear based on preliminary estimates, a non-linear algorithm (such as a decision tree) is chosen for feature filtering. Second, dimensionality reduction is performed on the selected features. Because there are many features, the influence of some feature variables may be small, such as the layer depth of a file within a folder. Therefore, a suitable algorithm is needed for filtering and dimensionality reduction to obtain the most important candidate feature set 2. Finally, advanced feature extraction is performed on the features in candidate feature set 2. For example, some hidden features may have significant information gain, meaning that hidden features play a very important role in determining whether to clean up, such as the number of times a file is cleaned, its frequency, and the difference between deletion and creation times. All extracted features can then be used as the final effective feature words.
[0058] The valid keywords obtained include, but are not limited to: file name, file path, file size, file creation time, file name, whether it was created by a system application, file type (such as folder, text, image, video, etc.), file format / extension (.mp4, .apk, etc.), whether it has been moved to a directory (multiple save paths), last opened time, total number of times it has been opened, frequency of directory / folder cleanup, and the difference between deletion time and creation time.
[0059] Step A4: Set the weight of each effective feature word, and construct a feature library for the cleanup level of the recommendation file based on each effective feature word and its weight.
[0060] Determining whether a file should be deleted in the current mobile phone environment involves considering many variables. The final result is a holistic consideration, and the roles of each effective feature word may not be the same, so it is necessary to assign weights to them.
[0061] As an alternative embodiment:
[0062] The setting of the weight for each valid feature word includes:
[0063] Step A41: Obtain a second file sample set, which includes a training set and a test set. Both the training set and the test set include multiple file samples and the cleanup level of each file sample.
[0064] Step A42: Select the target feature words for determining the weights from all the obtained valid feature words;
[0065] Step A43: Extract features that match the target feature words from multiple file samples in the training set, and train the preset machine learning model using the features extracted from the training set as input and the corresponding cleanup level as output.
[0066] Step A44: Extract features that match the target feature words from multiple file samples in the test set, and input the features extracted from the test set into the trained machine learning model to obtain the output cleaning level;
[0067] Step A45: Based on the cleanup level of the output and the corresponding cleanup level in the test set, determine the index value used to characterize the quality of the trained machine learning model.
[0068] Step A46: Determine the weight of the corresponding effective feature word based on the index value.
[0069] In this embodiment, by executing steps A42 to A45, an index value can be determined. Each index value is used to determine the weight of the corresponding effective feature word. By repeating steps A42 to A45, the index value corresponding to each effective feature word can be determined, and then the weight of each effective feature word is determined based on each index value. Specifically, a preliminary weight can be determined through the index value. After determining the preliminary weight of each effective feature word, the determined preliminary weight can be normalized to obtain the final weight of each effective feature word. Then, the weights are sorted in descending order, and finally, redundancy and noise reduction processing is performed on the final result. The preset machine learning model can be a decision tree, support vector machine (SVM), etc.
[0070] As an alternative embodiment:
[0071] Step A42 may include:
[0072] Randomly select one effective feature word with an undetermined weight from all the obtained effective feature words, and use it as the target feature word;
[0073] Step A46 may include:
[0074] The weights of the current target feature words are determined based on the accuracy, precision, and recall of the trained machine learning model.
[0075] Pre-assigning weights to accuracy, precision, and recall, and then performing a weighted average, yields the initial weights for the current target feature words. Alternatively, the average of accuracy, precision, and recall can be used as the initial weight for the current target feature words. Finally, after obtaining the initial weights for all valid feature words, normalization is performed to obtain the weight for each valid feature word.
[0076] As an alternative embodiment:
[0077] Step A42 may include:
[0078] Randomly remove one valid feature word with an undetermined weight from all the obtained valid feature words, and use all the remaining valid feature words as the target feature word;
[0079] Step A46 may include:
[0080] The weights of the currently removed valid feature words are determined based on the accuracy, precision, and recall of the trained machine learning model.
[0081] Pre-assigning weights to accuracy, precision, and recall, and then performing a weighted average, yields the initial weights of the currently excluded valid feature words. Alternatively, the average of accuracy, precision, and recall can be used as the initial weights for the currently excluded valid feature words. Finally, after obtaining the initial weights for all valid feature words, normalization is performed to obtain the weight for each valid feature word.
[0082] Example 2
[0083] Figure 6 The flowchart shown is a model training method provided in Embodiment 2 of the present invention. This model training method is applied to a horizontal federated learning system containing a central server and multiple clients, such as... Figure 6 As shown, the model training method may include steps B1 to B6, wherein:
[0084] Step B1: The central server randomly obtains a machine learning model and distributes it to each client.
[0085] Step B2: The client obtains a third file sample set, which includes multiple file samples and the cleanup level of each file sample, and each file sample in the third file sample set is generated by the client.
[0086] Step B3: The client extracts features from multiple file samples in the third file sample set that match each valid feature word in the feature library, which is obtained by the method described in Example 1;
[0087] Step B4: The client uses the features extracted from the third file sample set as input and the corresponding cleaning level as output to train the machine learning model, calculates the model gradient of the trained machine learning model, and uploads the model gradient to the central server.
[0088] Step B5: The central server aggregates the model gradients uploaded by each client and sends the aggregation results to each client.
[0089] Step B6: The client updates the model parameters of the trained machine learning model according to the aggregation result.
[0090] The machine learning model here can be a decision tree, support vector machine (SVM), etc. To provide users with better recommendations, a large number of user terminal samples need to be combined, and federated learning can be used to address the data silos and privacy issues of various terminal users. In the data cleanup scenario, the data from multiple terminal users is characterized by identical features but some differences in user samples; therefore, horizontal federated learning can be employed. Horizontal federated learning is defined as an algorithm that, when samples with the same features are distributed among different participants, can comprehensively utilize data from all parties while ensuring data privacy for all parties.
[0091] The client can compute the model gradient locally and use encryption techniques such as homomorphic encryption
[35] , differential privacy
[148] or secret sharing
[115] to mask the model gradient, and send the masked result (referred to as encrypted gradient) to the central server. The central server performs secure aggregation, such as using weighted averaging based on homomorphic encryption [1, 203] (gradient averaging algorithm) for aggregation. Then the central server encrypts the aggregation result (new model gradient) and sends it to each client. After receiving the aggregation result (new model gradient), the client decrypts it and uses the decrypted aggregation result to update its own model parameters.
[0092] Each client can add a function switch (off by default), allowing users to choose whether or not to participate in training.
[0093] As an alternative embodiment:
[0094] Step B5 includes:
[0095] The central server obtains a model identifier based on the aggregation result and sends the aggregation result and the model identifier to each client.
[0096] Wherein, when the aggregation result meets the expected threshold, the model identifier is used to characterize that the updated machine learning model can work normally; when the aggregation result does not meet the expected threshold, the model identifier is used to characterize that the updated machine learning model needs to continue training.
[0097] Following step B6, the method further includes:
[0098] Step B7: When the model identifier is a working identifier, the client listens to see if it receives a garbage cleanup command. If so, it outputs the cleanup level of the local file according to the updated machine learning model.
[0099] Step B8: When the model identifier is a training identifier, the client continues to train the updated machine learning model.
[0100] When the model is identified as a training identifier, the central server can also send training opportunities to each client. The client can continue to train the updated machine learning model when the current time meets the training opportunity.
[0101] As an alternative embodiment:
[0102] Step B1 includes:
[0103] The central server randomly obtains a machine learning model and distributes the machine learning model and the training time of the machine learning model to each client.
[0104] Step B2 includes:
[0105] When the client detects that the current moment meets the training opportunity, it obtains the third file sample set.
[0106] Training can be scheduled at fixed times, such as 3 or 5 o'clock, or under fixed conditions, such as when the phone is charging or when the phone is idle, to minimize disruption to the user experience.
[0107] Example 3
[0108] Embodiment 3 of the present invention also provides a feature library construction apparatus, which corresponds to the feature library construction method provided in Embodiment 1 above. The corresponding technical features and effects are not detailed in this embodiment; relevant aspects can be referred to in Embodiment 1 above. Specifically, Figure 7 A block diagram of a feature library construction apparatus provided in Embodiment 3 of the present invention is shown. Figure 7 As shown, the feature library construction device 700 may include an acquisition module 701, an extraction module 702, a filtering module 703, and a construction module 704, wherein:
[0109] The acquisition module 701 is used to acquire a first file sample set, which includes multiple file samples and the cleanup level of each file sample;
[0110] Extraction module 702 is used to extract feature words that can affect the cleaning level of each file sample from the first file sample set;
[0111] The filtering module 703 is used to filter the extracted feature words to obtain multiple effective feature words;
[0112] Module 704 is used to set the weight of each effective feature word and build a feature library for the cleanup level of the recommendation file based on each effective feature word and its weight.
[0113] Optionally, the extraction module is specifically used to: extract feature words that can affect the cleanup level of each file sample from the internal inherent attributes of each file sample in the first file sample set; and / or extract feature words that can affect the cleanup level of each file sample from the external operational attributes of each file sample in the first file sample set.
[0114] Optionally, when setting the weight of each effective feature word, the construction module specifically performs the following steps: acquiring a second file sample set, which includes a training set and a test set, each containing multiple file samples and a cleanliness level for each file sample; selecting target feature words from all acquired effective feature words to determine the weights; extracting features matching the target feature words from the multiple file samples in the training set, using the extracted features as input and the corresponding cleanliness level as output to train a pre-set machine learning model; extracting features matching the target feature words from the multiple file samples in the test set, inputting the extracted features into the trained machine learning model to obtain the output cleanliness level; determining an indicator value to characterize the quality of the trained machine learning model based on the output cleanliness level and the corresponding cleanliness level in the test set; and determining the weight of the corresponding effective feature word based on the indicator value.
[0115] Optionally, when the construction module performs the process of selecting target feature words for determining weights from all obtained valid feature words, it specifically performs the following: randomly selecting a valid feature word with an undetermined weight from all obtained valid feature words as the target feature word; when the construction module performs the process of determining the weight of the corresponding valid feature word based on the indicator value, it specifically performs the following: determining the weight of the current target feature word based on the accuracy, precision, and recall of the trained machine learning model.
[0116] Optionally, when the construction module performs the process of selecting target feature words for determining weights from all obtained valid feature words, it specifically performs the following steps: randomly remove one valid feature word whose weight has not been determined from all obtained valid feature words, and use all remaining valid feature words as the target feature word; when the construction module performs the process of determining the weight of the corresponding valid feature word based on the indicator value, it specifically performs the following steps: determine the weight of the currently removed valid feature word based on the accuracy, precision, and recall of the trained machine learning model.
[0117] Example 4
[0118] Embodiment 4 of the present invention also provides a horizontal federated learning system, which corresponds to the model training method provided in Embodiment 2 above. The corresponding technical features and effects are not detailed in this embodiment; relevant aspects can be referred to in Embodiment 2 above. Specifically, Figure 8 A block diagram of the horizontal federated learning system provided in Embodiment 4 of the present invention is shown. Figure 8 As shown, the horizontal federated learning system 800 may include a central server 801 and multiple clients 802, wherein:
[0119] The central server 801 is used to: randomly obtain a machine learning model and send it to each client 802, aggregate the model gradients uploaded by each client 802, and send the aggregation result to each client 802;
[0120] The client 802 is used to: obtain a third file sample set, extract features from multiple file samples in the third file sample set that match each effective feature word in the feature library, use the features extracted from the third file sample set as input and the corresponding cleaning level as output to train the machine learning model, calculate the model gradient of the trained machine learning model, upload the model gradient to the central server 801, and update the model parameters of the trained machine learning model according to the aggregation result.
[0121] The third file sample set includes multiple file samples and the cleanup level of each file sample, and each file sample in the third file sample set is generated by the client. The feature library is obtained by the method described in Embodiment 1.
[0122] Optionally, when the central server aggregates the model gradients uploaded by each client and sends the aggregation result to each client, it specifically performs the following: obtains a model identifier based on the aggregation result, and sends the aggregation result and the model identifier to each client; wherein, when the aggregation result meets the expected threshold, the model identifier is a working identifier used to characterize that the updated machine learning model can work normally; when the aggregation result does not meet the expected threshold, the model identifier is a training identifier used to characterize that the updated machine learning model needs to continue training; after the client updates the model parameters of the trained machine learning model according to the aggregation result, it further performs the following: when the model identifier is a working identifier, the client listens for whether it has received a garbage collection instruction, and if so, outputs the cleanup level of the local file according to the updated machine learning model; when the model identifier is a training identifier, the client continues to train the updated machine learning model.
[0123] Optionally, when the central server executes the random acquisition of a machine learning model and distributes it to each client, it is specifically used to: randomly acquire a machine learning model and distribute the machine learning model and the training timing of the machine learning model to each client; when the client executes the acquisition of a third file sample set, it is specifically used to: acquire the third file sample set when it detects that the current time meets the training timing.
[0124] Example 5
[0125] This embodiment also provides a computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, server, App application store, etc., which stores a computer program. When the computer program is executed by a processor, it implements the steps of the feature library construction method.
[0126] Obviously, those skilled in the art should understand that the modules or steps of the above-described embodiments of the present invention can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the embodiments of the present invention are not limited to any particular hardware and software combination.
[0127] It should be noted that the sequence numbers of the embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0128] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0129] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A method for constructing a feature library, characterized in that, The method includes: Obtain a first file sample set, which includes multiple file samples and the cleanup level of each file sample; Extract feature words that can affect the cleanup level of each file sample from the first file sample set; The extracted feature words are filtered to obtain multiple effective feature words; Set the weight of each effective feature word, and construct a feature library for the cleanup level of the recommendation file based on each effective feature word and its weight; The setting of the weight for each valid feature word includes: Obtain a second file sample set, which includes a training set and a test set. Both the training set and the test set include multiple file samples and the cleanup level of each file sample. Select target feature words for determining weights from all the obtained valid feature words; Features matching the target feature words are extracted from multiple file samples in the training set. The features extracted from the training set are used as input and the corresponding cleanup level is used as output to train a pre-set machine learning model. Features matching the target feature words are extracted from multiple file samples in the test set. The features extracted from the test set are then input into a trained machine learning model to obtain the output cleaning level. Based on the cleanup level of the output and the corresponding cleanup level in the test set, determine the index value used to characterize the quality of the trained machine learning model. The weights of the corresponding effective feature words are determined based on the index values.
2. The method according to claim 1, characterized in that, The step of extracting feature words that can affect the cleanup level of each file sample in the first file sample set includes: Extract feature words that can influence the cleanup level of each file sample from the inherent attributes of each file sample in the first file sample set; and / or Extract feature words that can affect the cleanup level of each file sample from the external operation attributes of each file sample in the first file sample set.
3. The method according to claim 1, characterized in that, The step of selecting target feature words for determining weights from all obtained valid feature words includes: Randomly select one effective feature word with an undetermined weight from all the obtained effective feature words, and use it as the target feature word; The step of determining the weight of the corresponding effective feature word based on the index value includes: The weights of the current target feature words are determined based on the accuracy, precision, and recall of the trained machine learning model.
4. The method according to claim 1, characterized in that, The step of selecting target feature words for determining weights from all obtained valid feature words includes: Randomly remove one valid feature word with an undetermined weight from all the obtained valid feature words, and use all the remaining valid feature words as the target feature word; The step of determining the weight of the corresponding effective feature word based on the index value includes: The weights of the currently removed valid feature words are determined based on the accuracy, precision, and recall of the trained machine learning model.
5. A model training method, characterized in that, The method, applied to a horizontal federated learning system comprising a central server and multiple clients, includes: The central server randomly selects a machine learning model and distributes it to each client. The client obtains a third file sample set, which includes multiple file samples and the cleanup level of each file sample, and each file sample in the third file sample set is generated by the client. The client extracts features from multiple file samples in the third file sample set that match each valid feature word in the feature library, which is obtained by the method described in any one of claims 1 to 4; The client uses the features extracted from the third file sample set as input and the corresponding cleaning level as output to train the machine learning model, calculates the model gradient of the trained machine learning model, and uploads the model gradient to the central server. The central server aggregates the model gradients uploaded by each client and sends the aggregation results back to each client. The client updates the model parameters of the trained machine learning model according to the aggregation results.
6. The method according to claim 5, characterized in that, The central server aggregates the model gradients uploaded by each client and sends the aggregation results back to each client, including: The central server obtains a model identifier based on the aggregation result and sends the aggregation result and the model identifier to each client. Wherein, when the aggregation result meets the expected threshold, the model identifier is used to characterize that the updated machine learning model can work normally; when the aggregation result does not meet the expected threshold, the model identifier is used to characterize that the updated machine learning model needs to continue training. After the client updates the model parameters of the trained machine learning model according to the aggregation result, the method further includes: When the model is identified as a working identifier, the client listens to see if it receives a garbage cleanup command. If so, it outputs the cleanup level of the local file according to the updated machine learning model. When the model identifier is a training identifier, the client continues to train the updated machine learning model.
7. The method according to claim 5, characterized in that, The central server randomly selects a machine learning model and distributes it to each client, including: The central server randomly obtains a machine learning model and distributes the machine learning model and the training time of the machine learning model to each client. The client obtains a third file sample set, including: When the client detects that the current moment meets the training opportunity, it obtains the third file sample set.
8. A feature library construction apparatus, characterized in that, The device includes: The acquisition module is used to acquire a first file sample set, which includes multiple file samples and the cleanup level of each file sample; An extraction module is used to extract feature words that can affect the cleaning level of each file sample from the first file sample set; The filtering module is used to filter the extracted feature words to obtain multiple effective feature words; The module is used to set the weight of each effective feature word and build a feature library for the cleanup level of the recommendation file based on each effective feature word and its weight. The setting of the weight for each valid feature word includes: Obtain a second file sample set, which includes a training set and a test set. Both the training set and the test set include multiple file samples and the cleanup level of each file sample. Select target feature words for determining weights from all the obtained valid feature words; Features matching the target feature words are extracted from multiple file samples in the training set. The features extracted from the training set are used as input and the corresponding cleanup level is used as output to train a pre-set machine learning model. Features matching the target feature words are extracted from multiple file samples in the test set. The features extracted from the test set are then input into a trained machine learning model to obtain the output cleaning level. Based on the cleanup level of the output and the corresponding cleanup level in the test set, determine the index value used to characterize the quality of the trained machine learning model. The weights of the corresponding effective feature words are determined based on the index values.
9. A horizontal federated learning system, characterized in that, The horizontal federated learning system comprises a central server and multiple clients: The central server is used to: randomly obtain a machine learning model and distribute it to each client, aggregate the model gradients uploaded by each client, and distribute the aggregation results to each client; The client is used to: obtain a third file sample set, extract features from multiple file samples in the third file sample set that match each effective feature word in the feature library, train the machine learning model using the features extracted from the third file sample set as input and the corresponding cleaning level as output, calculate the model gradient of the trained machine learning model, upload the model gradient to the central server, and update the model parameters of the trained machine learning model according to the aggregation result. The third file sample set includes multiple file samples and the cleanup level of each file sample, and each file sample in the third file sample set is generated by the client. The feature library is obtained by the method described in any one of claims 1 to 4.
Citation Information
Patent Citations
Ocean big data text classification method and system
CN112507113A