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_3766458/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, 10 ))
0
ABOD
1.333059
0.993897
0.000000
0.00000
0.000000
0.500000
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
1
COPOD
0.064687
0.547473
0.009801
0.73125
0.019344
0.638797
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
2
ECOD
0.003290
0.561968
0.011982
0.86875
0.023637
0.714417
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
3
GMM
0.026987
0.663971
0.011632
0.64375
0.022851
0.653923
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
4
HBOS
0.768681
0.979630
0.141762
0.46250
0.217009
0.722653
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
5
IForest
0.143493
0.722258
0.014323
0.65625
0.028034
0.689457
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
6
INNE
0.317980
0.538699
0.007511
0.56875
0.014827
0.553632
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
7
KDE
2.016948
0.776273
0.019538
0.72500
0.038052
0.750794
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
8
KNN
0.009457
0.753729
0.015990
0.65000
0.031212
0.702183
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
9
LODA
0.025826
0.991265
0.317460
0.37500
0.343840
0.685024
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
10
LOF
0.022515
0.430822
0.005096
0.47500
0.010084
0.452775
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
11
MAD
0.001539
0.987450
0.215488
0.40000
0.280088
0.695529
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
12
MCD
0.007115
0.781041
0.019959
0.72500
0.038848
0.753193
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
13
OCSVM
3.877473
0.713828
0.014546
0.68750
0.028490
0.700745
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
14
PCA
0.002321
0.230898
0.002240
0.28125
0.004444
0.255920
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None
15
ROD
2.235700
0.497120
0.003204
0.26250
0.006331
0.380530
False
pyod
0.131955
9009
[amt]
0.498168
26215
0.006103
None