Multiple regression (using machine learning - how plot data) The 2019 Stack Overflow Developer Survey Results Are InRegression Model for explained model(Details inside)Multiple linear regression, fMRIInterpreting Multiple Linear RegressionHow to plot similarity of two datasets?Best model for Machine LearningHow to plot using facet_wrap, over multiple pages as a .pdf files in r cranHow to replace NA Data using a regression?Using multiple machine learning algorithms togetherResidual plotting - why do we want to know the error?Machine learning using python
What do the Banks children have against barley water?
Could JWST stay at L2 "forever"?
What does "sndry explns" mean in one of the Hitchhiker's guide books?
How to deal with fear of taking dependencies
Are there any other methods to apply to solving simultaneous equations?
Protecting Dualbooting Windows from dangerous code (like rm -rf)
Is it true that “A.D.” is traditionally placed before the year number?
What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?
Lethal sonic weapons
How can I make payments on the Internet without leaving a money trail?
Return to UK after being refused entry years previously
What is the steepest gradient that a canal can be traversable without locks?
Recording with midi/synth vs actual instrument?
Landlord wants to switch my lease to a "Land contract" to "get back at the city"
It's possible to run Ubuntu straight from a USB stick and use the same stick as HDD?
Patience, young "Padovan"
What do hard-Brexiteers want with respect to the Irish border?
Does duplicating a spell with Wish count as casting that spell?
Does a dangling wire really electrocute me if I'm standing in water?
What is the motivation for a law requiring 2 parties to consent for recording a conversation
Why is Grand Jury testimony secret?
Inline version of a function returns different value than non-inline version
Is there a name of the flying bionic bird?
Why do UK politicians seemingly ignore opinion polls on Brexit?
Multiple regression (using machine learning - how plot data)
The 2019 Stack Overflow Developer Survey Results Are InRegression Model for explained model(Details inside)Multiple linear regression, fMRIInterpreting Multiple Linear RegressionHow to plot similarity of two datasets?Best model for Machine LearningHow to plot using facet_wrap, over multiple pages as a .pdf files in r cranHow to replace NA Data using a regression?Using multiple machine learning algorithms togetherResidual plotting - why do we want to know the error?Machine learning using python
$begingroup$
I wonder how I can use machine learning to plot multiple linear regression in a figure. I have one independent variable (prices of apartments) and five independent (floor, builtyear, roomnumber, square meter, kr/sqm).
The task is first to use machine learning which gives the predicted values and the actual values. Then you have to plot those values in a figure.
I have used this code:
x_train, x_test, y_train, y_test = tts(xx1, y, test_size=3)
Outcome: LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None,
normalize=False)
regr.fit(x_train, y_train)
Outcome:nothing
regr.predict(x_test)
Outcome: array([2.37671029, 3.91651234, 2.98472475])
np.mean((regr.predict(x_test) - y_test) ** 2)
Outcome: 2.976924398032532e-26
How can I plot the actual values of the dependent variable and the predicted ones in the same figure?
machine-learning linear-regression plotting
$endgroup$
add a comment |
$begingroup$
I wonder how I can use machine learning to plot multiple linear regression in a figure. I have one independent variable (prices of apartments) and five independent (floor, builtyear, roomnumber, square meter, kr/sqm).
The task is first to use machine learning which gives the predicted values and the actual values. Then you have to plot those values in a figure.
I have used this code:
x_train, x_test, y_train, y_test = tts(xx1, y, test_size=3)
Outcome: LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None,
normalize=False)
regr.fit(x_train, y_train)
Outcome:nothing
regr.predict(x_test)
Outcome: array([2.37671029, 3.91651234, 2.98472475])
np.mean((regr.predict(x_test) - y_test) ** 2)
Outcome: 2.976924398032532e-26
How can I plot the actual values of the dependent variable and the predicted ones in the same figure?
machine-learning linear-regression plotting
$endgroup$
add a comment |
$begingroup$
I wonder how I can use machine learning to plot multiple linear regression in a figure. I have one independent variable (prices of apartments) and five independent (floor, builtyear, roomnumber, square meter, kr/sqm).
The task is first to use machine learning which gives the predicted values and the actual values. Then you have to plot those values in a figure.
I have used this code:
x_train, x_test, y_train, y_test = tts(xx1, y, test_size=3)
Outcome: LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None,
normalize=False)
regr.fit(x_train, y_train)
Outcome:nothing
regr.predict(x_test)
Outcome: array([2.37671029, 3.91651234, 2.98472475])
np.mean((regr.predict(x_test) - y_test) ** 2)
Outcome: 2.976924398032532e-26
How can I plot the actual values of the dependent variable and the predicted ones in the same figure?
machine-learning linear-regression plotting
$endgroup$
I wonder how I can use machine learning to plot multiple linear regression in a figure. I have one independent variable (prices of apartments) and five independent (floor, builtyear, roomnumber, square meter, kr/sqm).
The task is first to use machine learning which gives the predicted values and the actual values. Then you have to plot those values in a figure.
I have used this code:
x_train, x_test, y_train, y_test = tts(xx1, y, test_size=3)
Outcome: LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None,
normalize=False)
regr.fit(x_train, y_train)
Outcome:nothing
regr.predict(x_test)
Outcome: array([2.37671029, 3.91651234, 2.98472475])
np.mean((regr.predict(x_test) - y_test) ** 2)
Outcome: 2.976924398032532e-26
How can I plot the actual values of the dependent variable and the predicted ones in the same figure?
machine-learning linear-regression plotting
machine-learning linear-regression plotting
edited Mar 29 at 1:36
Ethan
703525
703525
asked Mar 28 at 15:04
HeddHedd
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
There might possibly be a better way but one way of doing this is to map the variable to different aesthetics of the graph. I used python and used library plotninne
which is as I understand tries to mimic ggplot2 from R.
from plotnine import *
# df is the data frame that contains all the vairables as columns
(ggplot(df, aes('actual_value', 'predicted_value',
color='(dependent_var2)',
size='dependent_var3',alpha='dependent_var4',shape='factor(dependent_var5)'))
+ geom_point()
+theme(legend_title=element_text(size=8),
legend_text=element_text(size=4)
)
This will give you following graph:
$endgroup$
add a comment |
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
);
);
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%2f48152%2fmultiple-regression-using-machine-learning-how-plot-data%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
There might possibly be a better way but one way of doing this is to map the variable to different aesthetics of the graph. I used python and used library plotninne
which is as I understand tries to mimic ggplot2 from R.
from plotnine import *
# df is the data frame that contains all the vairables as columns
(ggplot(df, aes('actual_value', 'predicted_value',
color='(dependent_var2)',
size='dependent_var3',alpha='dependent_var4',shape='factor(dependent_var5)'))
+ geom_point()
+theme(legend_title=element_text(size=8),
legend_text=element_text(size=4)
)
This will give you following graph:
$endgroup$
add a comment |
$begingroup$
There might possibly be a better way but one way of doing this is to map the variable to different aesthetics of the graph. I used python and used library plotninne
which is as I understand tries to mimic ggplot2 from R.
from plotnine import *
# df is the data frame that contains all the vairables as columns
(ggplot(df, aes('actual_value', 'predicted_value',
color='(dependent_var2)',
size='dependent_var3',alpha='dependent_var4',shape='factor(dependent_var5)'))
+ geom_point()
+theme(legend_title=element_text(size=8),
legend_text=element_text(size=4)
)
This will give you following graph:
$endgroup$
add a comment |
$begingroup$
There might possibly be a better way but one way of doing this is to map the variable to different aesthetics of the graph. I used python and used library plotninne
which is as I understand tries to mimic ggplot2 from R.
from plotnine import *
# df is the data frame that contains all the vairables as columns
(ggplot(df, aes('actual_value', 'predicted_value',
color='(dependent_var2)',
size='dependent_var3',alpha='dependent_var4',shape='factor(dependent_var5)'))
+ geom_point()
+theme(legend_title=element_text(size=8),
legend_text=element_text(size=4)
)
This will give you following graph:
$endgroup$
There might possibly be a better way but one way of doing this is to map the variable to different aesthetics of the graph. I used python and used library plotninne
which is as I understand tries to mimic ggplot2 from R.
from plotnine import *
# df is the data frame that contains all the vairables as columns
(ggplot(df, aes('actual_value', 'predicted_value',
color='(dependent_var2)',
size='dependent_var3',alpha='dependent_var4',shape='factor(dependent_var5)'))
+ geom_point()
+theme(legend_title=element_text(size=8),
legend_text=element_text(size=4)
)
This will give you following graph:
answered Mar 29 at 10:55
BiranjanBiranjan
162
162
add a comment |
add a comment |
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%2f48152%2fmultiple-regression-using-machine-learning-how-plot-data%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