Discrete Dynamics in Nature and Society

Discrete Dynamics in Nature and Society / 2021 / Article
Special Issue

Analysis, Control and Applications of Passivity in Complex Networks 2021

View this Special Issue

Research Article | Open Access

Volume 2021 |Article ID 9963382 | https://doi.org/10.1155/2021/9963382

Liang-jing Cai, Shu Lv, Kai-bo Shi, "Application of an Improved CHI Feature Selection Algorithm", Discrete Dynamics in Nature and Society, vol. 2021, Article ID 9963382, 8 pages, 2021. https://doi.org/10.1155/2021/9963382

Application of an Improved CHI Feature Selection Algorithm

Academic Editor: Zi-Peng Wang
Received11 Mar 2021
Accepted04 May 2021
Published13 May 2021

Abstract

Text classification is the critical content of machine learning, and it is widely applied in information filtering, sentimental analysis, and text review. It is very important to improve the accuracy of classification results, and this is also the main research purpose of researchers in this field in recent years. Feature selection plays an important role in text classification, which has the functions of eliminating irrelevant features, reducing dimensionality, and improving classification accuracy. So, this paper studies the CHI feature selection algorithm, and the main work and innovations are as follows: firstly, this paper analyzed the CHI algorithm’s flaws, determined that the introduction of new parameters will be the improvement direction of the CHI algorithm, and thus proposed a new algorithm based on variance and coefficient of variation. Secondly, experiment to verify the effectiveness of the new algorithm. In terms of language, the experiment in this paper includes two text classification systems, which were Chinese and English. In terms of classifiers, two classifier algorithms were used, which included the KNN classifier and the Naive Bayes classifier. In terms of data types, two distribution types of data were used: balanced datasets and unbalanced datasets. Finally, experiment and result analysis. This paper has conducted 3 comparative experiments and analyzed the results of each experiment. The experimental results obtained are all significantly improved compared to the results before the improvement.

1. Introduction

Text classification is a process of classifying unknown text according to the content of text [1]. It is the most classical field of natural language processing, which is according to the content of the text; using some automatic classification algorithms, the computer divides the texts into predefined categories [2]. With the rapid development of the Internet, information and data exist in a variety of ways, such as images, video, sound, and text. Compared with other forms, texts are applied more widely, because of its faster upload speed, faster download speed, and less use of network resources. Therefore, to quickly and correctly classify the massive text information, text classification technology has emerged. The processing of text categorization can be roughly divided into three stages: text preprocessing, text feature dimension reduction, and classification model construction. Text classification is widely used in filtering spam, analysis of Internet public opinion [3], and clinical diagnosis [4]. At present, the main direction of the text information structure is the vector model, in which the difficulty is mainly the high dimension of text features and the data sparsity [5], so feature dimension reduction plays a vital role in the classification effect. Feature selection method is an effective way to address this issue and play an important role in text classification [6].

At present, many researchers have proposed varieties of text feature selection methods, which include document frequency (DF), information gain (IG), mutual information (MI), expected cross-entropy (ECE), chi-square (CHI), and Gini Index. Many papers have proved that IG and CHI work best for text classification [7, 8]. Because the CHI statistical algorithm has many advantages, such as low complexity, easy understanding, and significant classification effect, people use it widely in actual situations. However, CHI algorithm only considers the influence of the document frequency in the calculation process, but ignores the factor of the feature word frequency; this defect is known as the “low word frequency defect”; many researchers have proposed improved methods for CHI algorithm. This paper also proposes an improvement in the CHI algorithm based on the variance (Var) and coefficient of variation, which named Var-CV-CHI algorithm in this paper.

The rest of this paper is organized as follows: Section 2 briefly reviews the related work; Section 3 presents the method of improved CHI algorithm; Section 4 shows the experimental results and analyzes the results; Section 5 concludes the paper with some possible work in the future.

Feature selection aims at removing irrelevant or redundant features for solving a supervised learning problem and reducing the difficulty of learning tasks [9]. It has been widely studied in web document processing (text classification, text retrieval, text recovery, etc.), gene analysis, drug diagnosis, and other fields.

Feature selection has a significant impact on the results of text classification, where it is often used to find the smallest subset of features that maximally increases the performance of the model. An excellent feature selection model can optimize the algorithm and improve the performance of text classification. Facing increasingly diverse forms of data or data flow, how to design better feature selection algorithms to solve the needs of society is a long-term task.

Machine learning divides feature selection into three methods: embedded, wrapper, and filter methods.

In the embedded feature selection method, some machine learning algorithms and models are first used for training to obtain the weight coefficients of each feature, and the features are selected from large to small according to the coefficients. The wrapper method selects or excludes several features at a time based on the objective function (usually the predictive effect score). The filter method scores each feature according to its divergence or correlation, sets the threshold, and selects the features. Filter-based feature selection is an effective solution to improve the performance of classification systems by selecting significant features and discarding the undesirable ones [10]. The features with a score higher than the threshold were selected, or the features with the most significant score in the first k scores were selected. Accurately, calculate the divergence of each feature, remove the features with divergence less than the threshold, and select the features with the most significant first k fractions; calculate the correlation between each feature and the label, remove the features whose correlation is less than the threshold, and select the feature with the most significant first k scores. The classical filter feature selection methods are variance threshold, chi-square, MI, etc. Moreover, chi-square performs best.

Many researchers propose improved methods based on the chi-square feature selection method. The related works are as follows.

Fan et al. [11] introduced word frequency factor, interclass variance, and adaptive scaling factor into CHI, which significantly improved the effect of text classification. Pei [12] introduced factors such as dispersion, concentration, and word frequency into the CHI formula, which improved its classification accuracy on the unevenly distributed corpus. Qiu et al. [13] proposed the variance-based chi-square statistics (Var-CHI) method which has significantly improved the recall and precision. Bahassine et al. [14] proposed an Imp-CHI algorithm, which combined the total number of documents in the corpus with the number of documents belonging to a particular category for Arabic text classification. However, they all did not consider using the variance (Var) of total word frequency in each class and coefficient of variation (CV) within a class to measure the dispersion of feature words in the category.

3. Materials and Methods

3.1. Chi-Square Feature Selection

The CHI algorithm’s core idea is hypothesis testing; by observing the deviation between the actual value and the theoretical value, we can judge the correlation between the feature words and the category. In the text classification process, the original hypothesis is that “feature word t is not related to class ,” and each feature word can get the corresponding CHI value. The larger the CHI value, the more significant the correlation between t and . According to the order of CHI values from large to small, we can select m feature words that have the most significant correlation with class .

The CHI value is defined as the following equation:where N is the total number of documents in the corpus; A is the number of documents that contain feature t and belong to class; B is the number of documents that contain feature t but do not belong to class; C is the number of documents that do not contain feature t but ; D is the number of documents that do not contain feature t and not belong to class.

According to equation (1), each feature word gets a score, and then the first m feature words are selected.

3.2. Improved Chi-Square Algorithm

Yang’s research shows that chi-square is one of the best current feature selection methods [8]. Compared with other methods, the CHI method can reduce more vocabulary and eliminate a lot of redundant words and then improve the classification performance. Moreover, with the amount of text gradually increasing, the stability is also considerable. Since A + C is equal to the number of documents belonging to category , B + D is equal to the number of documents not belonging to category , both of which are constant and not related to the feature word t, so does N. Therefore, equation (1) can be written as the following equation:

