Returns the class with maximum vote.
979299
private int getClassFromVotes(double votes[]){
		double maxVote = -1;
		int maxVoteClass = -1;
		for (int i = 0; i < votes.length; i++){
			if (votes[i] > maxVote){
				maxVote = votes[i];
                maxVoteClass = i;
			}
		}
		return maxVoteClass;
	}
1229535
public int getMaximalFrequency()
    {
        int maxfreq = 0;
        for (Map.Entry<T, Integer> entry : styles.entrySet())
        {
            if (entry.getValue() > maxfreq)
                maxfreq = entry.getValue();
        }
        return maxfreq;
    }
1158523
public static Class<?> mostSpecificClass(Class<?> classOne,
                                             Class<?> classTwo)
    {
        if (classOne.isAssignableFrom(classTwo)) {
            return classTwo; // d479669
        }
        else if (classTwo.isAssignableFrom(classOne)) {
            return classOne; // d479669
        }

        return null;
    }
49166
protected ArrayList<Integer> getMAXIndexes(){
    	
    	ArrayList<Integer> maxWIndex=new ArrayList<Integer>();
    	Pair[] newEnsembleWeights = new Pair[getNbActiveClassifiers()];  	
    	System.arraycopy(ensembleWeights, 0, newEnsembleWeights, 0, newEnsembleWeights.length);
    	
    	Arrays.sort(newEnsembleWeights);
    	
    	double maxWVal = newEnsembleWeights[newEnsembleWeights.length-1].val;
    		
    	for (int i = newEnsembleWeights.length-1 ; i>=0 ; i--){
    		if (newEnsembleWeights[i].val!=maxWVal)
    			break;
    		else
    			maxWIndex.add(newEnsembleWeights[i].index);
    		
    	}
    	return maxWIndex;
    }
1186429
def make_weights_for_balanced_classes(self):
    """"""

    nclasses = len(self.classes)
    count = np.ones(nclasses)
    for item in self.data:
      count[item[1]] += 1

    N = float(sum(count))
    weight_per_class = N / count
    weight = np.zeros(len(self.data))
    for idx, item in enumerate(self.data):
      weight[idx] = weight_per_class[item[1]]
    return weight
420864
def max(self):
        """"""
        if "max" not in self.attrs.keys():

            def f(dataset, s):
                return np.nanmax(dataset[s])

            self.attrs["max"] = np.nanmax(list(self.chunkwise(f).values()))
        return self.attrs["max"]
483401
def getMaximinScores(profile):
    

    # Currently, we expect the profile to contain complete ordering over candidates. Ties are
    # allowed however.
    elecType = profile.getElecType()
    if elecType != "soc" and elecType != "toc":
        print("ERROR: unsupported election type")
        exit()

    wmgMap = profile.getWmg()
    # Initialize each Copeland score as infinity.
    maximinscores = {}
    for cand in wmgMap.keys():
        maximinscores[cand] = float("inf")

    # For each pair of candidates, calculate the number of votes in which one beat the other.

    # For each pair of candidates, calculate the number of times each beats the other.
    for cand1, cand2 in itertools.combinations(wmgMap.keys(), 2):
        if cand2 in wmgMap[cand1].keys():
            maximinscores[cand1] = min(maximinscores[cand1], wmgMap[cand1][cand2])
            maximinscores[cand2] = min(maximinscores[cand2], wmgMap[cand2][cand1])

    return maximinscores
1253914
private double getPrior(int classIndex) {
		// Maximum likelihood
		Double currentCount = this.classInstances.get(classIndex);
		if (currentCount == null || currentCount == 0)
			return 0;
		else
			return currentCount * 1. / this.instancesSeen;
	}
737017
def max(self):
        
        if(self._clean.isDict()):
            return self._wrap(list())
        return self._wrap(max(self.obj))
264088
public function getMaxSortIndex()
    {
        return (new Query())->from($this->refTableName)->where([$this->refFieldName => $this->itemId])->max($this->sortIndexFieldName);
    }
575594
def max(self):
        
        if len(self._data) == 0:
            return 600
        return next(iter(reversed(sorted(self._data.keys()))))
349318
def best_prediction(self):
        """"""
        if self._best_prediction is None and self._action_sets:
            self._best_prediction = max(
                action_set.prediction
                for action_set in self._action_sets.values()
            )
        return self._best_prediction
333784
def find_tie_breaker(self, candidate_ids):
        
        for candidate_aggregates in reversed(self.round_candidate_aggregates):
            candidates_on_vote = defaultdict(int)
            for candidate_id in candidate_ids:
                votes = candidate_aggregates.get_vote_count(candidate_id)
                candidates_on_vote[votes] += 1
            if max(candidates_on_vote.values()) == 1:
                return candidate_aggregates
191332
public function maxRole()
    {
        $roles = $this->roles;
        $r = $roles->first();

        foreach ($roles as $role){
            if($role->order > $r->order)
                $r = $role;
        }

        return $r;
    }
553443
def all(cls, sort=None, limit=None):
        
        return cls.where(sort=sort, limit=limit)
1328858
def nextClass(self, classuri):
        """"""
        if classuri == self.classes[-1].uri:
            return self.classes[0]
        flag = False
        for x in self.classes:
            if flag == True:
                return x
            if x.uri == classuri:
                flag = True
        return None
417548
public Vote getVotes(Instance instance) {
		ErrorWeightedVote errorWeightedVote=newErrorWeightedVote();
		//DoubleVector combinedVote = new DoubleVector();
		debug("Test",3);    
		int numberOfRulesCovering = 0;

		VerboseToConsole(instance); // Verbose to console Dataset name.
		for (Rule rule : ruleSet) {
			if (rule.isCovering(instance) == true){
				numberOfRulesCovering++;
				//DoubleVector vote = new DoubleVector(rule.getPrediction(instance));
				double [] vote=rule.getPrediction(instance);
				double error= rule.getCurrentError();
				debug("Rule No"+ rule.getRuleNumberID() + " Vote: " + Arrays.toString(vote) + " Error: " + error + " Y: " + instance.classValue(),3); //predictionValueForThisRule);
				errorWeightedVote.addVote(vote,error);
				//combinedVote.addValues(vote);
				if (!this.unorderedRulesOption.isSet()) { // Ordered Rules Option.
					break; // Only one rule cover the instance.
				}
			}
		}

		if (numberOfRulesCovering == 0) {
			//combinedVote = new DoubleVector(defaultRule.getPrediction(instance));
			double [] vote=defaultRule.getPrediction(instance);
			double error= defaultRule.getCurrentError();
			errorWeightedVote.addVote(vote,error);
			
			debug("Default Rule Vote " + Arrays.toString(vote) + " Error " + error + "  Y: " + instance.classValue(),3);
		} 	
		double[] weightedVote=errorWeightedVote.computeWeightedVote();
		double weightedError=errorWeightedVote.getWeightedError();
		
		debug("Weighted Rule - Vote: " + Arrays.toString(weightedVote) + " Weighted Error: " + weightedError + " Y:" + instance.classValue(),3);
		return new Vote(weightedVote, weightedError);
	}