Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Error measurement between given perfect 2D shape and freeform shape drawn by user

I am programming (with vectors) an application which requires a user to draw line according to certain data. Then the user will click a check button which will grade the users drawing to the actual data line. So I am wondering how would I go about grading the accuracy of the two lines?

So far what I have been able to do is interpolate the entire line of both the user line and the actual line. So that the user lines data can match with the actual line data.

What is my next step in finding the accuracy of the user line to the actual line?

I can't use area because the line the user draws is not linear, its freeform.

Heres an image of what i mean:

enter image description here

share|cite|improve this question

marked as duplicate by Listing, Mike Spivey, t.b., Asaf Karagila, Sasha Dec 7 '11 at 3:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

why can't you use area? The less the area, the better the users line as compared to yours? – picakhu Dec 5 '11 at 20:29
"I can't use area because the line the user draws is not linear, its freeform." but there is no case in my application where the line is just a line, it could be shaped along the x and y positive axis. – John Riselvato Dec 5 '11 at 20:31
I think I get what you mean. How about randomly choosing points on the users line and then finding the root mean square error from yours? – picakhu Dec 5 '11 at 20:32
I'll read that then, i uploaded a photo of what i mean if it helps – John Riselvato Dec 5 '11 at 20:33
From your image, I think Area will work. – picakhu Dec 5 '11 at 20:36
up vote 1 down vote accepted

Lets say user line is $g(x)$ and line drawn by you is $f(x)$

Then grade can be made be inversely proportional to

$$\displaystyle \sum_{x=a}^{b} (g(x)-f(x))^2$$

This is commonly used function.

share|cite|improve this answer
I will see how this works out for me. – John Riselvato Dec 5 '11 at 20:42
@John, this is RMS applied in a slightly different manner. – picakhu Dec 5 '11 at 20:44
I rather like the RMSE better nyways. @picakhu post it as your answer as an answer, so i can give you credit. – John Riselvato Dec 5 '11 at 20:46
@John, I would have to elaborate on how you should use it, and I am not sure which approach is best. I think it is better that I do not get credit for it, I do not deserve it. – picakhu Dec 5 '11 at 20:49
This just avoids taking the root and average. So it saves computation. We are using this in stanford ml-class online. :) @picakhu is right its just RMS squared times number of points! – Pratik Deoghare Dec 5 '11 at 20:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.