Does setting a random state in sklearn's RandomForestClassifier bias your model?Why does this code using random strings print “hello world”?random_state parameter in classification modelsHow to find the accuracy for Survival Analysis using RandomForestSRC package in RHow does one interpret the random forest classifier from sci-kit learn?Why does cross validation RF classification perform worse than without cross validation?Random forest sklearnRandom Forest and ImbalanceUsed SequentialFeatureSelector but does not improve the model accuracyRandom forest: balancing test set?How to find the difference between two Random Forest model instances?
Fair gambler's ruin problem intuition
Why is the sentence "Das ist eine Nase" correct?
Why were 5.25" floppy drives cheaper than 8"?
Is it possible to create a QR code using text?
Notepad++ delete until colon for every line with replace all
What is the fastest integer factorization to break RSA?
How to travel to Japan while expressing milk?
Is this answer explanation correct?
Placement of More Information/Help Icon button for Radio Buttons
GFCI outlets - can they be repaired? Are they really needed at the end of a circuit?
How badly should I try to prevent a user from XSSing themselves?
How to Prove P(a) → ∀x(P(x) ∨ ¬(x = a)) using Natural Deduction
Was the Stack Exchange "Happy April Fools" page fitting with the '90's code?
Does Dispel Magic work on Tiny Hut?
Is it inappropriate for a student to attend their mentor's dissertation defense?
Is there a hemisphere-neutral way of specifying a season?
Did 'Cinema Songs' exist during Hiranyakshipu's time?
What historical events would have to change in order to make 19th century "steampunk" technology possible?
Ambiguity in the definition of entropy
What is required to make GPS signals available indoors?
Is there an expression that means doing something right before you will need it rather than doing it in case you might need it?
OP Amp not amplifying audio signal
What Exploit Are These User Agents Trying to Use?
What are the G forces leaving Earth orbit?
Does setting a random state in sklearn's RandomForestClassifier bias your model?
Why does this code using random strings print “hello world”?random_state parameter in classification modelsHow to find the accuracy for Survival Analysis using RandomForestSRC package in RHow does one interpret the random forest classifier from sci-kit learn?Why does cross validation RF classification perform worse than without cross validation?Random forest sklearnRandom Forest and ImbalanceUsed SequentialFeatureSelector but does not improve the model accuracyRandom forest: balancing test set?How to find the difference between two Random Forest model instances?
I've training a random forest model and am using a consistent random_state
value. I'm also getting really good accuracies across my training, test, and validation datasets (all are around ~.98). Though the minority class comprises only ~10% of the dataset.
Here's some code if you're interested:
model = RandomForestClassifier(n_jobs=-1, oob_score=True, random_state=310, n_estimators=300)
model.fit(subset, train.iloc[:,-1])
Given the good accuracy scores across training, validation and testing datsets, does random_state
affect the generalization of my model?
random scikit-learn random-forest random-seed
add a comment |
I've training a random forest model and am using a consistent random_state
value. I'm also getting really good accuracies across my training, test, and validation datasets (all are around ~.98). Though the minority class comprises only ~10% of the dataset.
Here's some code if you're interested:
model = RandomForestClassifier(n_jobs=-1, oob_score=True, random_state=310, n_estimators=300)
model.fit(subset, train.iloc[:,-1])
Given the good accuracy scores across training, validation and testing datsets, does random_state
affect the generalization of my model?
random scikit-learn random-forest random-seed
add a comment |
I've training a random forest model and am using a consistent random_state
value. I'm also getting really good accuracies across my training, test, and validation datasets (all are around ~.98). Though the minority class comprises only ~10% of the dataset.
Here's some code if you're interested:
model = RandomForestClassifier(n_jobs=-1, oob_score=True, random_state=310, n_estimators=300)
model.fit(subset, train.iloc[:,-1])
Given the good accuracy scores across training, validation and testing datsets, does random_state
affect the generalization of my model?
random scikit-learn random-forest random-seed
I've training a random forest model and am using a consistent random_state
value. I'm also getting really good accuracies across my training, test, and validation datasets (all are around ~.98). Though the minority class comprises only ~10% of the dataset.
Here's some code if you're interested:
model = RandomForestClassifier(n_jobs=-1, oob_score=True, random_state=310, n_estimators=300)
model.fit(subset, train.iloc[:,-1])
Given the good accuracy scores across training, validation and testing datsets, does random_state
affect the generalization of my model?
random scikit-learn random-forest random-seed
random scikit-learn random-forest random-seed
edited Mar 9 at 8:59
AI_Learning
4,15521035
4,15521035
asked Mar 8 at 20:58
Joe BJoe B
16812
16812
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
random_state
does not affect the generalization of the model. In fact, it is the best practice to have same value for random_state
when you tune your hyper parameters such as n_estimators
, depth
, etc. This will ensure that your performance is not affected by the random initial state.
Also, Accuracy is not the recommended metrics to measure the performance of the model, when you have such as unbalanced dataset.
Area under the ROC or PR curve could be one of the few best things you can use but there are a lot of metrics available. See here
1
Thanks! just what I was looking for. re accuracy - I'm actually using a confusion matrix to measure for internal metrics, but that is a good point.
– Joe B
Mar 9 at 17:26
add a comment |
random_state : int, RandomState instance or None, optional (default=None)
If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.
In general random_state
is be used to set the internal parameters initially, so you can repeat the training deterministically. Now you can change other hyperparameters (e.g. number of trees) to compare the results.
A disadvantage could be that you don't find the global optimum. But your results sound really good with an accuracy of 0.98
.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55070918%2fdoes-setting-a-random-state-in-sklearns-randomforestclassifier-bias-your-model%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
random_state
does not affect the generalization of the model. In fact, it is the best practice to have same value for random_state
when you tune your hyper parameters such as n_estimators
, depth
, etc. This will ensure that your performance is not affected by the random initial state.
Also, Accuracy is not the recommended metrics to measure the performance of the model, when you have such as unbalanced dataset.
Area under the ROC or PR curve could be one of the few best things you can use but there are a lot of metrics available. See here
1
Thanks! just what I was looking for. re accuracy - I'm actually using a confusion matrix to measure for internal metrics, but that is a good point.
– Joe B
Mar 9 at 17:26
add a comment |
random_state
does not affect the generalization of the model. In fact, it is the best practice to have same value for random_state
when you tune your hyper parameters such as n_estimators
, depth
, etc. This will ensure that your performance is not affected by the random initial state.
Also, Accuracy is not the recommended metrics to measure the performance of the model, when you have such as unbalanced dataset.
Area under the ROC or PR curve could be one of the few best things you can use but there are a lot of metrics available. See here
1
Thanks! just what I was looking for. re accuracy - I'm actually using a confusion matrix to measure for internal metrics, but that is a good point.
– Joe B
Mar 9 at 17:26
add a comment |
random_state
does not affect the generalization of the model. In fact, it is the best practice to have same value for random_state
when you tune your hyper parameters such as n_estimators
, depth
, etc. This will ensure that your performance is not affected by the random initial state.
Also, Accuracy is not the recommended metrics to measure the performance of the model, when you have such as unbalanced dataset.
Area under the ROC or PR curve could be one of the few best things you can use but there are a lot of metrics available. See here
random_state
does not affect the generalization of the model. In fact, it is the best practice to have same value for random_state
when you tune your hyper parameters such as n_estimators
, depth
, etc. This will ensure that your performance is not affected by the random initial state.
Also, Accuracy is not the recommended metrics to measure the performance of the model, when you have such as unbalanced dataset.
Area under the ROC or PR curve could be one of the few best things you can use but there are a lot of metrics available. See here
answered Mar 9 at 8:57
AI_LearningAI_Learning
4,15521035
4,15521035
1
Thanks! just what I was looking for. re accuracy - I'm actually using a confusion matrix to measure for internal metrics, but that is a good point.
– Joe B
Mar 9 at 17:26
add a comment |
1
Thanks! just what I was looking for. re accuracy - I'm actually using a confusion matrix to measure for internal metrics, but that is a good point.
– Joe B
Mar 9 at 17:26
1
1
Thanks! just what I was looking for. re accuracy - I'm actually using a confusion matrix to measure for internal metrics, but that is a good point.
– Joe B
Mar 9 at 17:26
Thanks! just what I was looking for. re accuracy - I'm actually using a confusion matrix to measure for internal metrics, but that is a good point.
– Joe B
Mar 9 at 17:26
add a comment |
random_state : int, RandomState instance or None, optional (default=None)
If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.
In general random_state
is be used to set the internal parameters initially, so you can repeat the training deterministically. Now you can change other hyperparameters (e.g. number of trees) to compare the results.
A disadvantage could be that you don't find the global optimum. But your results sound really good with an accuracy of 0.98
.
add a comment |
random_state : int, RandomState instance or None, optional (default=None)
If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.
In general random_state
is be used to set the internal parameters initially, so you can repeat the training deterministically. Now you can change other hyperparameters (e.g. number of trees) to compare the results.
A disadvantage could be that you don't find the global optimum. But your results sound really good with an accuracy of 0.98
.
add a comment |
random_state : int, RandomState instance or None, optional (default=None)
If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.
In general random_state
is be used to set the internal parameters initially, so you can repeat the training deterministically. Now you can change other hyperparameters (e.g. number of trees) to compare the results.
A disadvantage could be that you don't find the global optimum. But your results sound really good with an accuracy of 0.98
.
random_state : int, RandomState instance or None, optional (default=None)
If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.
In general random_state
is be used to set the internal parameters initially, so you can repeat the training deterministically. Now you can change other hyperparameters (e.g. number of trees) to compare the results.
A disadvantage could be that you don't find the global optimum. But your results sound really good with an accuracy of 0.98
.
answered Mar 8 at 21:19
Darius M.Darius M.
3,50012036
3,50012036
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55070918%2fdoes-setting-a-random-state-in-sklearns-randomforestclassifier-bias-your-model%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown