Complete the code to import the function for mutual information classification.
from sklearn.feature_selection import [1]
The function mutual_info_classif computes mutual information for classification tasks, which helps select important features.
Complete the code to calculate mutual information scores for features X and target y.
mi_scores = [1](X, y)mutual_info_classif calculates mutual information scores between features and a classification target.
Fix the error in the code to select top 3 features based on mutual information scores.
from sklearn.feature_selection import SelectKBest selector = SelectKBest(score_func=[1], k=3) X_new = selector.fit_transform(X, y)
Use mutual_info_classif as the scoring function for classification feature selection.
Fill both blanks to create a dictionary of feature names and their mutual information scores, filtering scores greater than 0.1.
mi_dict = {feature: [1] for feature, score in zip(feature_names, mi_scores) if score [2] 0.1}The dictionary maps each feature to its score, including only scores greater than 0.1.
Fill both blanks to select top 5 features using mutual information and transform the dataset.
selector = SelectKBest(score_func=[1], k=[2]) selected_features = selector.fit_transform(X, y) selected_feature_names = [name for i, name in enumerate(feature_names) if selector.get_support()[i]]
Use mutual_info_classif as the scoring function, select top 5 features.