Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
128 views
in Technique[技术] by (71.8m points)

java - Algorithm to show how far away a value is from another

Disclaimer: This is a very very difficult question about mathematics and algorithms (in my opinion) - so respect to anyone who makes this. I admire you.

I would like to evaluate the performance of my employees. I would like to do this by measuring the following parameters as percentages of the amount of time they spend working:

1. % of Time spent working
2. % of Time spent in meetings
3. % of Time spent travelling

I have a "preferred" set of percentages for each of these. This represents the ideal time that I would LIKE my employees to spend their time.

% Time spent in Meetings -> 30%
% Time spent Travelling -> 10%
% Time Spent Working -> 60%

total time spent on activities: 100%

So in words, I would like my employees to spend 30% of their time in meetings, 10% time travelling and 60% on a desk working.

I would ALSO like to add weights to these different percentages. The weight would represent how "lenient" I am with each percentage being different to what I desire. In other words, how important I find it for each variable to be closest to the desired percentages (30, 10, 60). I would like to apply the weights on a scale of.1 to 10, 10 being most important, 1 being least important.

Meetings -> 3
Travelling -> 9
Working -> 5

So given the percentage of time spent by an employee, and the weight of the importance of the time spent being close to the desired time spent, I would like to generate an index between 0 and 100 where 100 is the perfect time percentages and 0 is the worst. So a score of 100 would give the "preferred" percentages:

% Time spent in Meetings -> 30%
% Time spent Travelling -> 10%
% Time Spent Working -> 60%

How I would try to approach this:

  1. Find out what the minimum and maximum ratios are
  2. Calculate a value to tell how far away each value is from the desired value using the minimum and maximum ratios. Make sure this value is in the ratio 0-1 (corresponding to 0-100)
  3. Calculate a weighted average.
question from:https://stackoverflow.com/questions/65877840/algorithm-to-show-how-far-away-a-value-is-from-another

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I think you're trying something which is kinda like the H-score. H-score is a scored we use in digital pathology to measure tumor positivity for a maker and it is meant to weight the number of positive cells by their intensity. It's:

1* (% of positive cells with score 1) + 2*(% of positive cells with score 2) + 3*(% of positive cells with score 3)

You could calculate the same as:

3*(1-% of difference between actual worked hourse and planned ones)
9*(1-% of difference between actual worked hourse and planned ones)
5*(1-% of difference between actual worked hourse and planned ones)

Don't forget to use absolute value when you compute the difference. I used 1-% so that a difference of 0.8 (as planned 0.ì and worked 0.9) will result in a score of 0.2. This will work for the opposite situation too (planned 0.9 and worked 0.1). In this way, who perfectly matches the planned hourse will have a score of 1700%. Then just:

Score/Total weights = score between 0-100%.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...