Validation curve
$begingroup$
I'm learning about data science and I've been checking several tutorials. Now I'm trying some validation curves on the problem sample I'm resolving and I'm having some troubles with it. This is the code:
from sklearn.model_selection import validation_curve
degree = np.arange(0, 5)
train_score, val_score = validation_curve(poly_model, BBrentt, Petrol7['FValues'],'polynomialfeatures__degree', degree, cv=5)
plt.plot(degree, np.median(train_score, 1), color='blue', label='training score')
plt.plot(degree, np.median(val_score, 1), color='red', label='validation score')
plt.legend(loc='best')
plt.ylim(0, 1)
plt.xlabel('degree')
plt.ylabel('score');
print(train_score)
print(val_score) '
poly_model is the polinomial regression I did earlier, BBrentt and Petrol7['FValues'] are the data i'm using, they're fine i believe. Here's a picture of the results I get and a pic of the regression and the data I used earlier. What am I doing wrong? Because clearly the validation score is too low
python cross-validation training
New contributor
$endgroup$
add a comment |
$begingroup$
I'm learning about data science and I've been checking several tutorials. Now I'm trying some validation curves on the problem sample I'm resolving and I'm having some troubles with it. This is the code:
from sklearn.model_selection import validation_curve
degree = np.arange(0, 5)
train_score, val_score = validation_curve(poly_model, BBrentt, Petrol7['FValues'],'polynomialfeatures__degree', degree, cv=5)
plt.plot(degree, np.median(train_score, 1), color='blue', label='training score')
plt.plot(degree, np.median(val_score, 1), color='red', label='validation score')
plt.legend(loc='best')
plt.ylim(0, 1)
plt.xlabel('degree')
plt.ylabel('score');
print(train_score)
print(val_score) '
poly_model is the polinomial regression I did earlier, BBrentt and Petrol7['FValues'] are the data i'm using, they're fine i believe. Here's a picture of the results I get and a pic of the regression and the data I used earlier. What am I doing wrong? Because clearly the validation score is too low
python cross-validation training
New contributor
$endgroup$
$begingroup$
It doesn't look like you've done any preprocessing on the data. Perhaps consider scaling the data within your cross validation. You can put the scaler in aPipeline
with your estimator and then use the pipeline within the cross-validation function. I'm not sure if this will help, but you can at least eliminate it as a problem.
$endgroup$
– Wes
16 hours ago
add a comment |
$begingroup$
I'm learning about data science and I've been checking several tutorials. Now I'm trying some validation curves on the problem sample I'm resolving and I'm having some troubles with it. This is the code:
from sklearn.model_selection import validation_curve
degree = np.arange(0, 5)
train_score, val_score = validation_curve(poly_model, BBrentt, Petrol7['FValues'],'polynomialfeatures__degree', degree, cv=5)
plt.plot(degree, np.median(train_score, 1), color='blue', label='training score')
plt.plot(degree, np.median(val_score, 1), color='red', label='validation score')
plt.legend(loc='best')
plt.ylim(0, 1)
plt.xlabel('degree')
plt.ylabel('score');
print(train_score)
print(val_score) '
poly_model is the polinomial regression I did earlier, BBrentt and Petrol7['FValues'] are the data i'm using, they're fine i believe. Here's a picture of the results I get and a pic of the regression and the data I used earlier. What am I doing wrong? Because clearly the validation score is too low
python cross-validation training
New contributor
$endgroup$
I'm learning about data science and I've been checking several tutorials. Now I'm trying some validation curves on the problem sample I'm resolving and I'm having some troubles with it. This is the code:
from sklearn.model_selection import validation_curve
degree = np.arange(0, 5)
train_score, val_score = validation_curve(poly_model, BBrentt, Petrol7['FValues'],'polynomialfeatures__degree', degree, cv=5)
plt.plot(degree, np.median(train_score, 1), color='blue', label='training score')
plt.plot(degree, np.median(val_score, 1), color='red', label='validation score')
plt.legend(loc='best')
plt.ylim(0, 1)
plt.xlabel('degree')
plt.ylabel('score');
print(train_score)
print(val_score) '
poly_model is the polinomial regression I did earlier, BBrentt and Petrol7['FValues'] are the data i'm using, they're fine i believe. Here's a picture of the results I get and a pic of the regression and the data I used earlier. What am I doing wrong? Because clearly the validation score is too low
python cross-validation training
python cross-validation training
New contributor
New contributor
New contributor
asked 18 hours ago
Armando DelgadoArmando Delgado
1
1
New contributor
New contributor
$begingroup$
It doesn't look like you've done any preprocessing on the data. Perhaps consider scaling the data within your cross validation. You can put the scaler in aPipeline
with your estimator and then use the pipeline within the cross-validation function. I'm not sure if this will help, but you can at least eliminate it as a problem.
$endgroup$
– Wes
16 hours ago
add a comment |
$begingroup$
It doesn't look like you've done any preprocessing on the data. Perhaps consider scaling the data within your cross validation. You can put the scaler in aPipeline
with your estimator and then use the pipeline within the cross-validation function. I'm not sure if this will help, but you can at least eliminate it as a problem.
$endgroup$
– Wes
16 hours ago
$begingroup$
It doesn't look like you've done any preprocessing on the data. Perhaps consider scaling the data within your cross validation. You can put the scaler in a
Pipeline
with your estimator and then use the pipeline within the cross-validation function. I'm not sure if this will help, but you can at least eliminate it as a problem.$endgroup$
– Wes
16 hours ago
$begingroup$
It doesn't look like you've done any preprocessing on the data. Perhaps consider scaling the data within your cross validation. You can put the scaler in a
Pipeline
with your estimator and then use the pipeline within the cross-validation function. I'm not sure if this will help, but you can at least eliminate it as a problem.$endgroup$
– Wes
16 hours ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "557"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
});
}
});
Armando Delgado is a new contributor. Be nice, and check out our Code of Conduct.
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%2fdatascience.stackexchange.com%2fquestions%2f45806%2fvalidation-curve%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Armando Delgado is a new contributor. Be nice, and check out our Code of Conduct.
Armando Delgado is a new contributor. Be nice, and check out our Code of Conduct.
Armando Delgado is a new contributor. Be nice, and check out our Code of Conduct.
Armando Delgado is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Data Science Stack Exchange!
- 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.
Use MathJax to format equations. MathJax reference.
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%2fdatascience.stackexchange.com%2fquestions%2f45806%2fvalidation-curve%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
$begingroup$
It doesn't look like you've done any preprocessing on the data. Perhaps consider scaling the data within your cross validation. You can put the scaler in a
Pipeline
with your estimator and then use the pipeline within the cross-validation function. I'm not sure if this will help, but you can at least eliminate it as a problem.$endgroup$
– Wes
16 hours ago