def _aggr_weighted_mean(inList, params):
 assert (len(inList) == len(params))
 weightsSum = sum(params)
 if (weightsSum == 0):
  return None
 weightedMean = 0
 for (i, elem) in enumerate(inList):
  weightedMean += (elem * params[i])
 return (weightedMean / weightsSum)

def _aggr_weighted_mean ( inList , params ) : assert ( len ( inList ) == len ( params ) ) weightsSum = sum ( params ) if ( weightsSum == 0 ) : return None weightedMean = 0 for ( i , elem ) in enumerate ( inList ) : weightedMean += ( elem * params [ i ] ) return ( weightedMean / weightsSum )
weighted mean uses params and makes weighed mean of inlist .