A taxpayer industry code prediction method, apparatus, device, and medium
Patent Information
- Application Number
- CN202211310777.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-25
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2042-10-25
AI Technical Summary
这两者对于ARM64架构的机器并不友好,所以在资源有限的ARM64云服务器中,这套建模策略不适用
[0036]In this application, the main industry codes of different taxpayers and the taxpayer text information corresponding to the main industry codes are obtained; wherein, the taxpayer text information includes the taxpayer's name and business scope; the main industry code includes several subsidiary industry codes; the word frequency-document frequency ratio of the target word in the first taxpayer text information and the target word in the second taxpayer text information is determined to obtain the keyword score of the target word; the first taxpayer text information is the taxpayer text information corresponding to the currently selected main industry code; wherein, if the number of main industry codes is greater than a preset threshold, the second taxpayer text information is the taxpayer text information included by other main industry codes besides the first main industry code, and if the number of main industry codes is not greater than the preset threshold, the second taxpayer text information is the taxpayer text information included by all main industry codes; the keyword scores are feature transformed to obtain keyword score features, and the main industry codes are feature-plyed to obtain corresponding one-hot encodings; the keyword score features and the one-hot encodings are used to train a corresponding XGBoost model so as to predict the subsidiary industry codes through the XGBoost model. As can be seen, by utilizing the OVR (One vs. Rest) learning strategy, for main industry codes exceeding a preset threshold, the taxpayer text information corresponding to the currently selected main industry code is separated from the taxpayer text information included in other main industry codes. For main industry codes not exceeding the preset threshold, only the taxpayer text information corresponding to the currently selected main industry code is extracted, and the taxpayer text information included in all main industry codes is treated as another text set to improve training speed and resolve the inconsistency of label features in multi-class classification. Furthermore, in multi-class classification tasks, unique keyword score features are calculated for each text feature, and the main industry codes are feature-flattened, transforming all feature values into a one-hot encoded feature. This is suitable for predicting industry codes where numerical values have no practical meaning and semantic features do not need to be considered. While ensuring accuracy, traditional machine learning is used to achieve text classification tasks where semantic information is unimportant. In this way, the text classification idea based on keyword scores and the OVR strategy, trained using the XGBoost model, replaces commonly used deep learning models in the industry, not only eliminating dependence on GPUs and deep learning frameworks but also achieving better results.
Smart Images

Figure CN115563958B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of tax processing technology, and in particular to a method, apparatus, equipment and medium for predicting the industry code of a taxpayer. Background Technology
[0002] ARM servers are a type of CPU (Central Processing Unit) architecture. While the industry commonly uses x86 architecture CPUs, the tax bureau's local cloud server uses an ARM64 architecture CPU. Therefore, to meet the tax bureau's need to migrate its algorithms to the cloud, deep learning algorithms need to be migrated from x86 architecture servers to ARM64 architecture servers. This requires rebuilding the entire environment, which will cause many production problems. Furthermore, because the cloud server lacks GPU (Graphics Processing Unit) resources, the original deep learning model cannot be trained correctly. Therefore, it is necessary to reconstruct the algorithm to reduce its dependence on GPUs and deep learning frameworks while maintaining accuracy.
[0003] The existing technical solution is BERT (Bidirectional Encoder Representation from Transformers), a widely used deep learning model in the industry. However, it relies heavily on GPU computing power and deep learning frameworks. These are not ideal for ARM64 architecture machines, making this modeling strategy unsuitable for resource-constrained ARM64 cloud servers. Furthermore, while BERT's greatest strength lies in capturing rich semantic features, semantic information is extremely low-valued in businesses predicting taxpayer industry codes. Text classification is primarily based on the presence or absence of certain keywords. Therefore, BERT is, in a sense, performance redundant, and semantic information may even diminish the importance of keywords in this context.
[0004] In summary, how to make text classification tasks independent of GPUs and deep learning frameworks, and achieve the prediction of taxpayers' industry codes while ensuring accuracy, is a problem that needs to be solved. Summary of the Invention
[0005] In view of this, the purpose of this invention is to provide a method, apparatus, device, and medium for predicting the industry code of a taxpayer, enabling text classification tasks to be performed without relying on GPUs and deep learning frameworks, and to predict the industry code of a taxpayer while ensuring accuracy. The specific solution is as follows:
[0006] Firstly, this application discloses a method for predicting the industry code of a taxpayer, including:
[0007] Obtain the main industry code and the taxpayer text information corresponding to the main industry code for different taxpayers; wherein, the taxpayer text information includes the taxpayer's name and business scope; the main industry code includes several subsidiary industry codes;
[0008] The word frequency-document frequency ratio of the target word in the first taxpayer's text information and the target word in the second taxpayer's text information is determined to obtain the keyword score of the target word; the first taxpayer's text information is the taxpayer's text information corresponding to the currently selected main industry code; wherein, if the number of main industry codes is greater than a preset threshold, then the second taxpayer's text information is the taxpayer's text information included by other main industry codes besides the first main industry code; if the number of main industry codes is not greater than the preset threshold, then the second taxpayer's text information is the taxpayer's text information included by all main industry codes;
[0009] The keyword scores are subjected to feature transformation to obtain keyword score features, and the main industry code is subjected to feature tiling to obtain the corresponding one-hot encoding;
[0010] The corresponding XGBoost model is trained using the keyword score features and the one-hot encoding, so as to predict the affiliated industry code through the XGBoost model.
[0011] Optionally, determining the ratio of the word frequency to the document frequency of the target word in the first taxpayer's text information to the target word in the second taxpayer's text information, in order to obtain the keyword score of the target word, includes:
[0012] Determine the frequency of the target word in the first taxpayer's text information to obtain the first word frequency;
[0013] Determine the frequency of the target word in the second taxpayer's text information to obtain the second word frequency;
[0014] Determine the frequency of the statements containing the target word in the first taxpayer text information to obtain a first text frequency;
[0015] Determine the frequency of the statements containing the target word in the second taxpayer text information to obtain the second text frequency;
[0016] The word frequency-document frequency ratio of the target word is determined based on the first word frequency, the second word frequency, the first text frequency, and the second text frequency to obtain the keyword score of the target word.
[0017] Optionally, the step of performing feature transformation on the keyword scores to obtain keyword score features includes:
[0018] The keyword scores are converted into numerical features including cumulative scores, cumulative multiplicative scores, number of keywords, total keyword length, average keyword length, average keyword score, maximum keyword score, second largest keyword score, and third largest keyword score, so as to determine the keyword score features based on the numerical features.
[0019] Optionally, before training the corresponding XGBoost model using the keyword score features and the one-hot encoding, the method further includes:
[0020] Based on the keyword score features, NearMiss-1 is used for downsampling, and the target sample number is determined using a preset sample number determination formula.
[0021] Optionally, determining the target sample size using a preset sample size determination formula includes:
[0022] use Determine the target number of samples; where cnt is the original number of samples, and log(cnt,10) represents the logarithmic function with base 10.
[0023] Optionally, training the corresponding XGBoost model using the keyword score features and the one-hot encoding includes:
[0024] The keyword score features and the one-hot encoding are used as samples to determine the different label types in the samples;
[0025] The samples are divided according to the label type and a preset ratio to obtain different training data and validation data;
[0026] The XGBoost model is trained using the training data and validated using the AUC of the validation data to obtain different XGBoost models.
[0027] Optionally, after training the corresponding XGBoost model using the keyword score features and the one-hot encoding, the method further includes:
[0028] The XGBoost model is deployed via Docker and as a Flask_Restful service.
[0029] Secondly, this application discloses a taxpayer's industry code prediction device, comprising:
[0030] The data acquisition module is used to acquire the main industry code of different taxpayers and the taxpayer text information corresponding to the main industry code; wherein, the taxpayer text information includes the taxpayer's name and business scope; the main industry code includes several subsidiary industry codes;
[0031] The keyword score determination module is used to determine the word frequency-document frequency ratio of the target word in the first taxpayer text information and the target word in the second taxpayer text information, so as to obtain the keyword score of the target word; the first taxpayer text information is the taxpayer text information corresponding to the currently selected main industry code; wherein, if the number of main industry codes is greater than a preset threshold, then the second taxpayer text information is the taxpayer text information included by other main industry codes besides the first main industry code; if the number of main industry codes is not greater than the preset threshold, then the second taxpayer text information is the taxpayer text information included by all main industry codes;
[0032] The feature conversion module is used to perform feature conversion on the keyword scores to obtain keyword score features, and to perform feature tiling on the main industry code to obtain the corresponding one-hot encoding;
[0033] The XGBoost model training module is used to train the corresponding XGBoost model using the keyword score features and the one-hot encoding, so as to predict the affiliated industry code through the XGBoost model.
[0034] Thirdly, this application discloses an electronic device comprising a processor and a memory; wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the taxpayer industry code prediction method as described above.
[0035] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the taxpayer industry code prediction method as described above.
[0036] In this application, the main industry codes of different taxpayers and the taxpayer text information corresponding to the main industry codes are obtained; wherein, the taxpayer text information includes the taxpayer's name and business scope; the main industry code includes several subsidiary industry codes; the word frequency-document frequency ratio of the target word in the first taxpayer text information and the target word in the second taxpayer text information is determined to obtain the keyword score of the target word; the first taxpayer text information is the taxpayer text information corresponding to the currently selected main industry code; wherein, if the number of main industry codes is greater than a preset threshold, the second taxpayer text information is the taxpayer text information included by other main industry codes besides the first main industry code, and if the number of main industry codes is not greater than the preset threshold, the second taxpayer text information is the taxpayer text information included by all main industry codes; the keyword scores are feature transformed to obtain keyword score features, and the main industry codes are feature-plyed to obtain corresponding one-hot encodings; the keyword score features and the one-hot encodings are used to train a corresponding XGBoost model so as to predict the subsidiary industry codes through the XGBoost model. As can be seen, by utilizing the OVR (One vs. Rest) learning strategy, for main industry codes exceeding a preset threshold, the taxpayer text information corresponding to the currently selected main industry code is separated from the taxpayer text information included in other main industry codes. For main industry codes not exceeding the preset threshold, only the taxpayer text information corresponding to the currently selected main industry code is extracted, and the taxpayer text information included in all main industry codes is treated as another text set to improve training speed and resolve the inconsistency of label features in multi-class classification. Furthermore, in multi-class classification tasks, unique keyword score features are calculated for each text feature, and the main industry codes are feature-flattened, transforming all feature values into a one-hot encoded feature. This is suitable for predicting industry codes where numerical values have no practical meaning and semantic features do not need to be considered. While ensuring accuracy, traditional machine learning is used to achieve text classification tasks where semantic information is unimportant. In this way, the text classification idea based on keyword scores and the OVR strategy, trained using the XGBoost model, replaces commonly used deep learning models in the industry, not only eliminating dependence on GPUs and deep learning frameworks but also achieving better results. Attached Figure Description
[0037] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0038] Figure 1 This application discloses a flowchart of a method for predicting the industry code of a taxpayer.
[0039] Figure 2 This application discloses a flowchart of a specific method for predicting the industry code of a taxpayer.
[0040] Figure 3 This is a schematic diagram illustrating a specific method for predicting the industry code of a taxpayer disclosed in this application;
[0041] Figure 4 This is a schematic diagram of a taxpayer industry code prediction device disclosed in this application;
[0042] Figure 5 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0043] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0044] Currently, due to the tax bureau's need to migrate its algorithms to the cloud, deep learning algorithms need to be moved from x86 architecture servers to ARM64 architecture servers. This requires rebuilding the entire environment, which will cause many production problems. The existing BERT model relies on GPU computing power and deep learning framework support, which is not compatible with ARM64 architecture machines. Furthermore, the BERT model generates performance redundancy in predicting taxpayer industry codes, and may even reduce the importance of keywords to some extent.
[0045] To this end, this application provides a taxpayer industry code prediction scheme that enables text classification tasks to be independent of GPUs and deep learning frameworks, and achieves the prediction of taxpayer industry codes while ensuring accuracy.
[0046] This invention discloses a method for predicting the industry code of a taxpayer. See [link to relevant documentation]. Figure 1 As shown, the method includes:
[0047] Step S11: Obtain the main industry code of different taxpayers and the taxpayer text information corresponding to the main industry code; wherein, the taxpayer text information includes the taxpayer's name and business scope; the main industry code includes several subsidiary industry codes.
[0048] In this embodiment, the main industry codes of different taxpayers and the corresponding taxpayer text information are obtained. The taxpayer text information includes the taxpayer's name and business scope. The main industry code includes several subsidiary industry codes, and one main industry code represents one category.
[0049] Step S12: Determine the word frequency-document frequency ratio of the target word in the first taxpayer text information and the target word in the second taxpayer text information to obtain the keyword score of the target word; the first taxpayer text information is the taxpayer text information corresponding to the currently selected main industry code; wherein, if the number of main industry codes is greater than a preset threshold, the second taxpayer text information is the taxpayer text information included by other main industry codes besides the first main industry code, and if the number of main industry codes is not greater than the preset threshold, the second taxpayer text information is the taxpayer text information included by all main industry codes.
[0050] In this embodiment, a learning strategy from machine learning is employed, utilizing the OVR strategy to address the inconsistency of label features in multi-class classification. For a large number of categories, the text set A of the current category is separated from the text set B of other categories; for a small number of categories, only the text set A of the current category is extracted, and the text sets of all categories are used as text set B to improve training speed. That is, since one main industry code represents one industry category, the OVR classification strategy further divides the main industry codes into two categories. If the number of main industry codes exceeds a preset threshold, the currently selected main industry code is designated as the first category, and the taxpayer text information corresponding to the first category is designated as the first taxpayer text information, including text set A. All other main industry codes besides the currently selected main industry code are designated as the second category, and the taxpayer text information corresponding to the second category is designated as the second taxpayer text information, including text set B. If the number of main industry codes is not greater than the preset threshold, all main industry codes, including the currently selected main industry code, are designated as the second category, and the taxpayer text information corresponding to the second category is designated as the second taxpayer text information. Text set B also includes text set A.
[0051] In this embodiment, since an OVR strategy is adopted based on different main industry codes, different groups of taxpayer text information can be obtained as different text sets. For each text set A & B, the Term Frequency-Document Frequency Ratio (TFDF-R) of the target word is calculated, and this score is used as the keyword score. It should be noted that under the OVR strategy, the text of the first taxpayer's information is used as text library A, and the text of the second taxpayer's information is used as text library B. The keyword score reflects whether the frequency of the target word in A is higher than its frequency in B.
[0052] Step S13: Perform feature transformation on the keyword scores to obtain keyword score features, and perform feature tiling on the main industry code to obtain the corresponding one-hot encoding.
[0053] In this embodiment of the application, keyword score features are created. Based on the keyword scores corresponding to each taxpayer's text information category, the text features of that category are transformed into numerical features. These numerical features include: cumulative score, cumulative multiplication score, number of keywords, total keyword length, average keyword length, average keyword score, maximum keyword score, second largest keyword score, and third largest keyword score, totaling nine features.
[0054] In this embodiment, the main industry code is feature-plyed. It is understood that although the features of the main industry code are numbers, their values have no actual meaning. There is no need to consider whether changes in the values will alter the semantic features and affect the overall intended meaning; nor is there a need to consider the possibility that splitting the industry code into individual numbers might make the semantics unclear. Therefore, the main industry code is treated as a category feature, and feature paving means converting all feature values into a OneHot feature. A OneHot feature is a feature with a value of 0 or 1, resulting in over 1000 plyed features. For example, if a main industry code is 1234, after converting it to a OneHot feature, it becomes the numerical feature 000001111.
[0055] Step S14: Train the corresponding XGBoost model using the keyword score features and the one-hot encoding, so as to predict the affiliated industry code through the XGBoost model.
[0056] In this embodiment, due to the potential for severe data imbalance in the project—for example, there might be 100,000 data entries for the main industry code A, but only 100 for the main industry code B—this 1000:1 label imbalance would cause the model training to be heavily biased towards the more numerous labels, resulting in a significant drop in overall performance. Therefore, in this case, downsampling is performed on the categories with a particularly large number of entries, while retaining all data from the categories with a smaller number of entries.
[0057] In this embodiment, the NearMiss downsampling algorithm is used based on the keyword score features. Unlike random downsampling, this algorithm calculates the Euclidean distance between samples based on the feature values. Specifically, NearMiss-1 is used to select the K nearest minority class samples whose average distance is closest to the majority class sample. The NearMiss algorithm allows specifying the final downsampling quantity for each label. Since it is desirable to downsample more classes with larger numbers of samples, a custom formula is used: This is used to calculate the target sample size after downsampling. Here, cnt is the original number of samples in that category, and log(cnt,10) represents the logarithmic function with base 10.
[0058] In this embodiment, after calculating the target number of downsampled samples, XGBoost-OVR modeling is performed. Using the downsampled data, one XGBoost model is trained for each label. It can be understood that each label represents a one-hot encoding of the main industry code after feature tiling. After modeling is complete, the model is deployed using Docker and an interface deployed via Flask_Restful service. In this way, when the model is applied, it can predict the subsidiary industry code by using the taxpayer's name, business scope, and industry code as input.
[0059] In this application, the main industry codes of different taxpayers and the taxpayer text information corresponding to the main industry codes are obtained; wherein, the taxpayer text information includes the taxpayer's name and business scope; the main industry code includes several subsidiary industry codes; the word frequency-document frequency ratio of the target word in the first taxpayer text information and the target word in the second taxpayer text information is determined to obtain the keyword score of the target word; the first taxpayer text information is the taxpayer text information corresponding to the currently selected main industry code; wherein, if the number of main industry codes is greater than a preset threshold, the second taxpayer text information is the taxpayer text information included by other main industry codes besides the first main industry code, and if the number of main industry codes is not greater than the preset threshold, the second taxpayer text information is the taxpayer text information included by all main industry codes; the keyword scores are feature transformed to obtain keyword score features, and the main industry codes are feature-plyed to obtain corresponding one-hot encodings; the keyword score features and the one-hot encodings are used to train a corresponding XGBoost model so as to predict the subsidiary industry codes through the XGBoost model. As can be seen, by utilizing the OVR (One vs. Rest) learning strategy, for main industry codes exceeding a preset threshold, the taxpayer text information corresponding to the currently selected main industry code is separated from the taxpayer text information included in other main industry codes. For main industry codes not exceeding the preset threshold, only the taxpayer text information corresponding to the currently selected main industry code is extracted, and the taxpayer text information included in all main industry codes is treated as another text set to improve training speed and resolve the inconsistency of label features in multi-class classification. Furthermore, in multi-class classification tasks, unique keyword score features are calculated for each text feature, and the main industry codes are feature-flattened, transforming all feature values into a one-hot encoded feature. This is suitable for predicting industry codes where numerical values have no practical meaning and semantic features do not need to be considered. While ensuring accuracy, traditional machine learning is used to achieve text classification tasks where semantic information is unimportant. In this way, the text classification idea based on keyword scores and the OVR strategy, trained using the XGBoost model, replaces commonly used deep learning models in the industry, not only eliminating dependence on GPUs and deep learning frameworks but also achieving better results.
[0060] This application discloses a specific method for predicting the industry code of a taxpayer. (See also...) Figure 2 As shown, the method includes:
[0061] Step S21: Obtain the main industry code of different taxpayers and the taxpayer text information corresponding to the main industry code; wherein, the taxpayer text information includes the taxpayer's name and business scope; the main industry code includes several subsidiary industry codes.
[0062] For a more detailed description of the process of step S21, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.
[0063] Step S22: Determine the frequency of the target word in the first taxpayer text information to obtain the first word frequency; determine the frequency of the target word in the second taxpayer text information to obtain the second word frequency.
[0064] In this embodiment, since one main industry code represents one industry category, the OVR classification strategy further divides the main industry codes into two categories. If the number of main industry codes exceeds a preset threshold, the currently selected main industry code is designated as the first category, and the taxpayer text information corresponding to the first category is designated as the first taxpayer text information. All other main industry codes besides the currently selected main industry code are designated as the second category, and the taxpayer text information corresponding to the second category is designated as the second taxpayer text information. If the number of main industry codes is not greater than the preset threshold, all main industry codes, including the currently selected main industry code, are designated as the second category, and the taxpayer text information corresponding to the second category is designated as the second taxpayer text information. The first taxpayer text information includes text set A, and the second taxpayer text information includes text set B. The keyword score for each set A & B is calculated. In this embodiment, the calculation method for the keyword score is not specifically limited.
[0065] For example, in this embodiment of the application, the term frequency (TF) of the target word in different text sets is first determined, representing the frequency of the word in the text library. The first term frequency of the target word in the first taxpayer's text information and the second term frequency of the target word in the second taxpayer's text information are determined using TF = count(phrase_X) / count(phrase_ALL).
[0066] Step S23: Determine the frequency of the statement containing the target word in the first taxpayer text information to obtain a first text frequency; determine the frequency of the statement containing the target word in the second taxpayer text information to obtain a second text frequency.
[0067] In this embodiment, the text frequency (DF) of a target word in different text sets is determined, representing the frequency of sentences containing that word in the text library. The first text frequency of sentences containing the target word in the first taxpayer text information and the second text frequency of sentences containing the target word in the second taxpayer text information are determined using DF = count(document_X) / count(document_ALL).
[0068] Step S24: Determine the word frequency-document frequency ratio of the target word based on the first word frequency, the second word frequency, the first text frequency, and the second text frequency to obtain the keyword score of the target word.
[0069] In this embodiment, after determining the first word frequency and first text frequency of the first industry category, and the second word frequency and second text frequency of the second industry category, the word frequency-document frequency ratio of the target word is determined using TFDF-R = log(TFDF-A / TFDF-B) to obtain the keyword score of the target word. Here, TFDF = TF*DF; log is used to reduce the magnitude when determining the keyword score.
[0070] Step S25: Perform feature transformation on the keyword scores to obtain keyword score features, and perform feature tiling on the main industry code to obtain the corresponding one-hot encoding.
[0071] For a more detailed description of the process of step S25, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.
[0072] Step S26: Use the keyword score features and the one-hot encoding as samples and determine the different label types in the samples; divide the samples according to the label types according to a preset ratio to obtain different training data and validation data; train the XGBoost model using the training data, and validate the XGBoost model according to the AUC of the validation data to obtain different XGBoost models, so as to predict the auxiliary industry code through the XGBoost model.
[0073] In this embodiment, to address the issue of uneven data distribution, Nearmiss downsampling is performed based on keyword score features. The target sample size is determined using a preset formula, and then divided according to a preset ratio to obtain corresponding amounts of training and validation data. For example, the ratio of training to validation data can be set to 7:3, with the validation set's AUC serving as the training metric. That is, the XGBoost model is further trained using the training data, and validated based on the validation data's AUC to obtain different XGBoost models.
[0074] Step S27: Deploy the XGBoost model using Docker and as a Flask_Restful service.
[0075] In this embodiment, after calculating the target number of downsampled samples, XGBoost-OVR modeling is performed. Using the downsampled data, one XGBoost model is trained for each label. It can be understood that each label represents a one-hot encoding of the main industry code after feature tiling. After modeling, the model is deployed using Docker and an interface deployed via Flask_Restful service. In this way, by inputting the taxpayer's name, business scope, and industry code, the model can predict the subsidiary industry code.
[0076] like Figure 3 The diagram illustrates a specific implementation of this application. An OVR learning strategy is employed on the original data. Different industry categories are determined based on industry codes to obtain text libraries A and B. Simultaneously, feature tiling is performed on the main industry codes. Then, keyword scores obtained from text libraries A and B for the target words are converted into numerical features, which are then used to train the model against the feature-tiled main industry codes. First, the NearMiss downsampling algorithm is used to determine the number of downsampled samples. Then, the samples are divided into training and validation data according to a certain ratio to further train the Xgboost model. Finally, Docker is used to deploy the interface as a Flask RESTful service.
[0077] As can be seen, by utilizing the OVR (One vs. Rest) learning strategy, for main industry codes exceeding a preset threshold, the taxpayer text information corresponding to the currently selected main industry code is separated from the taxpayer text information included in other main industry codes. For main industry codes not exceeding the preset threshold, only the taxpayer text information corresponding to the currently selected main industry code is extracted, and the taxpayer text information included in all main industry codes is treated as another text set to improve training speed and resolve the inconsistency of label features in multi-class classification. Furthermore, in multi-class classification tasks, unique keyword score features are calculated for each text feature, and the main industry codes are feature-flattened, transforming all feature values into a one-hot encoded feature. This is suitable for predicting industry codes where numerical values have no practical meaning and semantic features do not need to be considered. While ensuring accuracy, traditional machine learning is used to achieve text classification tasks where semantic information is unimportant. In this way, the text classification idea based on keyword scores and the OVR strategy, trained using the XGBoost model, replaces commonly used deep learning models in the industry, not only eliminating dependence on GPUs and deep learning frameworks but also achieving better results.
[0078] Accordingly, this application also discloses a taxpayer industry code prediction device, see [link to relevant documentation]. Figure 4 As shown, the device includes:
[0079] The data acquisition module 11 is used to acquire the main industry code of different taxpayers and the taxpayer text information corresponding to the main industry code; wherein, the taxpayer text information includes the taxpayer's name and business scope; the main industry code includes several subsidiary industry codes;
[0080] The keyword score determination module 12 is used to determine the word frequency-document frequency ratio of the target word in the first taxpayer text information and the target word in the second taxpayer text information, so as to obtain the keyword score of the target word; the first taxpayer text information is the taxpayer text information corresponding to the currently selected main industry code; wherein, if the number of main industry codes is greater than a preset threshold, the second taxpayer text information is the taxpayer text information included by other main industry codes besides the first main industry code; if the number of main industry codes is not greater than the preset threshold, the second taxpayer text information is the taxpayer text information included by all main industry codes;
[0081] The feature conversion module 13 is used to perform feature conversion on the keyword score to obtain the keyword score feature, and to perform feature tiling on the main industry code to obtain the corresponding one-hot encoding;
[0082] XGBoost model training module 14 is used to train a corresponding XGBoost model using the keyword score features and the one-hot encoding, so as to predict the affiliated industry code through the XGBoost model.
[0083] For more detailed information on the working process of each of the above modules, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.
[0084] Therefore, through the above-described scheme of this embodiment, the main industry codes of different taxpayers and the taxpayer text information corresponding to the main industry codes are obtained; wherein, the taxpayer text information includes the taxpayer's name and business scope; the main industry code includes several subsidiary industry codes; the word frequency-document frequency ratio of the target word in the first taxpayer text information and the target word in the second taxpayer text information is determined to obtain the keyword score of the target word; the first taxpayer text information is the taxpayer text information corresponding to the currently selected main industry code; wherein, if the number of main industry codes is greater than a preset threshold, then the second taxpayer text information is the taxpayer text information included by other main industry codes besides the first main industry code, and if the number of main industry codes is not greater than the preset threshold, then the second taxpayer text information is the taxpayer text information included by all main industry codes; the keyword score is subjected to feature transformation to obtain keyword score features, and the main industry code is subjected to feature tiling to obtain the corresponding one-hot encoding; the keyword score features and the one-hot encoding are used to train the corresponding XGBoost model so as to predict the subsidiary industry code through the XGBoost model. As can be seen, by utilizing the OVR (One vs. Rest) learning strategy, for main industry codes exceeding a preset threshold, the taxpayer text information corresponding to the currently selected main industry code is separated from the taxpayer text information included in other main industry codes. For main industry codes not exceeding the preset threshold, only the taxpayer text information corresponding to the currently selected main industry code is extracted, and the taxpayer text information included in all main industry codes is treated as another text set to improve training speed and resolve the inconsistency of label features in multi-class classification. Furthermore, in multi-class classification tasks, unique keyword score features are calculated for each text feature, and the main industry codes are feature-flattened, transforming all feature values into a one-hot encoded feature. This is suitable for predicting industry codes where numerical values have no practical meaning and semantic features do not need to be considered. While ensuring accuracy, traditional machine learning is used to achieve text classification tasks where semantic information is unimportant. In this way, the text classification idea based on keyword scores and the OVR strategy, trained using the XGBoost model, replaces commonly used deep learning models in the industry, not only eliminating dependence on GPUs and deep learning frameworks but also achieving better results.
[0085] Furthermore, embodiments of this application also disclose an electronic device, Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0086] Figure 5This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the taxpayer industry code prediction method disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be a computer.
[0087] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0088] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk, or optical disk, etc. The resources stored on it can include an operating system 221, computer programs 222, and data 223, etc. The data 223 can include various types of data. The storage method can be temporary storage or permanent storage.
[0089] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the taxpayer industry code prediction method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.
[0090] Furthermore, this application also discloses a computer-readable storage medium, which includes random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, magnetic disks, optical disks, or any other form of storage medium known in the art. When the computer program is executed by a processor, it implements the aforementioned taxpayer industry code prediction method. The specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0091] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0092] The steps of predicting or assuming the taxpayer's industry code as described in conjunction with the embodiments disclosed herein can be implemented directly using hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0093] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0094] The above provides a detailed description of the taxpayer industry code prediction method, apparatus, equipment, and medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for predicting the industry code of a taxpayer, characterized in that, include: Obtain the main industry code and the taxpayer text information corresponding to the main industry code for different taxpayers; wherein, the taxpayer text information includes the taxpayer's name and business scope; the main industry code includes several subsidiary industry codes; The word frequency-document frequency ratio of the target word in the first taxpayer's text information and the target word in the second taxpayer's text information is determined to obtain the keyword score of the target word; the first taxpayer's text information is the taxpayer's text information corresponding to the currently selected main industry code; wherein, an OVR strategy is adopted according to different main industry codes. If the number of main industry codes is greater than a preset threshold, then the second taxpayer's text information is the taxpayer's text information included by other main industry codes besides the first main industry code. If the number of main industry codes is not greater than the preset threshold, then the second taxpayer's text information is the taxpayer's text information included by all main industry codes. The keyword scores are subjected to feature transformation to obtain keyword score features, and the main industry code is subjected to feature tiling to obtain the corresponding one-hot encoding; The corresponding XGBoost model is trained using the keyword score features and the one-hot encoding, so as to predict the affiliated industry code through the XGBoost model; The step of determining the ratio of the word frequency to the document frequency of the target word in the text information of the first taxpayer to the word frequency of the target word in the text information of the second taxpayer, in order to obtain the keyword score of the target word, includes: Determine the frequency of the target word in the first taxpayer's text information to obtain the first word frequency; Determine the frequency of the target word in the second taxpayer's text information to obtain the second word frequency; Determine the frequency of the statements containing the target word in the first taxpayer text information to obtain a first text frequency; Determine the frequency of the statements containing the target word in the second taxpayer text information to obtain the second text frequency; The term frequency-document frequency ratio of the target word is determined based on the first term frequency, the second term frequency, the first text frequency, and the second text frequency to obtain the keyword score of the target word; wherein, the term frequency-document frequency is the product of the term frequency and the text frequency.
2. The method for predicting the industry code of a taxpayer according to claim 1, characterized in that, The step of performing feature transformation on the keyword scores to obtain keyword score features includes: The keyword scores are converted into numerical features including cumulative scores, cumulative multiplicative scores, number of keywords, total keyword length, average keyword length, average keyword score, maximum keyword score, second largest keyword score, and third largest keyword score, so as to determine the keyword score features based on the numerical features.
3. The method for predicting the industry code of a taxpayer according to claim 1, characterized in that, Before training the corresponding XGBoost model using the keyword score features and the one-hot encoding, the method further includes: Based on the keyword score features, NearMiss-1 is used for downsampling, and the target sample number is determined using a preset sample number determination formula.
4. The method for predicting the industry code of a taxpayer according to claim 3, characterized in that, The process of determining the target sample size using a preset sample size determination formula includes: use Determine the target number of samples; where cnt is the original number of samples, and log(cnt,10) represents the logarithmic function with base 10.
5. The method for predicting the industry code of a taxpayer according to claim 1, characterized in that, The step of training the corresponding XGBoost model using the keyword score features and the one-hot encoding includes: The keyword score features and the one-hot encoding are used as samples to determine the different label types in the samples; The samples are divided according to the label type and a preset ratio to obtain different training data and validation data; The XGBoost model is trained using the training data and validated using the AUC of the validation data to obtain different XGBoost models.
6. The method for predicting the industry code of a taxpayer according to any one of claims 1 to 5, characterized in that, After training the corresponding XGBoost model using the keyword score features and the one-hot encoding, the method further includes: The XGBoost model is deployed via Docker and as a Flask_Restful service.
7. A device for predicting the industry code of a taxpayer, characterized in that, include: The data acquisition module is used to acquire the main industry code of different taxpayers and the taxpayer text information corresponding to the main industry code; wherein, the taxpayer text information includes the taxpayer's name and business scope; the main industry code includes several subsidiary industry codes; The keyword score determination module is used to determine the word frequency-document frequency ratio of the target word in the first taxpayer text information and the target word in the second taxpayer text information to obtain the keyword score of the target word; the first taxpayer text information is the taxpayer text information corresponding to the currently selected main industry code; wherein, an OVR strategy is adopted according to different main industry codes. If the number of main industry codes is greater than a preset threshold, the second taxpayer text information is the taxpayer text information included by other main industry codes besides the main industry code. If the number of main industry codes is not greater than the preset threshold, the second taxpayer text information is the taxpayer text information included by all main industry codes. The feature conversion module is used to perform feature conversion on the keyword scores to obtain keyword score features, and to perform feature tiling on the main industry code to obtain the corresponding one-hot encoding; The XGBoost model training module is used to train a corresponding XGBoost model using the keyword score features and the one-hot encoding, so as to predict the affiliated industry code through the XGBoost model. The keyword score determination module is specifically used for: Determine the frequency of the target word in the first taxpayer's text information to obtain the first word frequency; Determine the frequency of the target word in the second taxpayer's text information to obtain the second word frequency; Determine the frequency of the statements containing the target word in the first taxpayer text information to obtain a first text frequency; Determine the frequency of the statements containing the target word in the second taxpayer text information to obtain the second text frequency; The term frequency-document frequency ratio of the target word is determined based on the first term frequency, the second term frequency, the first text frequency, and the second text frequency to obtain the keyword score of the target word; wherein, the term frequency-document frequency is the product of the term frequency and the text frequency.
8. An electronic device, characterized in that, The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the taxpayer industry code prediction method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, Used to store computer programs; wherein the computer programs, when executed by a processor, implement the taxpayer industry code prediction method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for classifying label-free objects, method and device for detecting set codes and computer readable storage medium
CN110781955A
Tax payer industry classification-oriented label noise learning method
CN114817546A