Reputation: 1764
I'm developing a todo app , when the user creates a new project they input title and a ruff estimated time to measure how good they plan projects .on project finish user is redirected to projects stats route in which I'm calculating the accuracy of thier estimation :
const diff_minutes=(dt2, dt1)=>
{
var diff =(dt2.getTime() - dt1.getTime()) / 1000;
diff /= 60;
return Math.abs(Math.round(diff));
}
const started_at=project.started_at
const finished_at=project.finished_at
const estmated_time =project.estmated_time // minutes
const project_duration_in_minutes =diff_minutes( started_at,finished_at);
const accuracy = -(project_duration_in_minutes - estmated_time )/100
so the idea is the lower project_duration_in_minutes
is from the estmatedtime the better the accuracy is and vice versa . for example :
const estmated_time = 10
const project_duration_in_minutes = 15
const accuracy = -(project_duration_in_minutes - est )/100 //accuracy = -50%
const estmated_time = 10
const project_duration_in_minutes = 5
const accuracy = -(project_duration_in_minutes - est )/100 //accuracy = 50%
this kind of does it but I would love to see a better approach .
Upvotes: 2
Views: 265
Reputation: 4596
actual_time / estimated_time
gives you the difference in time as a ratio. So estimated 10 minutes, took 5 minutes = 0.5x the estimated time. Multiply by 100 for a percent.
You seem to be looking for high numbers when the time was less than expected. estimated_time / actual_time
gives you the difference in speed as a ratio. So estimated 10 minutes, took 5 minutes = 2x the estimated speed.
Upvotes: 2
Reputation: 8186
There's a few alternatives here:
abs
method to your function, since accuracy doesn't need a positive/negative indicator in your case.Accuracy = 100* e^-(abs(est-project_duration_in_minutes)/project_duration_in_minutes)
Upvotes: 1