April 28, 2014 · machine learning R

Example of linear regression and regularization in R

When getting started in machine learning, it's often helpful to see a worked example of a real-world problem from start to finish. But it can be hard to find an example with the "right" level of complexity for a novice. Here's what I look for:

My linear regression example

In my Data Science class, we were assigned to perform linear regression on a dataset based on Kaggle's Job Salary Prediction competition. I posted my solution on RPubs, and thought it might be helpful as a regression example for other machine learning novices. Here's what my solution entails:

Please check it out, and let me know what you think! You can also run the code yourself if you download the data files into your working directory in R.

I'm happy to answer your questions! I admit that I didn't include nearly enough explanation for someone who is unfamiliar with these techniques, though I hope you find it useful in any case.

Publishing your own document to RPubs

If you've never used RPubs, it's an easy (and free) way to publish "R Markdown" documents directly from RStudio. It allows you to weave together your code, output (including plots), and explanation (written in standard Markdown) into a single document. Here's how to get started with R Markdown, and how to publish to RPubs.

Comments powered by Disqus