RELIEF Feature Selection(RELIEF
特征选择
) Python
实现
写在前面:
之所以有这篇博文,是因为之前实验的时候很想用
RELIEF
特征选择,
但是苦苦寻找却没有
Python
版的,
所以就随手写
了一个。
(这里仅仅是
RELIEF
,也就是针对两类问题的)废
话不多说,稍微简单介绍一下
RELIEF
。
RELIEF[edit]
Take a data set with n instances of p features, belonging to two
known classes. Within the data set, each feature should be scaled
to the interval [0 1] (binary data should remain as 0 and 1). The
algorithm will be repeated m times.
Start with a p-long weight vector (W) of zeros.
At each iteration, take the feature vector (X) belonging to one
random instance, and the feature vectors of the instance closest
to X (by Euclidean distance) from each class. The closest
same-class instance is called 'near-hit', and the closest