当前位置: 首页>>代码示例>>Java>>正文


Java IntArrayList.add方法代码示例

本文整理汇总了Java中org.apache.mahout.math.list.IntArrayList.add方法的典型用法代码示例。如果您正苦于以下问题:Java IntArrayList.add方法的具体用法?Java IntArrayList.add怎么用?Java IntArrayList.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.mahout.math.list.IntArrayList的用法示例。


在下文中一共展示了IntArrayList.add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: map

import org.apache.mahout.math.list.IntArrayList; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void map(LongWritable key, Text value, Mapper.Context context) throws IOException, InterruptedException {
    int sid = 0;
    for (String sentence : value.toString().split("\n")) {

        // do nothing, if maximum number of documents has been seen
        if (--maxdocs < 0) {
            return;
        }

        IntArrayList tids = new IntArrayList();
        for (String term : sentence.split("\\s+")) {
            tids.add(termTIdMap.get(term));
        }

        long did = key.hashCode() * 10000L + (long) sid++;

        outKey.set(did);
        outValue.setContents(tids.toArray(new int[0]));
        context.write(outKey, outValue);
    }
}
 
开发者ID:uma-pi1,项目名称:mgfsm,代码行数:24,代码来源:ConvertTextSentences.java

示例2: readFields

import org.apache.mahout.math.list.IntArrayList; //导入方法依赖的package包/类
@Override
public void readFields(DataInput in) throws IOException {
  int len = in.readInt();
  tuple = new IntArrayList(len);
  IntWritable value = new IntWritable();
  for (int i = 0; i < len; i++) {
    value.readFields(in);
    tuple.add(value.get());
  }
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:11,代码来源:IntTuple.java

示例3: map

import org.apache.mahout.math.list.IntArrayList; //导入方法依赖的package包/类
@Override
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {

	String[] items = value.toString().split(itemSeparator);

	IntArrayList itemIds = new IntArrayList();

	String sequenceId = items[0];

	long id = 0;

	try {
		id = Long.parseLong(sequenceId);
	} catch (NumberFormatException e) {
		// if this is not a number, hash it
		id = sequenceId.hashCode();
	}

	// ignore pos 0 which contains a sequence identifier
	for (int i = 1; i < items.length; i++) {
		// System.out.println(itemTIdMap.get(items[i]));
		itemIds.add(itemTIdMap.get(items[i]));
	}

	if (itemIds.size() > 0) {

		outKey.set(id);
		outValue.setContents(itemIds.toArray(new int[0]));
		// System.out.println(itemIds.toString());

		context.write(outKey, outValue);
	}

}
 
开发者ID:uma-pi1,项目名称:mgfsm,代码行数:35,代码来源:ConvertSequences.java

示例4: getGroupMembers

import org.apache.mahout.math.list.IntArrayList; //导入方法依赖的package包/类
public static IntArrayList getGroupMembers(int groupId, int maxPerGroup,
        int numFeatures) {
    IntArrayList ret = new IntArrayList();
    int start = groupId * maxPerGroup;
    int end = start + maxPerGroup;
    if (end > numFeatures) {
        end = numFeatures;
    }
    for (int i = start; i < end; i++) {
        ret.add(i);
    }
    return ret;
}
 
开发者ID:navxt6,项目名称:SEARUM,代码行数:14,代码来源:ARM.java

示例5: map

import org.apache.mahout.math.list.IntArrayList; //导入方法依赖的package包/类
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {

			String[] terms = value.toString().split(itemSeparator);

			IntArrayList tids = new IntArrayList();

			for (int i = 1; i < terms.length; ++i) {

				tids.add(termTIdMap.get(terms[i]));
			}

			if (tids.size() > 0) {

				outValue.setContents(tids.toArray(new int[0]));
				context.write(outKey, outValue);
			}
		}
 
开发者ID:uma-pi1,项目名称:lash,代码行数:18,代码来源:ConvertInputSequences.java


注:本文中的org.apache.mahout.math.list.IntArrayList.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。