Commit 28ce9a1b authored by Andrea Bizzego's avatar Andrea Bizzego

removed borda_count mlpy

parent 23999359
......@@ -31,7 +31,7 @@ class FeatureDataset(DAPDataset):
def __getitem__(self, idx):
sample = self._features.index[self._indexes[idx]]
label = self._labels.values[self._indexes[idx]][0]
label = self._labels.values[self._indexes[idx]]
data = self._features.values[self._indexes[idx],:]
output = {'data': data, 'target': label, 'sample': sample}
......@@ -7,7 +7,7 @@ import pickle
from .dapmodel import DAPModel
from ..ranking import kbest_ranking
from ..mlpy.borda import borda_count
from ..utils import borda_count
from sklearn.preprocessing import StandardScaler
class FeatureBasedModel(DAPModel):
import numpy as np
def bootstrap_CI(x, K=0.25, N=100):
K = int(K*len(x))
out = []
for i in range(N):
idx_select = np.random.permutation(len(x))[:K]
x_ = x[idx_select]
return(np.percentile(out, 50), np.percentile(out, 5), np.percentile(out, 95))
def borda_count(X):
X_rank = np.apply_along_axis(np.argsort, 1, X)
n_feat = X_rank.shape[1]
counts = np.zeros(n_feat)
for i_row in range(X_rank.shape[0]):
for i_col in range(n_feat):
counts[X_rank[i_row, i_col]] = counts[X_rank[i_row, i_col]] + n_feat - i_col
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment