The sum_coef_j should be a 1 D array for the means to be 1 D array
Re analyzing the function add_coeff_j to see how it sums array_list
Or do we need a np.sum in place of sum