In equation (2), A, B, C, and D all come from the statistics of the number of documents containing feature word in each category of the corpus, so the CHI value is only related to whether the feature words appear, but not related to the frequency of its appearance. This problem leads to incomplete classification information; it is easy to select low-frequency words that are not useful for classification falsely. Especially when the distribution of corpus categories is uneven, equation (2) is more likely to give high scores to low-frequency words, which affects the accuracy of classification results. To correct these shortcomings of the traditional CHI algorithm, this paper proposes an improved algorithm, Var-CV-CHI algorithm. The method is as follows:(a)In the text classification, we want to select feature words that meet the condition of as many as possible. However, according to equation (2), the feature words satisfying will be selected at the same time, so the low-frequency words in the category will be selected by mistake; we call it as a negative correlation. Some low-frequency words contain important classification information, so we cannot completely delete them. Therefore, this paper will select feature words according to the positive and negative correlation between feature words and categories and give them different weights to reduce the negative correlation of low-frequency words. The positive correlation and negative correlation are as shown in the following equations:Thus, add an adaptive scaling factor α. The equation is improved as the following equation:(. In the experiment of this paper, is 0.8).(b)As described above, in the original CHI equation, it does not count ’s frequency. When multiclass texts are classified, the larger the number of documents containing the feature word and ’s frequency in category , the better the ’s classification ability. Therefore, this paper proposes these parameters as the following equations:where is the number of in the ith file in class , r is the total number of news categories, and n is the total number of documents in a category.(c)If feature words have good classification ability, they should mostly appear in one category. On the contrary, they seldom or even do not appear in other categories. Therefore, the greater the dispersion of ’s frequency between categories, that is, the larger the variance between categories, the stronger the classification ability of the feature words . Thus, this paper gives a parameter as the following equation:’s meaning is the same as equation (7); represents the category average word frequency of in the corpus. If , it indicates that the word frequency of in the specified category is greater than or equal to the average word frequency of between categories, and it is a meaningful word for ; if , it indicates that the word frequency of in the specified category is less than the average word frequency of between categories, and it is a meaningless word for . According to the mathematical meaning of , is constantly established; so, if is very large and , then it shows that has important classification significance to . In order for the formula to be neat and beautiful, command , and adjust parameter to . The value of is shown as the following equation:(d)Coefficient of variation is a normalization index of the degree of dispersion of a probability distribution, which is defined as the following equation:

In the text classification, feature words are distributed in every text of a category as evenly as possible, which indicates that it has a strong classification ability. The smaller the coefficient of variation, the more uniform the data distribution. To make the improved CHI value proportional to each parameter, we reverse the numerator and denominator of the coefficient of variation and then transform the standard deviation into a variance. Therefore, we introduce the coefficient of variation for chi-square, which is defined as the following equation:

In summary, the feature selection segment should select words that appear concentrated in a specific category and are evenly distributed in that category. At the same time, the more frequently these words are in this specific category, the better their category representativeness. This paper proposes an improved CHI algorithm, which is called Var-CV-CHI algorithm; the calculation method is as the following equation:

4. Results and Discussion

In this experiment, Chinese news corpus and English news corpus are both used. Because of the different language structures of Chinese and English, we construct Chinese text classification system and English text classification system, respectively. The specific experimental settings and results are as follows.

4.1. Data Collection
4.1.1. Chinese News Corpus

The Chinese corpus is from School of Information Management, Sun Yat-sen University. The corpus is a manually labeled corpus with 14 categories and a total of 36865 documents with high accuracy. In order to make the sample size large enough, this paper selects 10 categories with a large amount of text. The experiments use two corpus sets: balanced corpus (Table 1) and unbalanced corpus (Table 2); same 10 categories are selected in total.


CategoryNumber

Culture1500
Education1500
Entertainment1500
Event1500
Finance1500
Game1500
Health1500
Occultism1500
Sport1500
Technology1500


CategoryNumber

Culture150
Education610
Entertainment1050
Event800
Finance1200
Game840
Health300
Occultism300
Sport700
Technology1500

4.1.2. English News Corpus

The English corpus is the Reuters-21578 News Corpus. According to the preliminary experiment results, because this corpus is skewed data, the effect of the Var-CV-CHI algorithm on the English balanced corpus is not significantly improved compared with the traditional CHI algorithm, so only the unbalanced corpus is used in this experiment (Table 3).


CategoryNumber

Acq460
Crude80
Earn645
Interest218
Ship95
Student105
Trade300

4.2. Experiment

In this paper, the Var-CV-CHI algorithm is compared with the traditional CHI and other improved algorithms on the balanced corpus or the unbalanced corpus. To exclude the influence of the classifier, we choose to use two kinds of classifiers for experiments, KNN classifier and Naïve Bayes classifier.

Figure 1 shows the experimental process.

In the experiments, the ratio of the train set and test set is 4 : 1. The purpose of CHI feature selection is to select the first m feature words based on the calculated CHI value. According to the size of the dataset, the threshold value of feature words selected from each category is 150 in Chinese corpus and 20 in English corpus. To verify the effectiveness and stability of the Var-CV-CHI algorithm, we set up the following experiments.

4.2.1. Experimental in Chinese Corpus

(1) Experiment 1. Tables 4 and 5 show the experimental results of a balanced corpus and unbalanced corpus in the KNN classifier, which contains a precision, recall, and F1-score.


CategoryCHIVar-CV-CHI
PrecisionRecallF1-scorePrecisionRecallF1-score

Culture0.920.950.930.940.940.94
Education0.940.930.940.930.920.92
Entertainment0.940.880.910.930.870.90
Event0.820.820.820.750.850.80
Finance0.820.880.850.870.890.88
Game0.980.970.980.980.970.97
Health0.920.780.840.950.820.88
Occultism0.770.980.860.831.000.90
Sport0.980.920.950.980.910.95
Technology0.920.840.880.930.860.89
Macro-avg-P0.900.91
Macro-avg-R0.900.90
Macro-avg-F10.900.90


CategoryCHIVar-CV-CHI
PrecisionRecallF1-scorePrecisionRecallF1-score

Culture0.970.900.930.930.920.92
Education0.930.820.870.930.870.90
Entertainment0.920.910.910.910.930.92
Event0.790.800.800.790.800.80
Finance0.860.840.850.880.880.88
Game0.970.970.970.970.980.97
Health0.510.920.661.000.680.81
Occultism0.641.000.780.471.000.64
Sport0.970.860.910.960.840.90
Technology0.930.790.860.940.870.91
Macro-avg-P0.850.88
Macro-avg-R0.880.88
Macro-avg-F10.850.87

After the contrast experiment, it is found that when k = 7, the classification effect on the KNN classifier is the best. Figure 2 shows the F1 value of the classifier when k takes different values.

From Tables 4 and 5, compared with the traditional CHI algorithm, even if the performance of a few categories decline, for example, the F1-value of education and event on the unbalanced corpus drops by 2%, but does not affect the improvement of the overall corpus classification performance. In a word, whether in the balanced corpus or the unbalanced corpus, the Var-CV-CHI algorithm performed well. Macro-avg-P and macro-avg-F1 are 3% and 2%, respectively, on the unbalanced corpus. The traditional CHI algorithm performs better on the balanced corpus, while the Var-CV-CHI algorithm performs well on both the balanced corpus and the unbalanced corpus. Figures 3 and 4 show the comparison of the macroresults of CHI and Var-CV-CHI.

(2)Experiment2. Tables 6 and 7 show the experimental results of the balanced corpus and unbalanced corpus in the Naïve Bayes classifier.


CategoryCHIVar-CV-CHI
PrecisionRecallF1-scorePrecisionRecallF1-score

Culture0.990.570.720.990.560.72
Education0.920.890.910.900.940.92
Entertainment0.710.950.820.720.940.82
Event0.650.830.730.730.840.78
Finance0.830.730.780.830.820.83
Game0.980.940.960.980.940.96
Health0.950.910.930.950.930.94
Occultism0.920.990.960.971.000.98
Sport0.970.970.970.980.970.97
Technology0.880.860.870.890.880.89
Macro-avg-P0.880.89
Macro-avg-R0.860.88
Macro-avg-F10.860.88


CategoryCHIVar-CV-CHI
PrecisionRecallF1-scorePrecisionRecallF1-score

Culture0.960.840.890.960.840.90
Education0.750.880.810.920.980.95
Entertainment0.940.890.910.930.940.94
Event0.680.620.650.730.800.77
Finance0.850.690.760.860.830.85
Game0.970.950.960.980.950.96
Health0.381.000.550.871.000.93
Occultism0.921.000.960.951.000.98
Sport0.950.880.920.960.940.95
Technology0.930.830.880.940.900.92
Macro-avg-P0.830.91
Macro-avg-R0.860.92
Macro-avg-F10.830.92

