calculate the score of the split:
        score = current_error - after_split_error
968915
def _calculate_split_score(self, split):
        
        left_error = gini(split['left'])
        right_error = gini(split['right'])
        error = gini(self.Y)
        # if the split is any good, the score should be greater than 0
        total = float(len(self.Y))
        score = error - 1 / total * (len(split['left']) * left_error\
                                     + len(split['right']) * right_error)
        return score
1032654
def ratio(value, decimal_places=0, failure_string='N/A'):
    
    try:
        f = float(value)
    except ValueError:
        return failure_string
    return _saferound(f, decimal_places) + ':1'
1160813
def score_matches(matches, score_multiplier=(1, 1)):
    
    for match in matches:
        # generate a new score from the current match
        dividend, divisor = score_multiplier
        score = match.score * dividend / divisor

        yield (score, match.classified_failure_id)
454060
@Override protected double score1(Chunk[] chks, double weight, double offset, double[/*nclass*/] fs, int row) {
    return score1static(chks, idx_tree(0), offset, fs, row, new Distribution(_parms), _nclass);
  }
54670
def score(self):
        
        if not self.scoreProperties:
            self.scoreProperties = self.getScoreProperties()
        return sum(self.scoreProperties.values())
192768
def RMSError(self):
        
        tss = self.TSSError()
        return math.sqrt(tss / self.size)
26359
def calculate_new_length(gene_split, gene_results, hit):
   ''' 
   '''
   # Looping over splitted hits and calculate new length
   first = 1
   for split in gene_split[hit['sbjct_header']]:
      new_start = int(gene_results[split]['sbjct_start'])
      new_end = int(gene_results[split]['sbjct_end'])
      
      # Get the frist HSP
      if first == 1:
         new_length = int(gene_results[split]['HSP_length'])
         old_start = new_start
         old_end = new_end
         first = 0
         continue
      if new_start < old_start:
         new_length = new_length + (old_start - new_start)
         old_start = new_start
      
      if new_end > old_end:
         new_length = new_length + (new_end - old_end)
         old_end = new_end
   
   return(new_length)
880242
def _std_err(self):
        
        return np.sqrt(np.sum(np.square(self._resids), axis=1) / self._df_err)
1181625
def get_total_alignment_score(bam):
    ''''''
    sam_reader = pysam.Samfile(bam, "rb")
    total = 0
    for sam in sam_reader.fetch(until_eof=True):
        try:
            total += sam.opt('AS')
        except:
            pass
    return total
529026
def _score(cluster):
    
    x, y = zip(*cluster)[:2]
    return min(len(set(x)), len(set(y)))
1250236
def set_score(self, member, score, pipe=None):
        
        pipe = self.redis if pipe is None else pipe
        pipe.zadd(self.key, {self._pickle(member): float(score)})
1341201
def score_route(parts, path)
      score = 0
      pars  = {}

      if parts.length == path.length
        parts.each_with_index do |part, i|
          if part[0] == ':'
            score += 1
            pars["#{part[1..-1]}"] = path[i]
          elsif part == path[i].downcase
            score += 2
          end
        end
      end

      return score, pars
    end
285026
def zadd(self, key, score, member, *pairs, exist=None):
        
        if not isinstance(score, (int, float)):
            raise TypeError("score argument must be int or float")
        if len(pairs) % 2 != 0:
            raise TypeError("length of pairs must be even number")

        scores = (item for i, item in enumerate(pairs) if i % 2 == 0)
        if any(not isinstance(s, (int, float)) for s in scores):
            raise TypeError("all scores must be int or float")

        args = []
        if exist is self.ZSET_IF_EXIST:
            args.append(b'XX')
        elif exist is self.ZSET_IF_NOT_EXIST:
            args.append(b'NX')

        args.extend([score, member])
        if pairs:
            args.extend(pairs)
        return self.execute(b'ZADD', key, *args)
720484
void computePotentialSplitScore( List<Point2D_I32> contour , Element<Corner> e0 , boolean mustSplit )
	{
		Element<Corner> e1 = next(e0);

		e0.object.splitable = canBeSplit(contour,e0,mustSplit);

		if( e0.object.splitable ) {
			setSplitVariables(contour, e0, e1);
		}
	}
1189026
private void processScores(String line) {

		String[] values = line.trim().split(" +");

		// increment the current row we are talking about
		currentRowPos++;



		for ( int i =0 ; i < values.length ; i++){

			if ( values[i].endsWith(".")) {
				values[i] = values[i] + "0";
			}

			// special case: MEHP950101
			if (values[i].equals("-")) {
				values[i] = "0";
			}

			if ( scale == -1 ) {
				scale = determineScale(values[0]);
			}


			Float score = Float.parseFloat(values[i]);
			score = scale * score;

			Short s = (short) Math.round(score);

			matrix[currentRowPos][i] = s;

			if ( values.length < cols.size() || ( symmetricMatrix)){
				//System.out.println(values.length + " " + cols.size() + " " + currentRowPos + " " + i + " " +  line);

				matrix[i][currentRowPos] = s;

				symmetricMatrix = true;

			}

			if ( score > max)
				max = s;
			if ( score < min)
				min = s;


		}
	}
700757
def score_string( self, string ):
        
        rval = zeros( len( string ), float32 )
        rval[:] = nan
        _pwm.score_string( self.values, self.char_to_index, string, rval )
        return rval
1255803
def get_error(self, i=None, unit=None,
                  uncover=None, trail=None,
                  linebreak=None, sort_by_indep=None):
        
        return self.get_value(i=i, unit=unit,
                              uncover=uncover, trail=trail,
                              linebreak=linebreak, sort_by_indep=sort_by_indep,
                              attr='_error')