Search in sources :

Example 1 with NeighboursBruteForceFactory

use of org.tribuo.math.neighbour.bruteforce.NeighboursBruteForceFactory in project tribuo by oracle.

the class HdbscanTrainer method postConfig.

/**
 * Used by the OLCUT configuration system, and should not be called by external code.
 */
@Override
public synchronized void postConfig() {
    if (this.distanceType != null) {
        if (this.distType != null) {
            throw new PropertyException("distType", "Both distType and distanceType must not both be set.");
        } else {
            this.distType = this.distanceType.getDistanceType();
            this.distanceType = null;
        }
    }
    if (neighboursQueryFactory == null) {
        int numberThreads = (this.numThreads <= 0) ? 1 : this.numThreads;
        this.neighboursQueryFactory = new NeighboursBruteForceFactory(distType, numberThreads);
    } else {
        if (!this.distType.equals(neighboursQueryFactory.getDistanceType())) {
            throw new PropertyException("neighboursQueryFactory", "distType and its field on the " + "NeighboursQueryFactory must be equal.");
        }
    }
}
Also used : PropertyException(com.oracle.labs.mlrg.olcut.config.PropertyException) NeighboursBruteForceFactory(org.tribuo.math.neighbour.bruteforce.NeighboursBruteForceFactory)

Example 2 with NeighboursBruteForceFactory

use of org.tribuo.math.neighbour.bruteforce.NeighboursBruteForceFactory in project tribuo by oracle.

the class TestNeighborsBruteForce method testMultiThreadQueryAll.

@Test
public void testMultiThreadQueryAll() {
    NeighboursBruteForceFactory factory = new NeighboursBruteForceFactory(DistanceType.L2, 4);
    NeighbourQueryTestHelper.neighboursQueryAll(factory);
}
Also used : NeighboursBruteForceFactory(org.tribuo.math.neighbour.bruteforce.NeighboursBruteForceFactory) Test(org.junit.jupiter.api.Test)

Example 3 with NeighboursBruteForceFactory

use of org.tribuo.math.neighbour.bruteforce.NeighboursBruteForceFactory in project tribuo by oracle.

the class TestNeighborsBruteForce method testSingleThreadQueryMany.

@Test
public void testSingleThreadQueryMany() {
    NeighboursBruteForceFactory factory = new NeighboursBruteForceFactory(DistanceType.L2, 1);
    NeighbourQueryTestHelper.neighboursQueryMany(factory);
}
Also used : NeighboursBruteForceFactory(org.tribuo.math.neighbour.bruteforce.NeighboursBruteForceFactory) Test(org.junit.jupiter.api.Test)

Example 4 with NeighboursBruteForceFactory

use of org.tribuo.math.neighbour.bruteforce.NeighboursBruteForceFactory in project tribuo by oracle.

the class TestNeighborsBruteForce method testSingleDimension.

@Test
public void testSingleDimension() {
    NeighboursBruteForceFactory factory = new NeighboursBruteForceFactory(DistanceType.L2, 1);
    NeighbourQueryTestHelper.neighboursQuerySingleDimension(factory);
}
Also used : NeighboursBruteForceFactory(org.tribuo.math.neighbour.bruteforce.NeighboursBruteForceFactory) Test(org.junit.jupiter.api.Test)

Example 5 with NeighboursBruteForceFactory

use of org.tribuo.math.neighbour.bruteforce.NeighboursBruteForceFactory in project tribuo by oracle.

the class TestNeighborsBruteForce method testNeighboursQueryOneExclusive.

@Test
public void testNeighboursQueryOneExclusive() {
    NeighboursBruteForceFactory factory = new NeighboursBruteForceFactory(DistanceType.L2, 1);
    NeighbourQueryTestHelper.neighboursQueryOneExclusive(factory);
}
Also used : NeighboursBruteForceFactory(org.tribuo.math.neighbour.bruteforce.NeighboursBruteForceFactory) Test(org.junit.jupiter.api.Test)

Aggregations

NeighboursBruteForceFactory (org.tribuo.math.neighbour.bruteforce.NeighboursBruteForceFactory)13 Test (org.junit.jupiter.api.Test)10 PropertyException (com.oracle.labs.mlrg.olcut.config.PropertyException)2 NeighboursQueryFactory (org.tribuo.math.neighbour.NeighboursQueryFactory)1 Regressor (org.tribuo.regression.Regressor)1 AveragingCombiner (org.tribuo.regression.ensemble.AveragingCombiner)1