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










0












$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?










share|improve this question











$endgroup$
















    0












    $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?










    share|improve this question











    $endgroup$














      0












      0








      0





      $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?










      share|improve this question











      $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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 29 at 1:36









      Ethan

      703525




      703525










      asked Mar 28 at 15:04









      HeddHedd

      1




      1




















          1 Answer
          1






          active

          oldest

          votes


















          0












          $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:
          enter image description here






          share|improve this answer









          $endgroup$













            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
            );



            );













            draft saved

            draft discarded


















            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









            0












            $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:
            enter image description here






            share|improve this answer









            $endgroup$

















              0












              $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:
              enter image description here






              share|improve this answer









              $endgroup$















                0












                0








                0





                $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:
                enter image description here






                share|improve this answer









                $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:
                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 29 at 10:55









                BiranjanBiranjan

                162




                162



























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

                    Luettelo Yhdysvaltain laivaston lentotukialuksista Lähteet | Navigointivalikko

                    Gary (muusikko) Sisällysluettelo Historia | Rockin' High | Lähteet | Aiheesta muualla | NavigointivalikkoInfobox OKTuomas "Gary" Keskinen Ancaran kitaristiksiProjekti Rockin' High