diff options
-rw-r--r-- | python/feast.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/python/feast.py b/python/feast.py index 4b4ad05..9955650 100644 --- a/python/feast.py +++ b/python/feast.py @@ -12,20 +12,18 @@ def select(data, labels, n_observations, n_features, n_select, method): exit() # JMI(n_features_to_ret, int n_samples, int n_feats, double *featureMatrix, double *classcol, outputFeatures); - c_output = (c_double * n_select) + output = np.zeros(n_select) c_n_observations = c_int(n_observations) c_n_select = c_int(n_select) c_n_features = c_int(n_features) - c_labels = (c_double * len(labels))(*labels) - - combined_list = [] - map(combined_list.extend, data.tolist()) - c_data = (c_double * len(combined_list))(*combined_list) - - - # right now just call only JMI, work out the rest later - libFSToolbox.JMI(c_n_select, c_n_observations, c_n_features, repr(c_data), repr(c_labels), repr(c_output)) + libFSToolbox.JMI(c_n_select, + c_n_observations, + c_n_features, + data.ctypes.data_as(POINTER(c_double)), + labels.ctypes.data_as(POINTER(c_double)), + output.ctypes.data_as(POINTER(c_double)) + ) return selected_features |