Fix data normalization for knn
This commit is contained in:
parent
e63406c0a8
commit
4a345b832c
|
@ -8,7 +8,7 @@ from sklearn.metrics import confusion_matrix, roc_auc_score, roc_curve
|
|||
from sklearn.naive_bayes import GaussianNB
|
||||
from sklearn.neighbors import KNeighborsClassifier
|
||||
from sklearn.neural_network import MLPClassifier
|
||||
from sklearn.preprocessing import scale
|
||||
from sklearn.preprocessing import MinMaxScaler
|
||||
from sklearn.svm import LinearSVC
|
||||
from sklearn.tree import DecisionTreeClassifier
|
||||
|
||||
|
@ -32,7 +32,8 @@ def predict_data(data, target, model, results):
|
|||
model_name = model
|
||||
model = choose_model(model=model)
|
||||
if model_name == "knn":
|
||||
data = scale(data)
|
||||
scaler = MinMaxScaler()
|
||||
data[data.columns] = scaler.fit_transform(data[data.columns])
|
||||
confusion_matrices, auc, fpr, tpr = [], [], [], []
|
||||
for train_index, test_index in split_k_sets(data):
|
||||
model.fit(data.iloc[train_index], target.iloc[train_index])
|
||||
|
|
Loading…
Reference in New Issue