本文整理汇总了Java中org.apache.mahout.math.list.IntArrayList类的典型用法代码示例。如果您正苦于以下问题:Java IntArrayList类的具体用法?Java IntArrayList怎么用?Java IntArrayList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntArrayList类属于org.apache.mahout.math.list包,在下文中一共展示了IntArrayList类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 {
super.readFields(in);
this.mass = in.readInt();
int numpoints = in.readInt();
this.boundPoints = new IntArrayList();
for (int i = 0; i < numpoints; i++) {
this.boundPoints.add(in.readInt());
}
this.mass = boundPoints.size();
}
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:12,代码来源:MeanShiftCanopy.java
示例3: 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
示例4: 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
示例5: 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
示例6: reduce
import org.apache.mahout.math.list.IntArrayList; //导入依赖的package包/类
@Override
protected void reduce(IntWritable key, Iterable<TransactionTree> values,
Context context) throws IOException {
TransactionTree cTree = new TransactionTree();
for (TransactionTree tr : values) {
for (Pair<IntArrayList, Long> p : tr) {
cTree.addPattern(p.getFirst(), p.getSecond());
}
}
List<Pair<Integer, Long>> localFList = Lists.newArrayList();
for (Entry<Integer, org.apache.commons.lang3.mutable.MutableLong> fItem : cTree
.generateFList().entrySet()) {
localFList.add(new Pair<Integer, Long>(fItem.getKey(), fItem
.getValue().toLong()));
}
Collections.sort(localFList,
new CountDescendingPairComparator<Integer, Long>());
FPGrowth<Integer> fpGrowth = new FPGrowth<Integer>();
fpGrowth.generateTopKFrequentPatterns(
new IteratorAdapter(cTree.iterator()),
localFList,
minSupport,
maxHeapSize,
new HashSet<Integer>(ARM.getGroupMembers(key.get(),
maxPerGroup, numFeatures).toList()),
new IntegerStringOutputConverter(
new ContextWriteOutputCollector<IntWritable, TransactionTree, Text, TopKStringPatterns>(
context), featureReverseMap),
new ContextStatusUpdater<IntWritable, TransactionTree, Text, TopKStringPatterns>(
context));
}
开发者ID:navxt6,项目名称:SEARUM,代码行数:35,代码来源:ParallelFPGrowthReducer.java
示例7: reduce
import org.apache.mahout.math.list.IntArrayList; //导入依赖的package包/类
@Override
protected void reduce(IntWritable key, Iterable<TransactionTree> values,
Context context) throws IOException, InterruptedException {
TransactionTree cTree = new TransactionTree();
for (TransactionTree tr : values) {
for (Pair<IntArrayList, Long> p : tr) {
cTree.addPattern(p.getFirst(), p.getSecond());
}
}
context.write(key, cTree.getCompressedTree());
}
开发者ID:navxt6,项目名称:SEARUM,代码行数:12,代码来源:ParallelFPGrowthCombiner.java
示例8: getBoundPoints
import org.apache.mahout.math.list.IntArrayList; //导入依赖的package包/类
public IntArrayList getBoundPoints() {
return boundPoints;
}
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:4,代码来源:MeanShiftCanopy.java
示例9: setBoundPoints
import org.apache.mahout.math.list.IntArrayList; //导入依赖的package包/类
public void setBoundPoints(IntArrayList boundPoints) {
this.boundPoints = boundPoints;
}
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:4,代码来源:MeanShiftCanopy.java
示例10: load
import org.apache.mahout.math.list.IntArrayList; //导入依赖的package包/类
public void load(Configuration conf, String fileName, int minSupport) throws IOException {
BufferedReader br = null;
if (conf == null) {
@SuppressWarnings("resource")
FileInputStream fstream = new FileInputStream(fileName);
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
br = new BufferedReader(new InputStreamReader(in));
} else {
FileSystem fs = FileSystem.get(conf);
FSDataInputStream dis = fs.open(new Path(fileName));
br = new BufferedReader(new InputStreamReader(dis));
}
OpenIntIntHashMap parentMap = new OpenIntIntHashMap();
String line = null;
while ((line = br.readLine()) != null) {
String[] splits = line.split("\t");
int itemId = Integer.parseInt(splits[3]);
int itemSupport = Integer.parseInt(splits[2]);
int parentId = Integer.parseInt(splits[4]);
parentMap.put(itemId, parentId);
if (itemSupport >= minSupport) {
items.add(PrimitiveUtils.combine(itemId, itemSupport));
}
itemIdToItemMap.put(itemId, splits[0]);
}
Collections.sort(items, new MyComparator());
parentIds = new int[parentMap.size() + 1];
IntArrayList keyList = parentMap.keys();
for(int i = 0; i < keyList.size(); ++i) {
int item = keyList.get(i);
parentIds[item] = parentMap.get(item);
}
}
开发者ID:uma-pi1,项目名称:lash,代码行数:44,代码来源:Dictionary.java
示例11: 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
示例12: IteratorAdapter
import org.apache.mahout.math.list.IntArrayList; //导入依赖的package包/类
private IteratorAdapter(
Iterator<Pair<IntArrayList, Long>> transactionIter) {
innerIter = transactionIter;
}
开发者ID:navxt6,项目名称:SEARUM,代码行数:5,代码来源:ParallelFPGrowthReducer.java
示例13: next
import org.apache.mahout.math.list.IntArrayList; //导入依赖的package包/类
public Pair<List<Integer>, Long> next() {
Pair<IntArrayList, Long> innerNext = innerIter.next();
return new Pair<List<Integer>, Long>(innerNext.getFirst().toList(),
innerNext.getSecond());
}
开发者ID:navxt6,项目名称:SEARUM,代码行数:6,代码来源:ParallelFPGrowthReducer.java
示例14: getEntries
import org.apache.mahout.math.list.IntArrayList; //导入依赖的package包/类
/**
* Fetch the list of entries from the tuple
*
* @return a List containing the strings in the order of insertion
*/
public IntArrayList getEntries() {
return new IntArrayList(this.tuple.elements());
}
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:9,代码来源:IntTuple.java
注:本文中的org.apache.mahout.math.list.IntArrayList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论