in [ ]from sklearn feature_selection import chi selectkbest skb selectkbest(score_func=chi = skb fit(bc_xbc_yout[ ]selectkbest( = score_func=you can see that we have passed our input features (bc_xand corresponding response class outputs (bc_yto the fitfunction when computing the necessary metrics the chi-square test will compute statistics between each feature and the class variable (univariate testsselecting the top features is more than likely to remove features having low score and consequently they are most likely to be independent of the class variable and hence not useful in building models we sort the scores to see the most relevant features using the following code in [ ]feature_scores [(itemscorefor itemscore in zip(bc_data feature_namesskb scores_)sorted(feature_scoreskey=lambda - [ ])[: out[ ][('worst area' )('mean area' )('area error' )('worst perimeter' )('mean perimeter' )('worst radius' )('mean radius' )('perimeter error' )('worst texture' )('mean texture' )we can now create subset of the selected features obtained from our original feature set of features with the help of the chi-square test by using the following code in [ ]select_features_kbest skb get_support(feature_names_kbest bc_data feature_names[select_features_kbestfeature_subset_df bc_features[feature_names_kbestbc_sx np array(feature_subset_dfprint(bc_sx shapeprint(feature_names_kbest( ['mean radius'mean texture'mean perimeter'mean area'mean concavity'radius error'perimeter error'area error'worst radius'worst texture'worst perimeter'worst area'worst compactness'worst concavity'worst concave points'thus from the preceding outputyou can see that our new feature subset bc_sx has observations of features instead of and we also printed the names of the selected features for your ease of understanding to view the new feature setyou can use the following snippet in [ ]np round(feature_subset_df iloc[ : ]