Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sklearn import datasets
- from sklearn.linear_model import LogisticRegression
- wine = datasets.load_wine()
- X = wine.data # rows of features
- y = wine.target # integer labels
- num_features = len(X[0])
- features = []
- for i in range(7):
- selected_feature = None
- max_precision = -1
- for j in range(num_features):
- if j in features:
- continue
- current_features = features.copy() # copy the current selection
- current_features.append(j) # and add what we are considering now
- sel_X = X[:, current_features]
- # 1. sel_X로 logistic regression classifier 학습
- # 2. classifier 정확도 평가
- # 3. 해당 feature(j)를 고를건지 말건지 판단
- print('>', current_features, score)
- #################################
- if selected_feature is not None:
- features.append(selected_feature)
- print(features)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement