Skip to content

Commit

Permalink
Sklearn random forest setting random state
Browse files Browse the repository at this point in the history
  • Loading branch information
swansonk14 committed Sep 24, 2020
1 parent a387d18 commit 69c29ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chemprop/sklearn_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def run_sklearn(args: SklearnTrainArgs,
debug('Building model')
if args.dataset_type == 'regression':
if args.model_type == 'random_forest':
model = RandomForestRegressor(n_estimators=args.num_trees, n_jobs=-1)
model = RandomForestRegressor(n_estimators=args.num_trees, n_jobs=-1, random_state=args.seed)
elif args.model_type == 'svm':
model = SVR()
else:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ def interpret(self,
(
'sklearn_random_forest',
'random_forest',
1.575406
1.582733
),
(
'sklearn_svm',
'svm',
1.698937
1.698927
),
(
'chemprop',
Expand Down Expand Up @@ -278,7 +278,7 @@ def test_train_multi_task_classification(self,
(
'sklearn_random_forest',
'random_forest',
0.915988
0.945589
),
(
'sklearn_svm',
Expand Down

0 comments on commit 69c29ed

Please sign in to comment.