<jupyter_start><jupyter_text>self.clf = svm.SVC(C=self.C,                                   kernel="rbf",                                   gamma=self.gamma,                                   class_weight="balanced",                                   cache_size=1000,                                   probability=True)<jupyter_code>svm = SVC(C=1.0, kernel="linear", gamma=1.0, class_weight="balanced", cache_size=1000, probability=False)
svm_selector = SelectFromModel(svm, threshold='1.25*median')
svm_selector.fit(X, Y)
# print(svm_selector.estimator_.coef_)
svm_supp = svm_selector.get_support()
svm_fea = X.loc[:,svm_supp].columns.tolist()
svm_fea
pd.set_option('display.max_rows', None)
# put all selection together
feature_selection_df = pd.DataFrame({'Feature':feature_name, 'Pearson':cor_supp, 'Chi-2':chi_support, 'RFE':rfe_support, 'Logistics':embeded_lr_support,
                                    'Random Forest':embeded_rf_support, 'LightGBM':embeded_lgb_support,'SVM':svm_supp})
# count the selected times for each feature
feature_selection_df['Total'] = np.sum(feature_selection_df, axis=1)
# display the top 100
feature_selection_df = feature_selection_df.sort_values(['Total','Feature'] , ascending=False)
feature_selection_df.index = range(1, len(feature_selection_df)+1)
feature_selection_df.head(150)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1227810650887574, 'fraction_numerical': 0.01849112426035503, 'mean_word_length': 3.480132450331126, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '275284', 'license': 'MIT', 'n_tokens_mistral': 456, 'n_tokens_neox': 429, 'n_words': 60, 'path': 'Feature_Selection/new_FS.ipynb', 'repo_name': 'ZiyiLiubird/MyCodes', 'size': '1352'}