Pricing with polynomial regression

From http://pathofexile.gamepedia.com/Taste_of_Hate

This post will be covering polynomial regression in Python. It’s part of a series on pricing items in Path of Exile with Python, the previous post was about applying linear regression. If you’ve already seen it, you can skip the first couple paragraphs of this post.

Again, I’ll be using the type of item on the left, Taste of Hate. It has a single variable attribute ranging from 20 to 30.


Installation

For this post I’ve used a Jupyter Notebook which this earlier post tells you how to set up. To install the required libraries run the following script on your host.

Run it on your Jupyter Notebook host.

Creating a scatter plot of our data

I’ve extracted the rolls and prices(in Chaos Orbs), from the top entries in poe.trade(effectively Path of Exile’s auction house).

The code that generates the graph below.

I’ve used Matplotlib to visualize the rolls and prices in a scatter plot on the left. There’s already a visible relation between rolls and price. You can see that perfect 30 rolls are valuable.


Applying polynomial regression

Polynomial regression is simply programmatically fitting a line to the dots in the graph above. Unlike linear regression, it won’t just be a straight line.

The trained model’s predictions are displayed in the graphs to the left.

The top graph is using n=2.
For the bottom graph, n=5.

The more complex(n=5) model is now finding that items with rolls closer to perfection, or 30, are worth the most. I believe this to be correct. The model still is not perfect, as we only have a little bit of data. However, it is a lot more accurate than linear regression.


Just like in the previous post, if you want to use the trained model to predict items for given rolls, you can do this with model.predict as in the sample below.