本文整理汇总了Java中it.unimi.dsi.fastutil.ints.IntRBTreeSet类的典型用法代码示例。如果您正苦于以下问题:Java IntRBTreeSet类的具体用法?Java IntRBTreeSet怎么用?Java IntRBTreeSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntRBTreeSet类属于it.unimi.dsi.fastutil.ints包,在下文中一共展示了IntRBTreeSet类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: greedySolve
import it.unimi.dsi.fastutil.ints.IntRBTreeSet; //导入依赖的package包/类
public double greedySolve(Mat mat) {
double sum = 0.0;
IntSet available = new IntRBTreeSet();
for(int i = 0; i < mat.M(); i++) {
available.add(i);
}
for(int i = 0; i < mat.N(); i++) {
double best = Double.NEGATIVE_INFINITY;
for(ME me : mat.row(i)) {
if(available.contains(me.j) && me.v > best) {
best = me.v;
available.remove(me.j);
}
}
sum += Math.max(best, 0.0);
}
return sum;
}
开发者ID:jmccrae,项目名称:naisc,代码行数:19,代码来源:MunkResTest.java
示例2: DepTree
import it.unimi.dsi.fastutil.ints.IntRBTreeSet; //导入依赖的package包/类
public DepTree(TypedDependency root, Collection<TypedDependency> tds,
List<? extends HasWord> sentence, int[] remapping, IntSet stack) {
this.map = new HashMap<>();
int t = root.dep().index();
node = sentence.get(t - 1).word();
//tag = root.dep().tag();
tag = root.dep().label().tag();
this.idx = remapping[t - 1];
if (!stack.contains(t)) {
IntSet stack2 = new IntRBTreeSet(stack);
stack2.add(t);
for (TypedDependency td : tds) {
if (td.gov().index() == t && td.dep().index() != t) {
map.put(td.reln().getShortName(), new DepTree(td, tds, sentence, remapping, stack2));
}
}
}
}
开发者ID:jmccrae,项目名称:naisc,代码行数:19,代码来源:SultanModified.java
示例3: AssociationRuleMining
import it.unimi.dsi.fastutil.ints.IntRBTreeSet; //导入依赖的package包/类
public AssociationRuleMining(IntColumn sets, CategoryColumn items, double support) {
Table temp = Table.create("temp");
temp.addColumn(sets.copy());
temp.addColumn(items.toIntColumn());
temp.sortAscendingOn(sets.name(), items.name());
ViewGroup baskets = temp.splitOn(temp.column(0));
int[][] itemsets = new int[baskets.size()][];
int basketIndex = 0;
for (TemporaryView basket : baskets) {
IntRBTreeSet set = new IntRBTreeSet(basket.intColumn(1).data());
int itemIndex = 0;
itemsets[basketIndex] = new int[set.size()];
for (int item : set) {
itemsets[basketIndex][itemIndex] = item;
itemIndex++;
}
basketIndex++;
}
this.model = new ARM(itemsets, support);
}
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:23,代码来源:AssociationRuleMining.java
示例4: main
import it.unimi.dsi.fastutil.ints.IntRBTreeSet; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
Table table = Table.read().csv(CsvReadOptions
.builder("../data/movielens.data")
.separator('\t'));
double supportThreshold = .25;
double confidenceThreshold = .5;
double interestThreshold = .5;
AssociationRuleMining model = new AssociationRuleMining(table.shortColumn("user"), table.shortColumn("movie")
, supportThreshold);
FrequentItemset frequentItemsetModel = new FrequentItemset(table.shortColumn("user"), table.shortColumn
("movie"), supportThreshold);
Object2DoubleOpenHashMap<IntRBTreeSet> confidenceMap = frequentItemsetModel.confidenceMap();
Table interestingRuleTable = model.interest(confidenceThreshold, interestThreshold, confidenceMap);
interestingRuleTable = interestingRuleTable.sortDescendingOn("Interest", "Antecedent");
out(interestingRuleTable);
}
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:23,代码来源:AssociationRuleMiningExample.java
示例5: startsWith
import it.unimi.dsi.fastutil.ints.IntRBTreeSet; //导入依赖的package包/类
default Selection startsWith(String string) {
Selection results = new BitmapBackedSelection();
IntRBTreeSet sorted = new IntRBTreeSet();
DictionaryMap dictionaryMap = this.dictionaryMap();
for (Object2IntMap.Entry<String> entry : dictionaryMap.valueToKeyMap().object2IntEntrySet()) {
String key = entry.getKey();
if (key.startsWith(string)) {
sorted.add(entry.getIntValue());
}
}
int i = 0;
for (int next : values()) {
if (sorted.contains(next)) {
results.add(i);
}
i++;
}
return results;
}
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:23,代码来源:CategoryFilters.java
示例6: interestingRules
import it.unimi.dsi.fastutil.ints.IntRBTreeSet; //导入依赖的package包/类
public List<AssociationRule> interestingRules(double confidenceThreshold,
double interestThreshold,
Object2DoubleOpenHashMap<IntRBTreeSet> confidenceMap) {
List<AssociationRule> rules = model.learn(confidenceThreshold);
for (AssociationRule rule : rules) {
double interest = rule.confidence - confidenceMap.getDouble(rule.consequent);
if (Math.abs(interest) < interestThreshold) {
rules.remove(rule);
}
}
return rules;
}
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:13,代码来源:AssociationRuleMining.java
示例7: FrequentItemset
import it.unimi.dsi.fastutil.ints.IntRBTreeSet; //导入依赖的package包/类
/**
* Constructs and returns a frequent itemset model
*
* @param sets
* @param items
* @param supportThreshold the minimum support required to be included
*/
public FrequentItemset(IntColumn sets, IntColumn items, double supportThreshold) {
Table temp = Table.create("temp");
temp.addColumn(sets.copy());
temp.addColumn(items.copy());
temp.sortAscendingOn(sets.name(), items.name());
ViewGroup baskets = temp.splitOn(temp.column(0));
this.setCount = baskets.size();
int[][] itemsets = new int[setCount][];
int basketIndex = 0;
for (TemporaryView basket : baskets) {
IntRBTreeSet set = new IntRBTreeSet(basket.intColumn(1).data());
int itemIndex = 0;
itemsets[basketIndex] = new int[set.size()];
for (int item : set) {
itemsets[basketIndex][itemIndex] = item;
itemIndex++;
}
basketIndex++;
}
this.model = new FPGrowth(itemsets, supportThreshold);
}
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:34,代码来源:FrequentItemset.java
示例8: main
import it.unimi.dsi.fastutil.ints.IntRBTreeSet; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
Table table = Table.read().csv(CsvReadOptions
.builder("../data/movielens.data")
.separator('\t'));
out(table.structure());
out(table.shape());
ShortColumn movie = table.shortColumn("movie");
CategoryColumn moviecat = new CategoryColumn("MovieCat");
for (int i = 0; i < movie.size(); i++) {
moviecat.appendCell(movie.getString(i));
}
table.addColumn(moviecat);
out(table.shortColumn("user").unique().size());
out(table.shortColumn("movie").unique().size());
FrequentItemset model = new FrequentItemset(table.shortColumn("user"), table.categoryColumn("MovieCat"), .24);
List<ItemSet> itemSetList = model.learn();
out("Frequent Itemsets");
for (ItemSet itemSet : itemSetList) {
if (itemSet.items.length == 2)
out(itemSet);
}
out(model.supportMap(250));
Object2DoubleOpenHashMap<IntRBTreeSet> confidenceMap = model.confidenceMap(.90);
Object2DoubleMap.FastEntrySet<IntRBTreeSet> entrySet = confidenceMap.object2DoubleEntrySet();
out("");
out("Confidence Map");
for (Object2DoubleMap.Entry<IntRBTreeSet> entry : entrySet) {
out(entry.getKey() + " : " + entry.getDoubleValue());
}
Object2DoubleOpenHashMap<IntRBTreeSet> confidenceMap2 = model.confidenceMap();
Object2DoubleMap.FastEntrySet<IntRBTreeSet> entrySet2 = confidenceMap2.object2DoubleEntrySet();
out("");
out("Confidence Map2");
for (Object2DoubleMap.Entry<IntRBTreeSet> entry2 : entrySet2) {
out(entry2.getKey() + " : " + entry2.getDoubleValue());
}
}
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:47,代码来源:FrequentItemsetExample.java
注:本文中的it.unimi.dsi.fastutil.ints.IntRBTreeSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论