Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add regression plots [WIP] #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

domenicrosati
Copy link

Made this WIP while I was working on something else.
If this is interesting I can polish it up and test it.
Just let me know

@domenicrosati
Copy link
Author

I also ended up adding a miminimzation for 1st and 2nd order polynomials if that is wanted?

Copy link
Member

@mish15 mish15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! In principle i really like the idea. Needs a bit more work though. I've added some comments accordingly

@@ -283,6 +287,41 @@ func (r *Regression) String() string {
return str
}

//Plot regression and return file path where its saved
func (r *Regression) Plot() string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should:

  • return the err instead of panicking.
  • allow the user to specify where to save the file
  • needs to be more configurable in general. e.g. only the first two vars are plotted. What if there are more?


p, err := plot.New()
if err != nil {
panic(err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return err instead of panic

"Observed", observed,
"Predicted", predicted)
if err != nil {
panic(err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return err instead of panic

panic(err)
}
if err := p.Save(4*vg.Inch, 4*vg.Inch, "points.png"); err != nil {
panic(err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return err instead of panic

panic(err)
}
p.Title.Text = r.GetObserved()
p.X.Label.Text = r.GetVar(1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The var numbers are hardcoded to 0 and 1, but what if there are > 2 vars?

@olimpias
Copy link
Contributor

olimpias commented Nov 7, 2018

Hi @mish15 and @domenicrosati. I'm going to use this project in my master thesis as a lib. I'M going to need plotting... So since this PR is not completed for a long time, may I continue to work on different PR and contribute to you?. Thanks!

@mish15
Copy link
Member

mish15 commented Nov 11, 2018

@olimpias yes of course!

@olimpias
Copy link
Contributor

needs to be more configurable in general. e.g. only the first two vars are plotted. What if there are more? for that case. Since we were not able to draw many dimension on graph, should I just show the scatter for variable compared to observed? For instance, assume that observe -> Y and there is two variables on X, X1 and X2. There will be two graph created and statters will be showed on first graph like X1 to Y and on the other graph X2 to Y. For my thesis case, I'm going to have one variable. So things are easy. But for general purpose, I need your comments or advises @mish15 .

@mish15
Copy link
Member

mish15 commented Nov 26, 2018

@olimpias yeah i guess in general each variable needs to be plotted against Y. Potentially it would also be useful to see X1 against Xn, but that's less important.

@olimpias olimpias mentioned this pull request Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants