@@ -41,7 +41,7 @@ def print_outlier_ratio(y):
41
41
print ("----- Outlier ratio: %.5f" % (np .min (cnt ) / len (y )))
42
42
43
43
44
- SEED = 1
44
+ random_state = 1
45
45
fig_roc , ax_roc = plt .subplots (1 , 1 , figsize = (8 , 5 ))
46
46
47
47
# Set this to true for plotting score histograms for each dataset:
@@ -58,15 +58,15 @@ def print_outlier_ratio(y):
58
58
print ('--- Fetching data...' )
59
59
if dat in ['http' , 'smtp' , 'SF' , 'SA' ]:
60
60
dataset = fetch_kddcup99 (subset = dat , shuffle = True ,
61
- percent10 = True , random_state = SEED )
61
+ percent10 = True , random_state = random_state )
62
62
X = dataset .data
63
63
y = dataset .target
64
64
65
65
if dat == 'shuttle' :
66
66
dataset = fetch_mldata ('shuttle' )
67
67
X = dataset .data
68
68
y = dataset .target
69
- X , y = sh (X , y , random_state = SEED )
69
+ X , y = sh (X , y , random_state = random_state )
70
70
# we remove data with label 4
71
71
# normal data are then those of class 1
72
72
s = (y != 4 )
@@ -76,7 +76,7 @@ def print_outlier_ratio(y):
76
76
<
8000
span class=pl-en>print('----- ' )
77
77
78
78
if dat == 'forestcover' :
79
- dataset = fetch_covtype (shuffle = True , random_state = SEED )
79
+ dataset = fetch_covtype (shuffle = True , random_state = random_state )
80
80
X = dataset .data
81
81
y = dataset .target
82
82
# normal data are those with attribute 2
@@ -119,7 +119,7 @@ def print_outlier_ratio(y):
119
119
y_test = y [n_samples_train :]
120
120
121
121
print ('--- Fitting the IsolationForest estimator...' )
122
- model = IsolationForest (n_jobs = - 1 , random_state = SEED )
122
+ model = IsolationForest (n_jobs = - 1 , random_state = random_state )
123
123
tstart = time ()
124
124
model .fit (X_train )
125
125
fit_time = time () - tstart
0 commit comments