Here is the python:
def apply_weights(one,weights): weights = weights.split(",") result = superposition() for k,x in enumerate(one): if k >= len(weights): break result += x.multiply(float(weights[k])) return resultAnd here is a brief example:
sa: apply-weights[3.1415,0,6,7.3,13] split |a b c d e f g h i j> 3.142|a> + 0|b> + 6|c> + 7.3|d> + 13|e>That should be clear enough.
BTW, as for the wage prediction results, well, I tried some examples and I failed to improve on just picking the result with the highest match (ie, select[1,1]), at 77.1% success rate. Maybe if you choose the weights just right you will get a better result? I don't yet know how to do that though.
That's it for this post.
Update: apply-weights can be considered to be multiplication by a diagonal matrix, with the weights the values on the diagonal.