f4c6a4d34484b162044b21e6d9aaadb32e7f3cf4,pyod/models/cof.py,COF,_cof,#COF#Any#,110

Before Change


        sbn_path_index, ac_dist, cof_ = [], [], []
        for i in range(X.shape[0]):
            sbn_path = sorted(range(len(dist_matrix.loc[i].tolist())),
                              key=dist_matrix.loc[i].tolist().__getitem__)
            sbn_path_index.append(sbn_path[1: self.n_neighbors_ + 1])
            cost_desc = []
            // this section takes the most time if number of neighbors is high!

After Change


        :return: numpy array containing COF scores for observations.
                 The greater the COF, the greater the outlierness.
        
        dist_matrix = np.array(distance_matrix(X, X))
        sbn_path_index, ac_dist, cof_ = [], [], []
        for i in range(X.shape[0]):
            sbn_path = sorted(range(len(dist_matrix[i])),
                              key=dist_matrix[i].__getitem__)
            sbn_path_index.append(sbn_path[1: self.n_neighbors_ + 1])
            cost_desc = []
            for j in range(self.n_neighbors_):
                cost_desc.append(np.min(dist_matrix[sbn_path[j + 1]][sbn_path][:j + 1]))
            acd = []
            for _h, cost_ in enumerate(cost_desc):
                acd.append(((2. * (self.n_neighbors_ + 1 - (_h + 1))) /
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: yzhao062/pyod
Commit Name: f4c6a4d34484b162044b21e6d9aaadb32e7f3cf4
Time: 2019-04-20
Author: almardeny@gmail.com
File Name: pyod/models/cof.py
Class Name: COF
Method Name: _cof


Project Name: regel/loudml
Commit Name: 2dd4e24bc112d66f25578c6b12ec7f0d1caf2f39
Time: 2017-09-28
Author: sebastien.regel@gmail.com
File Name: python/bonsai/compute.py
Class Name:
Method Name: range_predict


Project Name: PyMVPA/PyMVPA
Commit Name: 5bc47f908692c2c46173eb2451960816b6d0b58e
Time: 2010-01-10
Author: psederberg@gmail.com
File Name: mvpa/clfs/glmnet.py
Class Name: _GLMNET
Method Name: _train