Skip to content

Commit

Permalink
add performance check file
Browse files Browse the repository at this point in the history
  • Loading branch information
inreview23 committed Jun 11, 2024
1 parent 6951c3f commit 7bda0ed
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions examples/perf_check.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# -*- coding: utf-8 -*-
"""Example of combining multiple base outlier scores. Four combination
frameworks are demonstrated:
1. Average: take the average of all base detectors
2. maximization : take the maximum score across all detectors as the score
3. Average of Maximum (AOM)
4. Maximum of Average (MOA)
"""
# Author: Yue Zhao <zhaoy@cmu.edu>
# License: BSD 2 clause
Expand All @@ -21,13 +16,9 @@
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname("__file__"), '..')))

import numpy as np
from sklearn.model_selection import train_test_split
from scipy.io import loadmat

from pyod.models.knn import KNN
from pyod.models.combination import aom, moa, average, maximization, median
from pyod.utils.utility import standardizer
from pyod.utils.data import generate_data
from pyod.utils.data import evaluate_print

Expand All @@ -39,8 +30,7 @@
# Generate some data if the source data is missing

for mat_file in file_list:
# mat_file = 'cardio.mat'
# mat_file = 'letter.mat'

try:
mat = loadmat(os.path.join('data', mat_file))

Expand All @@ -56,7 +46,9 @@
X = mat['X']
y = mat['y'].ravel()

clf = KNN()
clf.fit(X)
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_)

0 comments on commit 7bda0ed

Please sign in to comment.