blob: 4c965e300f7bb7b1801d078d83c72bdcf1ac1ec6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/usr/bin/env python
import feast
import numpy as np
import import_data
print '---> Loading digit data'
data_source = 'uniform'
if data_source == 'uniform':
data, labels = import_data.uniform_data()
elif data_source == 'digits':
data, labels = import_data.read_digits('digit.txt')
n_observations = len(data) # number of samples in the data set
n_features = len(data.transpose()) # number of features in the data set
n_select = 15 # how many features to select
method = 'JMI' # feature selection algorithm
print '---> Information'
print ' :n_observations - ' + str(n_observations)
print ' :n_features - ' + str(n_features)
print ' :n_select - ' + str(n_select)
print ' :algorithm - ' + str(method)
selected_features = feast.select(data, labels, n_observations, n_features, n_select, method)
|