Select the maximum variance as the split
494846
private void computeAxisVariance(List<P> points) {
		int numPoints = points.size();

		for( int i = 0; i < N; i++ ) {
			mean[i] = 0;
			var[i] = 0;
		}

		// compute the mean
		for( int i = 0; i < numPoints; i++ ) {
			P p = points.get(i);

			for( int j = 0; j < N; j++ ) {
				mean[j] += distance.valueAt(p,j);
			}
		}

		for( int i = 0; i < N; i++ ) {
			mean[i] /= numPoints;
		}

		// compute the variance * N
		for( int i = 0; i < numPoints; i++ ) {
			P p = points.get(i);

			for( int j = 0; j < N; j++ ) {
				double d = mean[j] - distance.valueAt(p,j);
				var[j] += d*d;
			}
		}
	}
350710
function select(ids, coords, k, left, right, axis) {

    while (right > left) {
        if (right - left > 600) {
            const n = right - left + 1;
            const m = k - left + 1;
            const z = Math.log(n);
            const s = 0.5 * Math.exp(2 * z / 3);
            const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
            const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
            const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
            select(ids, coords, k, newLeft, newRight, axis);
        }

        const t = coords[2 * k + axis];
        let i = left;
        let j = right;

        swapItem(ids, coords, left, k);
        if (coords[2 * right + axis] > t) swapItem(ids, coords, left, right);

        while (i < j) {
            swapItem(ids, coords, i, j);
            i++;
            j--;
            while (coords[2 * i + axis] < t) i++;
            while (coords[2 * j + axis] > t) j--;
        }

        if (coords[2 * left + axis] === t) swapItem(ids, coords, left, j);
        else {
            j++;
            swapItem(ids, coords, j, right);
        }

        if (j <= k) left = j + 1;
        if (k <= j) right = j - 1;
    }
}
236783
def cull(data,index,min=None,max=None):    
    """"""

    ret = data

    if min is not None:
        ret = ret[ret[:,index] > min,:]

    if max is not None:
        ret = ret[ret[:,index] < max,:]
    
    return ret
732077
def get_vector(self, max_choice=3):
        """"""
        vec = {}
        for dim in ['forbidden', 'required', 'permitted']:
            if self.meta[dim] is None:
                continue
            dim_vec = map(lambda x: (x, max_choice), self.meta[dim])
            vec[dim] = dict(dim_vec)
        return vec
276949
def best_split(self, ind, dep):
        
        if isinstance(dep, ContinuousColumn):
            return self.best_con_split(ind, dep)
        else:
            return self.best_cat_heuristic_split(ind, dep)
248139
def ExtValueMax(mu, sigma, tag=None):
    
    assert sigma > 0, 'ExtremeValueMax "sigma" must be greater than zero'
    p = U(0, 1)._mcpts[:]
    return UncertainFunction(mu - sigma * np.log(-np.log(p)), tag=tag)
784290
public static double split2realvectors( double[] U, double[] T, SplitVectors theSplit, int binNum, int num_max,
            IHMProgressMonitor pm ) {

        double binStep = 0, minValue = 0, maxValue;
        int i, count = 0, previousCount, minPosition = 0, maxPosition = 0, emptyBins;
        int[] bins;
        int head = 0;

        bins = new int[U.length];

        if (binNum <= 1) {
            previousCount = 1;
            count = 1;

            int index = 0;
            while( count < U.length ) {

                // was while( count <= U.length && U[count] == U[count - 1] ) {
                while( count < U.length && U[count] == U[count - 1] ) {
                    count++;
                }

                index++;
                bins[index] = count - previousCount;
                head++;
                previousCount = count;
                count++;
                if (head > num_max)
                    throw new ModelsIllegalargumentException("The number of bin exceeds the maximum number allowed.", "MODEL",
                            pm);
            }

        } else if (binNum > 1) {

            minPosition = 0;
            maxValue = U[U.length - 1];
            while( minPosition < U.length && isNovalue(U[minPosition]) ) {
                minPosition++;
            }
            if (minPosition == U.length) {
                // force the situation of non calculation
                binStep = 0;
            } else {
                minValue = U[minPosition];
                maxPosition = U.length - 1;

                binStep = (maxValue - minValue) / (binNum - 1);
            }

            if (binStep != 0) {
                int binIndex = 0;

                previousCount = minPosition; // the novalues are already left aside
                count = minPosition;
                emptyBins = 0;

                double runningCenter = minValue + binStep / 2.0;

                for( int n = 0; n < binNum - 1; n++ ) {
                    double upperLimitOfBin;
                    if (n == binNum - 2) {
                        upperLimitOfBin = maxValue;
                    } else {
                        upperLimitOfBin = runningCenter + binStep / 2.0;
                    }
                    if (U[count] <= upperLimitOfBin) {
                        double value = U[count];
                        while( value <= upperLimitOfBin ) {
                            count++;
                            if (count > maxPosition) {
                                break;
                            }
                            value = U[count];
                        }

                        bins[binIndex] = count - previousCount;
                        // contained in the bin
                        binIndex++;

                        head++;
                        previousCount = count;
                        // count++;

                    } else {
                        emptyBins++;
                    }
                    runningCenter += binStep;
                }

                if (emptyBins != 0) {
                    pm.message(emptyBins + " empty bins where found");
                }
            } else {
                for( double tmpValue : U ) {
                    if (!isNovalue(tmpValue)) {
                        count++;
                    }
                }
                bins[0] = count;
                head = count;
            }

        }

        if (head < 1) {
            throw new ModelsIllegalargumentException("Something wrong happened in binning", "MODEL", pm);
        } else {
            theSplit.initIndex(head);

            int maxnumberinbin = 0;
            for( i = 0; i < head; i++ ) {
                theSplit.splitIndex[i] = bins[i];
                if (bins[i] > maxnumberinbin)
                    maxnumberinbin = bins[i];
            }

            /*
             * now a list of the values inside the bins are put into the
             * matrixes, therefore we need as many rows as bins and a column
             * number high enough to hold the major number of values hold inside
             * a bin.
             */
            theSplit.initValues(head, maxnumberinbin);

            int index = minPosition;
            for( int j = 0; j < head; j++ ) {
                for( int k = 0; k < theSplit.splitIndex[j]; k++ ) {
                    theSplit.splitValues1[j][k] = U[index];
                    theSplit.splitValues2[j][k] = T[index];
                    index++;
                }
            }
        }

        if (binNum < 2)
            binStep = 0;

        return binStep;
    }