From Tables 6 and 7, the results on the unbalanced corpus are better than the balanced corpus, in which macro-avg-P, macro-avg-R, and macro-avg-F1 are increased by 8%, 6%, and 9%, respectively; it is a significant improvement compared with traditional CHI algorithm. The experiments show a fact: the classification performance of a balanced corpus is better on the KNN classifier, while an unbalanced corpus is better on the Naïve Bayes classifier. The Var-CV-CHI algorithm is better than the CHI algorithm in any situation and shows excellent performance. Figures 5 and 6 show the comparison of the macroresults of CHI and Var-CV-CHI.

4.2.2. Experimental in English Corpus

(1) Experiment 3. Tables 8 and 9 show the experimental results of the English unbalanced corpus using the Naïve Bayes classifier and KNN classifier.


CategoryCHIVar-CV-CHI
PrecisionRecallF1-scorePrecisionRecallF1-score

Acq0.730.860.790.730.850.79
Crude0.830.590.690.890.940.91
Earn0.870.890.880.900.870.88
Interest0.900.820.860.930.860.89
Ship0.920.550.690.940.750.83
Student1.001.001.001.000.910.95
Trade0.930.890.910.950.900.92
Macro-avg-P0.880.90
Macro-avg-R0.800.87
Macro-avg-F10.830.88


CategoryCHIVar-CV-CHI
PrecisionRecallF1-scorePrecisionRecallF1-score

Acq0.760.840.800.800.840.82
Crude0.780.820.800.840.940.89
Earn0.930.850.890.930.880.90
Interest0.950.910.930.930.930.93
Ship0.851.000.920.921.000.96
Student0.730.800.760.880.750.81
Trade0.930.870.890.920.950.94
Macro-avg-P0.850.89
Macro-avg-R0.870.90
Macro-avg-F10.860.89

From Tables 8 and 9, it can be seen that the classification results of the Var-CV-CHI are significantly improved in both KNN classifier and Naïve Bayes classifier, and it works best on the KNN classifier, in which macro-avg-P, macro-avg-R, and macro-avg-F1 are increased by 2%, 7%, 5%, respectively. On the Naïve Bayes classifier, the category of Crude’s classification effect of the Var-CV-CHI algorithm is especially improved significantly, and the , R, and F are increased by 6%, 24%, and 18%, respectively. It can be seen from Table 3 that the number of files in the Crude category is the least among the 7 categories, so it can be seen that in the unbalanced corpus, the Var-CV-CHI’s classification effect on the categories with the least number of files is the most obvious. In addition, through multiple experiments, we found that the more the uneven number of categories in the corpus, the better the classification results of the Var-CV-CHI algorithm. Figures 7 and 8 show the comparison of the macro-average results of CHI and Var-CV-CHI.

5. Conclusion

In this paper, through a lot of literature studies, and on this basis, it is determined that the introduction of new parameters will be the direction of CHI algorithm improvement, thus the Var-CV-CHI feature selection algorithm based on variance and coefficient of variation is proposed. Although many of the improved methods of the CHI algorithm are based on the idea of introducing new parameters, the method in this paper is more comprehensive and rigorous than these methods. It combines the differences caused by the different distributions of feature words between categories and within categories and synthesizes the situation of feature words in the document. The classification effect is very excellent. At the same time, compared with the existing works, the experiments in this paper are more abundant. Not only the language factor but also the distributions of classifiers and datasets are considered. Finally, the experiments from multiple angles proved the effectiveness of the Var-CV-CHI algorithm.

Text classification is a complex project, and every segment of it plays a vital role in the classification results. Future work can continue in the following directions:

The Var-CV-CHI algorithm in this paper only considers the distribution of feature words but without considering its semantic information. If the semantic information of feature items can be added to the feature selection algorithm, for example, the synonyms with the same semantic information can be merged, and the feature words with the largest weight among the words with similar semantic information can be selected. Then, the redundancy of feature space will be reduced, and the performance of feature selection will be improved significantly.

Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare no conflicts of interest.

