8000 SEED -> random_state · scikit-learn/scikit-learn@3e06c31 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3e06c31

Browse files
committed
SEED -> random_state
1 parent aaf9e51 commit 3e06c31

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

benchmarks/bench_isolation_forest.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def print_outlier_ratio(y):
4141
print("----- Outlier ratio: %.5f" % (np.min(cnt) / len(y)))
4242

4343

44-
SEED = 1
44+
random_state = 1
4545
fig_roc, ax_roc = plt.subplots(1, 1, figsize=(8, 5))
4646

4747
# Set this to true for plotting score histograms for each dataset:
@@ -58,15 +58,15 @@ def print_outlier_ratio(y):
5858
print('--- Fetching data...')
5959
if dat in ['http', 'smtp', 'SF', 'SA']:
6060
dataset = fetch_kddcup99(subset=dat, shuffle=True,
61-
percent10=True, random_state=SEED)
61+
percent10=True, random_state=random_state)
6262
X = dataset.data
6363
y = dataset.target
6464

6565
if dat == 'shuttle':
6666
dataset = fetch_mldata('shuttle')
6767
X = dataset.data
6868
y = dataset.target
69-
X, y = sh(X, y, random_state=SEED)
69+
X, y = sh(X, y, random_state=random_state)
7070
# we remove data with label 4
7171
# normal data are then those of class 1
7272
s = (y != 4)
@@ -76,7 +76,7 @@ def print_outlier_ratio(y):
7676
< 8000 span class=pl-en>print('----- ')
7777

7878
if dat == 'forestcover':
79-
dataset = fetch_covtype(shuffle=True, random_state=SEED)
79+
dataset = fetch_covtype(shuffle=True, random_state=random_state)
8080
X = dataset.data
8181
y = dataset.target
8282
# normal data are those with attribute 2
@@ -119,7 +119,7 @@ def print_outlier_ratio(y):
119119
y_test = y[n_samples_train:]
120120

121121
print('--- Fitting the IsolationForest estimator...')
122-
model = IsolationForest(n_jobs=-1, random_state=SEED)
122+
model = IsolationForest(n_jobs=-1, random_state=random_state)
123123
tstart = time()
124124
model.fit(X_train)
125125
fit_time = time() - tstart

benchmarks/bench_lof.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
print(__doc__)
2929

30-
SEED = 2 # to control the random selection of anomalies in the SA dataset
30+
random_state = 2 # to control the random selection of anomalies in SA
3131

3232
# datasets available: ['http', 'smtp', 'SA', 'SF', 'shuttle', 'forestcover']
3333
datasets = ['http', 'smtp', 'SA', 'SF', 'shuttle', 'forestcover']
@@ -38,7 +38,7 @@
3838
print('loading data')
3939
if dataset_name in ['http', 'smtp', 'SA', 'SF']:
4040
dataset = fetch_kddcup99(subset=dataset_name, percent10=True,
41-
random_state=SEED)
41+
random_state=random_state)
4242
X = dataset.data
4343
y = dataset.target
4444

0 commit comments

Comments
 (0)
0