relief 算法
发布时间
阅读量:
阅读量
import numpy as np
import pandas as pd
from sklearn import datasets
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn.metrics import classification_report
data = datasets.load_breast_cancer()
feat,label = data.data,data.target
x = preprocessing.StandardScaler().fit_transform(feat)
arr = np.hstack((x,label.reshape(len(label),1)))
iter_times = 1000
def countNeighborDist(randomSample,randomIndex,label):
dis = {}
index = np.where(arr[:,-1]==label)[0]
for i in index:
dist
全部评论 (0)
还没有任何评论哟~