Acknowledgments

The Chinese corpus of this article was provided by Lu Yonghe from the School of Information Management, Sun Yat-sen University.

References

  1. A. K. Uysal, “On two-stage feature selection methods for text classification,” IEEE Access, vol. 6, pp. 43233–43251, 2018. View at: Publisher Site | Google Scholar
  2. Q. Zhou, M. S. Zhao, and H. U. Min, “Study on feature selection in Chinese text categorization,” Journal of Chinese Information Processing, vol. 18, no. 3, pp. 17–23, 2004. View at: Google Scholar
  3. Y. Zhao, S. Cheng, X. Yu, and H. Xu, “Chinese public’s attention to the COVID-19 epidemic on social media: observational descriptive study,” Journal of Medical Internet Research, vol. 22, no. 5, 2020. View at: Publisher Site | Google Scholar
  4. M. Oleynik, A. Kugic, Z. Kasáč, and M. Kreuzthaler, “Evaluating shallow and deep learning strategies for the 2018 n2c2 shared task on clinical text classification,” Journal of the American Medical Informatics Association, vol. 26, no. 11, pp. 1247–1254, 2019. View at: Publisher Site | Google Scholar
  5. H. Liu, S. U. Zhan, and S. Liu, “Improved CHI text feature selection based on word frequency information,” Computer Engineering and Applications, vol. 49, no. 22, pp. 110–114, 2013. View at: Google Scholar
  6. X.-T. Wang and X.-Z. Luan, “Bayesian penalized method for streaming feature selection,” IEEE Access, vol. 7, no. 99, pp. 103815–103822, 2019. View at: Publisher Site | Google Scholar
  7. H. Ji, A. H. Tan, and C. L. Tan, “On machine learning methods for Chinese document categorization,” Applied Intelligence, vol. 18, no. 3, pp. 311–322, 2003. View at: Publisher Site | Google Scholar
  8. Y. Yang and X. Liu, “A re-examination of text categorization methods,” in Proceedings of the SIGIR-99, 22nd ACM International Conference on Research and Development in Information Retrieval, vol. 39, pp. 42–49, New York, NY, USA, August 1999. View at: Google Scholar
  9. B. Li, “Importance weighted feature selection strategy for text classification,” in Proceeding of the 2016 International Conference on Asian Language Processing (IALP), Tainan, Taiwan, November 2016. View at: Publisher Site | Google Scholar
  10. O. A. M. Salem, F. Liu, Y.-P. P. Chen, and X. Chen, “Ensemble fuzzy feature selection based on relevancy, redundancy, and dependency,” Entropy, vol. 22, no. 7, 2020. View at: Publisher Site | Google Scholar
  11. C. J. Fan, Y. S. Wang, and Y. T. Wang, “An improved CHI text feature selection algorithm,” Computer and Modernization, vol. 11, pp. 7–11, 2016. View at: Google Scholar
  12. Y. Pei, “Study on improved CHI for feature selection in Chinese text categorization,” Computer Engineering and Applications, vol. 47, pp. 128–123, 2011. View at: Google Scholar
  13. Y. F. Qiu, W. Wang, and D. Y. Liu, “CHI feature selection method based on variance,” Application Research of Computers, vol. 29, pp. 1304–1306, 2012. View at: Google Scholar
  14. S. Bahassine, A. Madani, and M. Kissi, “An improved Chi-sqaure feature selection for Arabic text classification using decision tree,” in Proceeding of the International Conference on Intelligent Systems: Theories & Applications, Mohammedia, Morocco, October 2016. View at: Publisher Site | Google Scholar

Copyright © 2021 Liang-jing Cai et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Related articles

No related content is available yet for this article.
 PDF Download Citation Citation
 Download other formatsMore
 Order printed copiesOrder
Views416
Downloads348
Citations

Related articles

No related content is available yet for this article.

Article of the Year Award: Outstanding research contributions of 2021, as selected by our Chief Editors. Read the winning articles.