Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- import numpy as np
- import os
- from sklearn.datasets import load_iris
- from sklearn.feature_selection import SelectKBest
- from sklearn.feature_selection import f_classif
- features_dic = {}
- results_dic = {}
- script_dir = os.path.dirname(__file__)
- rel_path = "bialaczka_switched.xls"
- abs_file_path = os.path.join(script_dir, rel_path)
- dataExcel = pd.read_excel(abs_file_path, nrows=410)
- df = pd.DataFrame(dataExcel)
- feature_data = df.iloc[:, :-2]
- diagnose_classes = np.array(df['Klasa'])
- # Create an SelectKBest object to select features with two best ANOVA F-Values
- fvalue_selector = SelectKBest(f_classif)
- # Apply the SelectKBest object to the features and target
- feature_data_kbest = fvalue_selector.fit(feature_data, diagnose_classes)
- ranking = fvalue_selector.scores_
- ranking_ = pd.DataFrame(ranking)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement