ref: https://pyod.readthedocs.io/en/latest/pyod.models.html#all-models
1. Imports
import pandas as pd
import numpy as np
import sklearn
import pickle
import time
import datetime
/tmp/ipykernel_3766802/761229760.py:1: DeprecationWarning:
Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),
(to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)
but was not found to be installed on your system.
If this would cause problems for you,
please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466
import pandas as pd
import warnings
warnings.filterwarnings('ignore' )
with open ('fraudTrain.pkl' , 'rb' ) as file :
fraudTrain = pickle.load(file )
2.
pyod(* pyod_preprocess2(fraudTrain))
0
COPOD
0.200191
0.736597
0.748475
0.724409
0.736245
0.736782
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None
1
ECOD
0.003224
0.660340
0.668449
0.656168
0.662252
0.660403
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None
2
GMM
0.023980
0.662005
0.670691
0.656168
0.663350
0.662093
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None
3
HBOS
0.897164
0.492174
0.000000
0.000000
0.000000
0.499662
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None
4
IForest
0.142015
0.666334
0.670143
0.674541
0.672335
0.666209
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None
5
INNE
0.327061
0.583750
0.591212
0.582677
0.586913
0.583766
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None
6
KDE
2.038541
0.760906
0.762712
0.767717
0.765206
0.760802
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None
7
KNN
0.009548
0.721945
0.727693
0.722441
0.725058
0.721937
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None
8
LODA
0.023346
0.492507
0.000000
0.000000
0.000000
0.500000
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None
9
LOF
0.016555
0.505495
0.511684
0.560367
0.534920
0.504660
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None
10
MAD
0.001449
0.731269
0.973580
0.483596
0.646208
0.735037
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None
11
MCD
0.004074
0.769564
0.775862
0.767717
0.771768
0.769592
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None
12
OCSVM
3.871274
0.703297
0.702236
0.721129
0.711557
0.703025
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None
13
PCA
0.002268
0.234765
0.238866
0.232283
0.235529
0.234803
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None
14
ROD
2.136653
0.318015
0.324161
0.316929
0.320504
0.318032
False
pyod
0.5
9009
[amt]
0.497502
3003
0.507493
None