# Weighted average to select a service provider based on past experience

Suppose that you tested multiple services and learned how they scored along the criteria "quality of work", "speed", "cost" and "responsiveness". But you value these attributes differently, for instance, considering "quality of work" more important than "speed" and "cost" more important than "responsiveness". Based on your limited experience, you'd like to select one of these service providers for future collaboration.

One way to do this is to assign weights to all categories, for instance [0.6, 0.2, 0.8, 0.45]. A higher weight would indicate a more important category, while a lower weight a less important category. You could then compute the weighted average of all scores of all services, find the maximal score and return which attributes correspond to it.

```import numpy as np # Quality of work, speed, cost, responsiveness. All in range (0-100) weights = [0.6, 0.2, 0.8, 0.45] satisfaction_scores = np.array([ [65, 45, 65, 80], [49, 75, 60, 75], [70, 75, 80, 60], [90, 65, 40, 55], [67, 71, 58, 89], [69, 83, 47, 42], [66, 48, 83, 52] ]) wavg = np.average(satisfaction_scores, axis=1, weights=weights) print(satisfaction_scores[np.argmax(wavg)]) # [70 75 80 60]```

According to yout preferences, the third company on the list seems to be the most interesting.