-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #588 from yzhao062/development
V2.0.1
- Loading branch information
Showing
36 changed files
with
1,982 additions
and
2,165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Example of combining multiple base outlier scores. Four combination | ||
frameworks are demonstrated: | ||
""" | ||
# Author: Yue Zhao <zhaoy@cmu.edu> | ||
# License: BSD 2 clause | ||
|
||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
import os | ||
import sys | ||
|
||
# temporary solution for relative imports in case pyod is not installed | ||
# if pyod is installed, no need to use the following line | ||
sys.path.append( | ||
os.path.abspath(os.path.join(os.path.dirname("__file__"), '..'))) | ||
|
||
from scipy.io import loadmat | ||
|
||
from pyod.models.knn import KNN | ||
from pyod.utils.data import generate_data | ||
from pyod.utils.data import evaluate_print | ||
|
||
if __name__ == "__main__": | ||
|
||
file_list = ['arrhythmia.mat', 'cardio.mat', 'ionosphere.mat', | ||
'letter.mat', 'pima.mat'] | ||
# Define data file and read X and y | ||
# Generate some data if the source data is missing | ||
|
||
for mat_file in file_list: | ||
|
||
try: | ||
mat = loadmat(os.path.join('data', mat_file)) | ||
|
||
except TypeError: | ||
print('{data_file} does not exist. Use generated data'.format( | ||
data_file=mat_file)) | ||
X, y = generate_data(train_only=True) # load data | ||
except IOError: | ||
print('{data_file} does not exist. Use generated data'.format( | ||
data_file=mat_file)) | ||
X, y = generate_data(train_only=True) # load data | ||
else: | ||
X = mat['X'] | ||
y = mat['y'].ravel() | ||
|
||
clf = KNN() # the algorithm you want to check | ||
# clf = KNN_new() | ||
clf.fit(X) # fit model | ||
|
||
# print performance | ||
evaluate_print(mat_file, y, clf.decision_scores_) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.