Calculates the achieved error rate of a history.
163776
private double getHistoryErrorRate(List<Integer> predHistory){
		double sumCorrect = 0;
		for (Integer e : predHistory) {
			sumCorrect += e;
		}
		return 1. - (sumCorrect / predHistory.size());
	}
1201872
def failure_count(self):
        
        return len([i for i, result in enumerate(self.data) if result.failure])
413367
def get_current_history_length(self):
        '''
        value = len(self.history)
        log(u"get_current_history_length:%d"%value)
        return value
1093063
def history_backward(self, count=1):
        
        self._set_history_search()

        # Go back in history.
        found_something = False

        for i in range(self.working_index - 1, -1, -1):
            if self._history_matches(i):
                self.working_index = i
                count -= 1
                found_something = True
            if count == 0:
                break

        # If we move to another entry, move cursor to the end of the line.
        if found_something:
            self.cursor_position = len(self.text)
272212
private void calculateError(){
        int totalErrorCount = 0;
        int totalRedundancy = 0;
        int trueCoverage = 0;
        int totalCoverage = 0;

        int numNoise = 0;
        double errorNoise = 0;
        double errorNoiseMax = 0;

        double errorMissed = 0;
        double errorMissedMax = 0;

        double errorMisplaced = 0;
        double errorMisplacedMax = 0;

        double totalError = 0.0;
        double totalErrorMax = 0.0;

        /** mainly iterate over all points and find the right error value for the point.
         *  within the same run calculate various other stuff like coverage etc...
         */
        for (int p = 0; p < numPoints; p++) {
            CMMPoint cmdp = gtAnalysis.getPoint(p);
            double weight = cmdp.weight();
            //noise counter
            if(cmdp.isNoise()){
                numNoise++;
                //this is always 1
                errorNoiseMax+=cmdp.connectivity*weight;
            }
            else{
                errorMissedMax+=cmdp.connectivity*weight;
                errorMisplacedMax+=cmdp.connectivity*weight;
            }
            //sum up maxError as the individual errors are the quality weighted between 0-1
            totalErrorMax+=cmdp.connectivity*weight;


            double err = 0;
            int coverage = 0;

            //check every FCluster
            for (int c = 0; c < numFClusters; c++) {
                //contained in cluster c?
                if(pointInclusionProbFC[p][c] >= pointInclusionProbThreshold){
                    coverage++;

                    if(!cmdp.isNoise()){
                        //PLACED CORRECTLY
                        if(matchMap[c] == cmdp.workclass()){
                        }
                        //MISPLACED
                        else{
                            double errvalue = misplacedError(cmdp, c);
                            if(errvalue > err)
                                err = errvalue;
                        }
                    }
                    else{
                        //NOISE
                        double errvalue = noiseError(cmdp, c);
                        if(errvalue > err) err = errvalue;
                    }
                }
            }
            //not in any cluster
            if(coverage == 0){
                //MISSED
                if(!cmdp.isNoise()){
                    err = missedError(cmdp,true);
                    errorMissed+= weight*err;
                }
                //NOISE
                else{
                }
            }
            else{
                if(!cmdp.isNoise()){
                    errorMisplaced+= err*weight;
                }
                else{
                    errorNoise+= err*weight;
                }
            }

            /* processing of other evaluation values */
            totalError+= err*weight;
            if(err!=0)totalErrorCount++;
            if(coverage>0) totalCoverage++;  //points covered by clustering (incl. noise)
            if(coverage>0 && !cmdp.isNoise()) trueCoverage++; //points covered by clustering, don't count noise
            if(coverage>1) totalRedundancy++; //include noise

            cmdp.p.setMeasureValue("CMM",err);
            cmdp.p.setMeasureValue("Redundancy", coverage);
        }

        addValue("CMM", (totalErrorMax!=0)?1-totalError/totalErrorMax:1);
        addValue("CMM Missed", (errorMissedMax!=0)?1-errorMissed/errorMissedMax:1);
        addValue("CMM Misplaced", (errorMisplacedMax!=0)?1-errorMisplaced/errorMisplacedMax:1);
        addValue("CMM Noise", (errorNoiseMax!=0)?1-errorNoise/errorNoiseMax:1);
        addValue("CMM Basic", 1-((double)totalErrorCount/(double)numPoints));

        if(debug){
            System.out.println("-------------");
        }
    }
491174
def history_mean(self, nb=5):
        
        _, v = zip(*self._history)
        return sum(v[-nb:]) / float(v[-1] - v[-nb])
1040002
def error(self, err=None):
        """"""
        if self.state == 'half-open':
            self.test_fail_count = min(self.test_fail_count + 1, 16)
        self.errors.append(self.clock())
        if len(self.errors) > self.maxfail:
            time = self.clock() - self.errors.pop(0)
            if time < self.time_unit:
                if time == 0:
                    time = 0.0001
                self.log.debug('error rate: %f errors per second' % (
                        float(self.maxfail) / time))
                self.open(err)
447280
function(historyinfo){
		this.allerase();
		
		this.initpos = this.position = historyinfo.current || 0;
		this.history = [];
		var datas = historyinfo.datas || [];
		for(var i=0,len=datas.length;i <len;i++){
			var opelist = new this.klass.OperationList();
			this.history.push(opelist);
			var array = datas[i];
			if(array.time!==void 0){
				opelist.time = array.time;
				array = array.ope;
			}
			for(var j=0,len2=array.length;j <len2;j++){
				var strs = array[j].split(/,/);
				var ope = null, List = this.operationlist;
				for(var k=0;k <List.length;k++){
					var ope1 = new List[k]();
					if(ope1.decode(strs)){ ope = ope1; break;}
				}
				if(!!ope){
					opelist.push(ope);
					this.lastope = ope;
				}
			}
		}
		
		this.checkexec();
		
		this.trialpos = historyinfo.trialpos || [];
		if(this.trialpos.length>0){
			this.resumeTrial();
			this.limitTrialUndo = true;
		}
	}
994695
def _compute_error(self):
        
        # err_i = sum_j R_{k,ij} A_{k,ji} - d_i
        self._err = np.sum(np.multiply(self._R_k, self._C_k.T), axis=0) - self._d
604555
def get_result(self, commit, default=MemoteResult()):
        """"""
        assert self._results is not None, \
            "Please call the method `load_history` first."
        return self._results.get(commit, default)
816297
def prev(self, error_out=False):
        """"""
        return self.query.paginate(self.page - 1, self.per_page, error_out)
1133112
def historical_rate_per_day(attribute, start_time = DEFAULT_DAYS_START.ago, end_time = DEFAULT_DAYS_END.ago)
      arr = archived_attribute(attribute, start_time, end_time).to_a
      # find first entry that has a number
      first_day, xval = arr.find{|v| v[1].is_a?(Numeric)} 
      # find last entry that has a number
      last_day, yval = arr.reverse.find{|v| v[1].is_a?(Numeric)} 

      first_day = Time.parse(first_day).beginning_of_day rescue nil
      last_day = Time.parse(last_day).beginning_of_day rescue nil

      return nil if first_day.nil? || last_day.nil?

      day_count = (last_day - first_day) / ( 60 * 60 * 24).to_f
      diff = yval - xval

      day_span = day_count

      if day_span > 0
        rate = diff.to_f / day_span
      else
        rate = 0
      end

      return rate
    end
986642
def get_history(self):
        """"""
        self.load_history()
        return map(lambda x: (x, self.history[x]), self.ordered_history)
890928
def history(directory, rev_range, verbose, indicate_current):
    """"""
    _history(directory, rev_range, verbose, indicate_current)
334945
private void handleGetMetricHistory(final int executorId, final HttpServletRequest req,
      final HashMap<String, Object> ret, final User user) throws IOException,
      ServletException {
    try {
      final Map<String, Object> result =
          this.execManagerAdapter.callExecutorStats(executorId,
              ConnectorParams.STATS_GET_METRICHISTORY, getAllParams(req));
      if (result.containsKey(ConnectorParams.RESPONSE_ERROR)) {
        ret.put(ConnectorParams.RESPONSE_ERROR,
            result.get(ConnectorParams.RESPONSE_ERROR).toString());
      } else {
        ret.put("data", result.get("data"));
      }
    } catch (final ExecutorManagerException ex) {
      logger.error(ex.getMessage(), ex);
      ret.put("error", "Failed to fetch metric history");
    }
  }
609365
function calculateStatsPerRun(results) {
    return results.reduce((stat, result) => {
        stat.errorCount += result.errorCount;
        stat.warningCount += result.warningCount;
        stat.fixableErrorCount += result.fixableErrorCount;
        stat.fixableWarningCount += result.fixableWarningCount;
        return stat;
    }, {
        errorCount: 0,
        warningCount: 0,
        fixableErrorCount: 0,
        fixableWarningCount: 0
    });
}
116907
def get(self, nb=0):
        """"""
        return {i: self.stats_history[i].history_raw(nb=nb) for i in self.stats_history}