TODO: Should not need to scrape trace in order to know a feature is usable --> use min.cardinality
505262
public static void waitForMongoSSL(LibertyServer server) throws Exception {
        // Just because SSL feature is reported as starting doesn't mean it is really ready,
        // nor that Mongo is functional, so wait for SSL to report the keystore has been
        // added, then wait for MongoDBService to activate.
        server.resetLogMarks(); // look from start of logs
        assertNotNull("Did not find trace message indicating SSL trustStore had been added",
                      server.waitForStringInTraceUsingMark("Adding keystore: (myDefaultTrustStore|differentTrustStore)"));
        assertNotNull("Did not find message indicating MongoDBService had activated", server.waitForStringInTraceUsingMark("MongoDBService * < activate"));
    }
1188912
def get_min(self, field=None):
        

        if not field:
            raise AttributeError("Please provide field to apply aggregation to!")
        agg = A("min", field=field)
        self.aggregations['min_' + field] = agg
        return self
538095
def has_duplicate_min(x):
    
    if not isinstance(x, (np.ndarray, pd.Series)):
        x = np.asarray(x)
    return np.sum(x == np.min(x)) >= 2
364920
def min(self, **kwargs):
        
        if self._is_transposed:
            kwargs["axis"] = kwargs.get("axis", 0) ^ 1
            return self.transpose().min(**kwargs)
        mapreduce_func = self._build_mapreduce_func(pandas.DataFrame.min, **kwargs)
        return self._full_reduce(kwargs.get("axis", 0), mapreduce_func)
809736
def check_param_ranges(num_bins, num_groups, num_values, trim_outliers, trim_percentile):
    """"""

    if num_bins < minimum_num_bins:
        raise ValueError('Too few bins! The number of bins must be >= 5')

    if num_values < num_groups:
        raise ValueError('Insufficient number of values in features (< number of nodes), or invalid membership!')

    if trim_outliers:
        if trim_percentile < 0 or trim_percentile >= 100:
            raise ValueError('percentile of tail values to trim must be in the semi-open interval [0,1).')
    elif num_values < 2:
        raise ValueError('too few features to compute minimum and maximum')

    return
