Skip to content

Commit

Permalink
Merge pull request #108 from JannisHoch/add_random_state
Browse files Browse the repository at this point in the history
Add random state
  • Loading branch information
JannisHoch committed Dec 4, 2020
2 parents 999ffde + 9dd4d96 commit 9774eee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
10 changes: 0 additions & 10 deletions appveyor.yml

This file was deleted.

6 changes: 3 additions & 3 deletions copro/machine_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def define_scaling(config):
elif config.get('machine_learning', 'scaler') == 'RobustScaler':
scaler = preprocessing.RobustScaler()
elif config.get('machine_learning', 'scaler') == 'QuantileTransformer':
scaler = preprocessing.QuantileTransformer()
scaler = preprocessing.QuantileTransformer(random_state=42)
else:
raise ValueError('no supported scaling-algorithm selected - choose between MinMaxScaler, StandardScaler, RobustScaler or QuantileTransformer')

Expand All @@ -47,11 +47,11 @@ def define_model(config):
"""

if config.get('machine_learning', 'model') == 'NuSVC':
clf = svm.NuSVC(nu=0.1, kernel='rbf', class_weight={1: 100}, probability=True, degree=10, gamma=10)
clf = svm.NuSVC(nu=0.1, kernel='rbf', class_weight={1: 100}, probability=True, degree=10, gamma=10, random_state=42)
elif config.get('machine_learning', 'model') == 'KNeighborsClassifier':
clf = neighbors.KNeighborsClassifier(n_neighbors=10, weights='distance')
elif config.get('machine_learning', 'model') == 'RFClassifier':
clf = ensemble.RandomForestClassifier(n_estimators=1000, class_weight={1: 100})
clf = ensemble.RandomForestClassifier(n_estimators=1000, class_weight={1: 100}, random_state=42)
else:
raise ValueError('no supported ML model selected - choose between NuSVC, KNeighborsClassifier or RFClassifier')

Expand Down

0 comments on commit 9774eee

Please sign in to comment.