Feature selection is also known as attribute selection is a process of extracting the most relevant features from the dataset and then applying machine learning algorithms for the better performance of the model. A large number of irrelevant features increases the training time exponentially and increase the risk of overfitting.
Chi-square Test for Feature Extraction:
Chi-square test is used for categorical features in a dataset. We calculate Chi-square between each feature and the target and select the desired number of features with best Chi-square scores. It determines if the association between two categorical variables of the sample would reflect their real association in the population.
Chi- square score is given by :
Observed frequency = No. of observations of class
Expected frequency = No. of expected observations of class if there was no relationship between the feature and the target.
Python Implementation of Chi-Square feature selection:
Original feature number: 4 Reduced feature number : 2
- Chi-Square Test for Feature Selection - Mathematical Explanation
- Parameters for Feature Selection
- ML | Extra Tree Classifier for Feature Selection
- numpy.random.chisquare() in Python
- ML | Feature Mapping
- ML | Feature Scaling - Part 1
- ML | Feature Scaling – Part 2
- Sklearn | Feature Extraction with TF-IDF
- Feature Extraction Techniques - NLP
- Python | How and where to apply Feature Scaling?
- PyQt5 QDockWidget – Getting Feature change signal
- Feature matching using ORB algorithm in Python-OpenCV
- Feature Encoding Techniques - Machine Learning
- Pyspark | Linear regression with Advanced Feature Dataset using Apache MLlib
- PyQt5 QListWidget – Getting Selection Behaviour
- PyQt5 QCalendarWidget - Getting the Selection mode
- PyQt5 QListWidget - Getting Selection Mode
- Creating a multiple Selection using Tkinter
- PyQt5 QCalendarWidget - Setting Selection mode
- Python | Selective value selection in list of tuples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.