620765
def cont_cat_split(df, max_card=20, dep_var=None)->Tuple[List,List]:
    ""
    cont_names, cat_names = [], []
    for label in df:
        if label == dep_var: continue
        if df[label].dtype == int and df[label].unique().shape[0] > max_card or df[label].dtype == float: cont_names.append(label)
        else: cat_names.append(label)
    return cont_names, cat_names
701711
def select(self, versions):
        """"""
        options = list(self.filter(versions))
        if options:
            return max(options)
        return None
726624
def split_vars(_vars):
    """"""
    return (
        {
            k.upper().strip(): parse_conf_data(v.strip(), tomlfy=True)
            for k, _, v in [item.partition("=") for item in _vars]
        }
        if _vars
        else {}
    )
669909
function getMaximum() {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        return Math.max.apply(Math, args);
    }
444484
def Kdiag(self, X):
        """"""
        K_ff = np.zeros(X.shape[0])
        for i,x in enumerate(X):
            K_ff[i] = self.k_ff(x[0],x[0],self.lengthscale[0])
        return K_ff * self.variances[0]
836520
def split(self):
        """"""
        self.stop()
        interval = Interval()
        interval._start_instant = self.stop_instant
        return interval
1008457
def _get_split_rhat(values, round_to=2):
    """"""
    shape = values.shape
    if len(shape) != 2:
        raise TypeError("Effective sample size calculation requires 2 dimensional arrays.")
    _, num_samples = shape
    num_split = num_samples // 2
    # Calculate split chain mean
    split_chain_mean1 = np.mean(values[:, :num_split], axis=1)
    split_chain_mean2 = np.mean(values[:, num_split:], axis=1)
    split_chain_mean = np.concatenate((split_chain_mean1, split_chain_mean2))
    # Calculate split chain variance
    split_chain_var1 = np.var(values[:, :num_split], axis=1, ddof=1)
    split_chain_var2 = np.var(values[:, num_split:], axis=1, ddof=1)
    split_chain_var = np.concatenate((split_chain_var1, split_chain_var2))
    # Calculate between-chain variance
    between_chain_variance = num_samples / 2 * np.var(split_chain_mean, ddof=1)
    # Calculate within-chain variance
    within_chain_variance = np.mean(split_chain_var)
    # Estimate of marginal posterior variance
    split_rhat = np.sqrt(
        (between_chain_variance / within_chain_variance + num_samples / 2 - 1) / (num_samples / 2)
    )

    return round(split_rhat, round_to)
1213626
def get_best_splitting_attr(self):
        
        best = (-1e999999, None)
        for attr in self.attributes:
            best = max(best, (self.get_gain(attr), attr))
        best_gain, best_attr = best
        return best_attr
556655
def select(self, **kws):
        '''
            
        '''
        lst = [i for i in self.values() if i.select(**kws)]

        random.shuffle(lst)

        return lst
1046002
def _var_bounds(self):
        
        x0 = array([])
        xmin = array([])
        xmax = array([])

        for var in self.om.vars:
            x0 = r_[x0, var.v0]
            xmin = r_[xmin, var.vl]
            xmax = r_[xmax, var.vu]

        return x0, xmin, xmax