<jupyter_start><jupyter_text>**Feature Selection using Chi-Square**<jupyter_code>X = df[["is_adult",	"is_male"]]
y = df[["accident"]]
X_new = SelectKBest(chi2, k=1).fit_transform(X, y)
X_new.shape
pd.crosstab(np.squeeze(X_new), np.squeeze(y))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19117647058823528, 'fraction_numerical': 0.007352941176470588, 'mean_word_length': 10.375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '243265', 'license': 'MIT', 'n_tokens_mistral': 129, 'n_tokens_neox': 125, 'n_words': 15, 'path': 'Machine Learning/Feature-Selection-using-RFE-RFECV-SelectKBest/chi-squared-selectkbest.ipynb', 'repo_name': 'Storiesbyharshit/Data-Science-Portfolio', 'size': '272'}