Search code examples
algorithmpredictionweighted-average

Algorithm for finding the optimal weights for prediction


Consider I have the following weights and quantitative parameters: w_1..w_n, p_1..p_n. 0 <= w <= 1. I also have a selection of cases of parameters and associated values.

What algorithms exist for finding the optimal weights to minimize the errors of predicting the value given the parameters? And what algorithms have typically achieved the best results?

I try to predict the quality of an apple based on the parameters p_1=transport _time, p_2=days_since_picking. The quality is measured using a subjective likert scale.

Fifty people have rated apples with scores from 1 to 5 and I know p_1 and p_2 for all those apples. How do I predict and find the weights for p_1 and p_2 that minimize the total errors in the cases?


Solution

  • I agree with the comment that you should run a web search on "linear regression". At least three other sources for lists of algorithms come to mind:

    1. NLopt: http://ab-initio.mit.edu/wiki/index.php/NLopt_Algorithms (and my C# wrapper for it: https://github.com/BrannonKing/NLoptNet)

    2. S. Boyd's book: http://stanford.edu/~boyd/cvxbook/

    3. You could probably use a supervised AI algorithm. Neural networks are typically made up of "weights": https://en.wikipedia.org/wiki/Supervised_learning

    You could also use a genetic algorithm in conjunction with gray code weight encoding.