882449
def min(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
        
        axis = self._get_axis_number(axis) if axis is not None else 0
        data = self._validate_dtypes_min_max(axis, numeric_only)
        return data._reduce_dimension(
            data._query_compiler.min(
                axis=axis,
                skipna=skipna,
                level=level,
                numeric_only=numeric_only,
                **kwargs
            )
        )
1264244
public boolean hasCardEncoding() {
    if (this.cardinalityEncoding == CardinalityEncoding.TOTALIZER)
      return this.totalizer.hasCreatedEncoding();
    else if (this.cardinalityEncoding == CardinalityEncoding.MTOTALIZER)
      return this.mtotalizer.hasCreatedEncoding();
    return false;
  }
206403
static double computeScore( LinkedList<Corner> list , double cornerPenalty , boolean loops ) {
		double sumSides = 0;
		Element<Corner> e = list.getHead();
		Element<Corner> end = loops ? null : list.getTail();
		while( e != end ) {
			sumSides += e.object.sideError;
			e = e.next;
		}

		int numSides = loops ? list.size() : list.size() - 1;

		return sumSides/numSides + cornerPenalty*numSides;
	}
49380
def num_feature(self):
        
        if self.handle is not None:
            ret = ctypes.c_int()
            _safe_call(_LIB.LGBM_DatasetGetNumFeature(self.handle,
                                                      ctypes.byref(ret)))
            return ret.value
        else:
            raise LightGBMError("Cannot get num_feature before construct dataset")
883806
private void checkAndLimitFeatureUsedPerSplit(Frame fr) {
      int validCols = fr.numCols()-1; // for classIdx column
      if (validCols < _rfParams.num_split_features) {
        Log.info(Log.Tag.Sys.RANDF, "Limiting features from " + _rfParams.num_split_features +
                " to " + validCols + " because there are no more valid columns in the dataset");
        _rfParams.num_split_features= validCols;
      }
    }
192159
private String getSourceMultiplicity(final Cardinality cardinality) {

		switch (cardinality) {

			case OneToOne:
			case OneToMany:
				return "1";

			case ManyToOne:
			case ManyToMany:
				return "*";
		}

		return null;
	}
1323300
private int checkAndGetTotalCount() throws IllegalStateException {
		int usedBuckets = 0;
		int totalCount = buckets[0].getCount();
		for (int i = 1; i <= bucketNb; i++) {
			int bucketCount = buckets[i].getCount();
			totalCount += bucketCount;
			if (bucketCount > 0) {
				usedBuckets++;
			}
		}
		totalCount += buckets[bucketNb + 1].getCount();
		if (usedBuckets < 3) {
			throw new IllegalStateException("Only " + usedBuckets + " buckets used, not enough for interpolation, consider reconfiguring min/max/nb");
		}
		return totalCount;
	}
1092680
def check_nocycles(Adj, verbosity=2):
    
    dim = Adj.shape[0]
    for g in range(dim):
        v = np.zeros(dim)
        v[g] = 1
        for i in range(dim):
            v = Adj.dot(v)
            if v[g] > 1e-10:
                if verbosity > 2:
                    settings.m(0,Adj)
                    settings.m(0,'contains a cycle of length',i+1,
                          'starting from node',g,
                          '-> reject')
                return False
    return True
277408
public static <A, B> CountAccumulator<B> getFeatureCounts(FeatureGenerator<A, B> featureGenerator,
      Collection<? extends A> data) {
    MapReduceExecutor executor = MapReduceConfiguration.getMapReduceExecutor();
    Mapper<A, Map<B, Double>> mapper = new FeatureCountMapper<A, B>(featureGenerator);
    Reducer<Map<B, Double>, CountAccumulator<B>> reducer = new FeatureCountReducer<B>();
    return executor.mapReduce(data, mapper, reducer);
  }
10158
def get_features(
    dataset,
    query=None,
    crs="epsg:4326",
    bounds=None,
    sortby=None,
    pagesize=10000,
    max_workers=5,
):
    
    param_dicts = define_request(dataset, query, crs, bounds, sortby, pagesize)

    with ThreadPoolExecutor(max_workers=max_workers) as executor:
        for result in executor.map(make_request, param_dicts):
            for feature in result:
                yield feature
1167101
private ValuesSourceAggregationBuilder makeCountAgg(MethodField field) {

        // Cardinality is approximate DISTINCT.
        if ("DISTINCT".equals(field.getOption())) {

            if (field.getParams().size() == 1) {
                return AggregationBuilders.cardinality(field.getAlias()).field(field.getParams().get(0).value.toString());
            } else {
                Integer precision_threshold = (Integer) (field.getParams().get(1).value);
                return AggregationBuilders.cardinality(field.getAlias()).precisionThreshold(precision_threshold).field(field.getParams().get(0).value.toString());
            }

        }

        String fieldName = field.getParams().get(0).value.toString();

        /*
        zhongshu-comment count(1) count(0)这种应该是查不到东西的，除非你的字段名就叫做1、0这样
            es的count是针对某个字段做count的，见下面的dsl，对os这个字段做count
                "aggregations": {
                    "COUNT(os)": {
                      "value_count": {
                        "field": "os"
                      }
                    }
                 }

            假如你是写count(*)，那es-sql就帮你转成对"_index"字段做count，每一条数据都会有"_index"字段，该字段存储的是索引的名字
         */
        // In case of count(*) we use '_index' as field parameter to count all documents
        if ("*".equals(fieldName)) {
            KVValue kvValue = new KVValue(null, "_index");
            field.getParams().set(0, kvValue);
            /*
            zhongshu-comment 这个看起来有点多此一举：先将"_index"字符串封装到KVValue中，然后再kv.toString()得到"_index"字符串，还不如直接将"_index"传进去AggregationBuilders.count(field.getAlias()).field("_index");
            其实目的是为了改变形参MethodField field的params参数中的值，由"*"改为"_index"
             */
            return AggregationBuilders.count(field.getAlias()).field(kvValue.toString());
        } else {
            return AggregationBuilders.count(field.getAlias()).field(fieldName);
        }
    }
530980
def scrape_from_list(list, blk)
      puts "Scraping #{list.size} instances" if @verbose
      list.each_with_index.map do |instance_url, instance_index|
        instance_resps = get_instance instance_url, nil, :instance_index => instance_index
        instance_resps.each_with_index.map do |instance_resp, pagination_index|
          blk.call(instance_resp, instance_url, instance_index, pagination_index)
        end
      end.flatten(1)
    end