it.unimi.dsi.fastutil.ints.Int2IntAVLTreeMap Java Examples

The following examples show how to use it.unimi.dsi.fastutil.ints.Int2IntAVLTreeMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReferenceModuleTestCase.java    From jstarcraft-ai with Apache License 2.0 6 votes vote down vote up
private DataModule getDataModule() {
    List<KeyValue<KeyValue<String, Boolean>, Integer>> moduleDefinition = new LinkedList<>();
    for (int index = 0; index < order; index++) {
        moduleDefinition.add(new KeyValue<>(new KeyValue<>("quality", true), 1));
        moduleDefinition.add(new KeyValue<>(new KeyValue<>("ontinuous", false), 1));
    }
    DataModule module = new SparseModule(moduleName, moduleDefinition, instanceCapacity);
    Int2IntSortedMap qualityFeatures = new Int2IntAVLTreeMap();
    Int2FloatSortedMap quantityFeatures = new Int2FloatAVLTreeMap();
    for (int index = 0; index < instanceCapacity; index++) {
        qualityFeatures.clear();
        qualityFeatures.put(index, index);
        module.associateInstance(qualityFeatures, quantityFeatures);
    }
    return module;
}
 
Example #2
Source File: DataSorterTestCase.java    From jstarcraft-ai with Apache License 2.0 6 votes vote down vote up
private DataModule getDataModule() {
    List<KeyValue<KeyValue<String, Boolean>, Integer>> moduleDefinition = new LinkedList<>();
    for (int index = 0; index < order; index++) {
        moduleDefinition.add(new KeyValue<>(new KeyValue<>("quality", true), 1));
        moduleDefinition.add(new KeyValue<>(new KeyValue<>("ontinuous", false), 1));
    }
    DataModule module = new SparseModule(moduleName, moduleDefinition, instanceCapacity);
    Int2IntSortedMap qualityFeatures = new Int2IntAVLTreeMap();
    Int2FloatSortedMap quantityFeatures = new Int2FloatAVLTreeMap();
    for (int index = 0; index < instanceCapacity; index++) {
        qualityFeatures.clear();
        qualityFeatures.put(0, index);
        module.associateInstance(qualityFeatures, quantityFeatures);
    }
    return module;
}
 
Example #3
Source File: DataSplitterTestCase.java    From jstarcraft-ai with Apache License 2.0 6 votes vote down vote up
private DataModule getDataModule() {
    List<KeyValue<KeyValue<String, Boolean>, Integer>> moduleDefinition = new LinkedList<>();
    for (int index = 0; index < order; index++) {
        moduleDefinition.add(new KeyValue<>(new KeyValue<>("quality", true), 1));
        moduleDefinition.add(new KeyValue<>(new KeyValue<>("ontinuous", false), 1));
    }
    DataModule module = new SparseModule(moduleName, moduleDefinition, instanceCapacity);
    Int2IntSortedMap qualityFeatures = new Int2IntAVLTreeMap();
    Int2FloatSortedMap quantityFeatures = new Int2FloatAVLTreeMap();
    for (int index = 0; index < instanceCapacity; index++) {
        qualityFeatures.clear();
        qualityFeatures.put(0, index);
        module.associateInstance(qualityFeatures, quantityFeatures);
    }
    return module;
}
 
Example #4
Source File: DataSelectorTestCase.java    From jstarcraft-ai with Apache License 2.0 6 votes vote down vote up
private DataModule getDataModule() {
    List<KeyValue<KeyValue<String, Boolean>, Integer>> moduleDefinition = new LinkedList<>();
    for (int index = 0; index < order; index++) {
        moduleDefinition.add(new KeyValue<>(new KeyValue<>("quality", true), 1));
        moduleDefinition.add(new KeyValue<>(new KeyValue<>("ontinuous", false), 1));
    }
    DataModule module = new SparseModule(moduleName, moduleDefinition, instanceCapacity);
    Int2IntSortedMap qualityFeatures = new Int2IntAVLTreeMap();
    Int2FloatSortedMap quantityFeatures = new Int2FloatAVLTreeMap();
    for (int index = 0; index < instanceCapacity; index++) {
        qualityFeatures.clear();
        qualityFeatures.put(0, index);
        module.associateInstance(qualityFeatures, quantityFeatures);
    }
    return module;
}
 
Example #5
Source File: CFDFinder.java    From metanome-algorithms with Apache License 2.0 6 votes vote down vote up
public static int findViolationsFor(final IntArrayList cluster, final int[] invertedRhsPLI) {
	int maxSize = 0;
	Int2IntAVLTreeMap clusterMap = new Int2IntAVLTreeMap();
	clusterMap.defaultReturnValue(0);
	for (int tuple : cluster) {
		int clusterId = invertedRhsPLI[tuple];
		if (clusterId == -1) {
			// single-tuple cluster, skip
			continue;
		}
		int count = clusterMap.get(clusterId);
		count += 1;
		clusterMap.put(clusterId, count);
		if (count > maxSize) {
			maxSize = count;
		}
	}
	if (maxSize > 0) {
		return cluster.size() - maxSize;
	}
	// if there is no cluster in the list, there are only single-tuple clusters on the rhs and thus, only one keeper
	return cluster.size() - 1;
}
 
Example #6
Source File: ReferenceModuleTestCase.java    From jstarcraft-ai with Apache License 2.0 5 votes vote down vote up
@Test
public void testAssociateInstance() {
    DataModule module = getDataModule();
    IntegerArray references = new IntegerArray(instanceCapacity, instanceCapacity);
    module = new ReferenceModule(references, module);
    Assert.assertEquals(0, module.getSize());

    try {
        Int2IntSortedMap qualityFeatures = new Int2IntAVLTreeMap();
        Int2FloatSortedMap quantityFeatures = new Int2FloatAVLTreeMap();
        module.associateInstance(qualityFeatures, quantityFeatures);
        Assert.fail();
    } catch (UnsupportedOperationException exception) {
    }
}