Search in sources :

Example 16 with BinaryOperator

use of java.util.function.BinaryOperator in project jvarkit by lindenb.

the class CombineVcfFisher method doWork.

@Override
public int doWork(final List<String> args) {
    try {
        this.pedigree = new PedigreeParser().parse(this.pedigreeFile);
        final Map<Path, Optional<GeneGenotypes>> path2genegenotype = new HashMap<>(50_000);
        final Function<Path, GeneGenotypes> geneMapper = PATH -> {
            if (this.do_buffer_vcf && path2genegenotype.containsKey(PATH)) {
                return path2genegenotype.get(PATH).orElse(null);
            }
            final GeneGenotypes value;
            try {
                value = loadGeneGenotypes(PATH);
            } catch (final IOException err) {
                throw new RuntimeIOException(err);
            }
            if (this.do_buffer_vcf) {
                path2genegenotype.put(PATH, Optional.ofNullable(value));
            }
            return value;
        };
        final BinaryOperator<GeneGenotypes> merger = (A, B) -> {
            final GeneGenotypes ggt = new GeneGenotypes(A.geneid + ":" + B.geneid);
            ggt.genotypes.or(A.genotypes);
            ggt.genotypes.or(B.genotypes);
            ggt.nVariants = A.nVariants + B.nVariants;
            return ggt;
        };
        final List<Path> geneList = new ArrayList<>();
        final String input = oneAndOnlyOneFile(args);
        try (PrintWriter pw = super.openPathOrStdoutAsPrintWriter(this.outputFile)) {
            pw.println("#genes\tn-variants\tcases-R\tcases-A\tcontrols-R\tcontrols-A\tfisher");
            try (BufferedReader br = super.openBufferedReader(input)) {
                String line;
                while ((line = br.readLine()) != null) {
                    if (line.startsWith("#") || StringUtils.isBlank(line))
                        continue;
                    final String[] tokens = CharSplitter.TAB.split(line);
                    if (!use_line_mode) {
                        if (tokens.length != 1) {
                            LOG.error("inconsistent number of column in " + line + " exepcted one column but got " + tokens.length);
                            return -1;
                        }
                        geneList.add(Paths.get(tokens[0]));
                    } else // line mode
                    {
                        final GeneGenotypes ggt = Arrays.stream(tokens).map(S -> Paths.get(S)).map(geneMapper).filter(X -> X != null).reduce(merger).orElse(null);
                        if (ggt != null)
                            runFisher(pw, ggt);
                    }
                }
            }
            if (!use_line_mode) {
                Collections.sort(geneList, (A, B) -> A.getFileName().compareTo(B.getFileName()));
                switch(recursion) {
                    case 1:
                        {
                            for (int x = 0; x < geneList.size(); x++) {
                                final GeneGenotypes ggtx = geneMapper.apply(geneList.get(x));
                                if (ggtx == null)
                                    continue;
                                runFisher(pw, ggtx);
                            }
                            break;
                        }
                    case 2:
                        {
                            for (int x = 0; x + 1 < geneList.size(); x++) {
                                final GeneGenotypes ggtx = geneMapper.apply(geneList.get(x));
                                if (ggtx == null)
                                    continue;
                                for (int y = x + 1; y < geneList.size(); y++) {
                                    final GeneGenotypes ggty = geneMapper.apply(geneList.get(y));
                                    if (ggty == null)
                                        continue;
                                    runFisher(pw, merger.apply(ggtx, ggty));
                                }
                            }
                            break;
                        }
                    case 3:
                        {
                            for (int x = 0; x + 2 < geneList.size(); x++) {
                                final GeneGenotypes ggtx = geneMapper.apply(geneList.get(x));
                                if (ggtx == null)
                                    continue;
                                for (int y = x + 1; y + 1 < geneList.size(); y++) {
                                    final GeneGenotypes ggty = geneMapper.apply(geneList.get(y));
                                    if (ggty == null)
                                        continue;
                                    final GeneGenotypes ggtxy = merger.apply(ggtx, ggty);
                                    for (int z = y + 1; z < geneList.size(); z++) {
                                        final GeneGenotypes ggtz = geneMapper.apply(geneList.get(z));
                                        if (ggtz == null)
                                            continue;
                                        runFisher(pw, merger.apply(ggtxy, ggtz));
                                    }
                                }
                            }
                            break;
                        }
                    default:
                        {
                            LOG.error("Cannot compute recursion>3 or <1");
                            return -1;
                        }
                }
            }
            pw.flush();
        }
        return 0;
    } catch (final Throwable err) {
        LOG.error(err);
        return -1;
    }
}
Also used : Path(java.nio.file.Path) IntStream(java.util.stream.IntStream) Genotype(htsjdk.variant.variantcontext.Genotype) CloseableIterator(htsjdk.samtools.util.CloseableIterator) Arrays(java.util.Arrays) CharSplitter(com.github.lindenb.jvarkit.lang.CharSplitter) Program(com.github.lindenb.jvarkit.util.jcommander.Program) Parameter(com.beust.jcommander.Parameter) VCFHeader(htsjdk.variant.vcf.VCFHeader) HashMap(java.util.HashMap) Function(java.util.function.Function) ArrayList(java.util.ArrayList) FisherExactTest(com.github.lindenb.jvarkit.math.stats.FisherExactTest) PedigreeParser(com.github.lindenb.jvarkit.pedigree.PedigreeParser) RuntimeIOException(htsjdk.samtools.util.RuntimeIOException) Map(java.util.Map) IOUtils(com.github.lindenb.jvarkit.io.IOUtils) Launcher(com.github.lindenb.jvarkit.util.jcommander.Launcher) VCFReaderFactory(com.github.lindenb.jvarkit.variant.vcf.VCFReaderFactory) Path(java.nio.file.Path) PrintWriter(java.io.PrintWriter) Pedigree(com.github.lindenb.jvarkit.pedigree.Pedigree) Logger(com.github.lindenb.jvarkit.util.log.Logger) VCFReader(htsjdk.variant.vcf.VCFReader) IOException(java.io.IOException) BinaryOperator(java.util.function.BinaryOperator) List(java.util.List) Paths(java.nio.file.Paths) StringUtils(com.github.lindenb.jvarkit.lang.StringUtils) Optional(java.util.Optional) VariantContext(htsjdk.variant.variantcontext.VariantContext) BufferedReader(java.io.BufferedReader) BitSet(java.util.BitSet) Collections(java.util.Collections) Sample(com.github.lindenb.jvarkit.pedigree.Sample) RuntimeIOException(htsjdk.samtools.util.RuntimeIOException) Optional(java.util.Optional) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) RuntimeIOException(htsjdk.samtools.util.RuntimeIOException) IOException(java.io.IOException) PedigreeParser(com.github.lindenb.jvarkit.pedigree.PedigreeParser) BufferedReader(java.io.BufferedReader) PrintWriter(java.io.PrintWriter)

Example 17 with BinaryOperator

use of java.util.function.BinaryOperator in project parent by Daytime-Don-t-Know-Dark-Night.

the class StreamReduce1 method main.

public static void main(String[] args) {
    /**
     * @param a 表达式执行结果的缓存
     * @param b stream中的每一个元素
     */
    Integer sum1 = Stream.of(1, 2, 3, 4, 5).reduce(new BinaryOperator<Integer>() {

        @Override
        public Integer apply(Integer a, Integer b) {
            System.out.printf("a = %d, b = %d %n", a, b);
            return a + b;
        }
    }).get();
    Integer sum2 = Stream.of(1, 2, 3, 4, 5).reduce(0, (a, b) -> a + b);
    // 前两种计算结果的类型必须和stream中的元素类型相同,
    /**
     * @param 初始值, 初始值为什么类型, 最后返回的结果就是什么类型
     * @param a, a的类型与初始值及返回结果一致
     * @param b, 中间量的类型, 也就是stream中元素的类型
     * @param expression
     */
    ArrayList<String> sum3 = Stream.of(1, 2, 3, 4, 5).reduce(new ArrayList<String>(), (ArrayList<String> a, Integer b) -> {
        a.add("*" + b);
        return a;
    }, (a, b) -> b);
    HttpClientContext httpContext = HttpClientContext.create();
    String url = "http://www.boluo.com";
    String body = "&type=1";
    Document d1 = historyRequest(httpContext, url, body);
    Stream<CompletableFuture<Document>> d2 = Stream.iterate(2, i -> i + 1).limit(20).map(i -> CompletableFuture.supplyAsync(() -> historyRequest(httpContext, url, body + "&page=" + i)));
    /* 		为保证线程start之后全部执行完成再往下执行, 可以先collect全部join
		Stream<Document> s2 = d2.collect(Collectors.toList()).stream().map(CompletableFuture::join);
		Stream.concat(Stream.of(d1), s2).flatMap(tr -> {
			Elements head = tr.select("");
			return head.stream().map(i -> {
				return i.text();
			});
		});		*/
    // 关键在于 CompletableFuture<Document> -> Stream<Document>
    CompletableFuture<Stream<Document>> d3 = d2.reduce(CompletableFuture.completedFuture(Stream.of()), (CompletableFuture<Stream<Document>> a, CompletableFuture<Document> b) -> {
        CompletableFuture<Stream<Document>> res = a.thenCombine(b, (ra, rb) -> {
            return Stream.concat(ra, Stream.of(rb));
        });
        return res;
    }, (a, b) -> b);
    // 此时:
    Stream<Document> pageContext = Stream.concat(Stream.of(d1), d3.join());
    // *************************************************************************************************************
    /* 		另一种方式
		Stream<CompletableFuture<Document>> s2 = Stream.iterate(2, i -> i + 1)
				.limit(20)
				.map(i -> CompletableFuture.supplyAsync(() -> {
					return historyRequest(httpContext, url, body + "&page=" + i);
				}));		*/
    Stream<CompletableFuture<Stream<Document>>> s2 = Stream.iterate(2, i -> i + 1).limit(20).map(i -> CompletableFuture.supplyAsync(() -> {
        Document doc = historyRequest(httpContext, url, body + "&page=" + i);
        return Stream.of(doc);
    }));
    // 这里可以直接用第二种签名, 此时a, b类型一致, 为: CompletableFuture<Stream<Document>>
    CompletableFuture<Stream<Document>> s3 = s2.reduce(CompletableFuture.completedFuture(Stream.of()), (CompletableFuture<Stream<Document>> a, CompletableFuture<Stream<Document>> b) -> {
        CompletableFuture<Stream<Document>> res = a.thenCombine(b, (ra, rb) -> {
            return Stream.concat(ra, rb);
        });
        return res;
    });
    Stream.concat(Stream.of(d1), s3.join());
}
Also used : ArrayList(java.util.ArrayList) HttpClientContext(org.apache.http.client.protocol.HttpClientContext) Document(org.jsoup.nodes.Document) CompletableFuture(java.util.concurrent.CompletableFuture) Stream(java.util.stream.Stream) InputStream(java.io.InputStream) BinaryOperator(java.util.function.BinaryOperator)

Example 18 with BinaryOperator

use of java.util.function.BinaryOperator in project sw360portal by sw360.

the class XhtmlGeneratorTest method findLicenses.

private String findLicenses(Document document, String releaseNameString) {
    List list = document.selectNodes("//*[local-name()='li'][@id='" + releaseNameString + "']/*[local-name()='ul'][@class='licenseEntries']");
    StringBuffer result = new StringBuffer();
    for (Iterator iter = list.iterator(); iter.hasNext(); ) {
        Element element = (Element) iter.next();
        for (Object liObject : element.content()) {
            Element liElement = (Element) liObject;
            String licenseEntryId = liElement.attribute("id").getValue();
            String licenseTextId = licenseEntryId.replace("licenseEntry", "licenseText");
            List licenseTexts = document.selectNodes("//*[local-name()='pre'][@id='" + licenseTextId + "']/text()");
            Object licenseText = licenseTexts.stream().map(l -> ((Text) l).getStringValue()).reduce("", (BinaryOperator<String>) (l1, l2) -> (String) (l1 + l2));
            result.append(((String) licenseText).trim());
            result.append("\n");
        }
    }
    return result.toString();
}
Also used : InputSource(org.xml.sax.InputSource) Document(org.dom4j.Document) java.util(java.util) BeforeClass(org.junit.BeforeClass) Text(org.dom4j.Text) Test(org.junit.Test) SAXReader(org.dom4j.io.SAXReader) BinaryOperator(java.util.function.BinaryOperator) StringReader(java.io.StringReader) org.eclipse.sw360.datahandler.thrift.licenseinfo(org.eclipse.sw360.datahandler.thrift.licenseinfo) Element(org.dom4j.Element) Matchers.is(org.hamcrest.Matchers.is) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Matchers.containsString(org.hamcrest.Matchers.containsString) EntityResolver(org.xml.sax.EntityResolver) InputStream(java.io.InputStream) Element(org.dom4j.Element) Text(org.dom4j.Text) Matchers.containsString(org.hamcrest.Matchers.containsString)

Example 19 with BinaryOperator

use of java.util.function.BinaryOperator in project random-cut-forest-by-aws by aws.

the class RandomCutForest method getDynamicSimulatedScore.

/**
 * Similar to above but now the scoring takes in a function of Bounding Box to
 * probabilities (vector over the dimensions); and produces a score af-if the
 * tree were built using that function (when in reality the tree is an RCF).
 * Changing the defaultRCFgVec function to some other function f() will provide
 * a mechanism of dynamic scoring for trees that are built using f() which is
 * the purpose of TransductiveScalarScore visitor. Note that the answer is an
 * MCMC simulation and is not normalized (because the scoring functions are
 * flexible and unknown) and over a small number of trees the errors can be
 * large specially if vecSep is very far from defaultRCFgVec
 *
 * Given the large number of possible sources of distortion, ignoreLeafThreshold
 * is not supported.
 *
 * @param point  point to be scored
 * @param seen   the score function for seen point
 * @param unseen score function for unseen points
 * @param damp   dampening the score for duplicates
 * @param vecSep the function of (BoundingBox) -&gt; array of probabilities
 * @return the simuated score
 */
public double getDynamicSimulatedScore(float[] point, BiFunction<Double, Double, Double> seen, BiFunction<Double, Double, Double> unseen, BiFunction<Double, Double, Double> damp, Function<IBoundingBoxView, double[]> vecSep) {
    if (!isOutputReady()) {
        return 0.0;
    }
    VisitorFactory<Double> visitorFactory = new VisitorFactory<>((tree, y) -> new SimulatedTransductiveScalarScoreVisitor(tree.projectToTree(y), tree.getMass(), seen, unseen, damp, CommonUtils::defaultRCFgVecFunction, vecSep));
    BinaryOperator<Double> accumulator = Double::sum;
    Function<Double, Double> finisher = sum -> sum / numberOfTrees;
    return traverseForest(transformToShingledPoint(point), visitorFactory, accumulator, finisher);
}
Also used : CommonUtils.checkNotNull(com.amazon.randomcutforest.CommonUtils.checkNotNull) Arrays(java.util.Arrays) BiFunction(java.util.function.BiFunction) ParallelForestTraversalExecutor(com.amazon.randomcutforest.executor.ParallelForestTraversalExecutor) Random(java.util.Random) ParallelForestUpdateExecutor(com.amazon.randomcutforest.executor.ParallelForestUpdateExecutor) AbstractForestUpdateExecutor(com.amazon.randomcutforest.executor.AbstractForestUpdateExecutor) IStateCoordinator(com.amazon.randomcutforest.executor.IStateCoordinator) RandomCutTree(com.amazon.randomcutforest.tree.RandomCutTree) CommonUtils.toFloatArray(com.amazon.randomcutforest.CommonUtils.toFloatArray) Neighbor(com.amazon.randomcutforest.returntypes.Neighbor) ConditionalSampleSummarizer(com.amazon.randomcutforest.imputation.ConditionalSampleSummarizer) ImputeVisitor(com.amazon.randomcutforest.imputation.ImputeVisitor) NearNeighborVisitor(com.amazon.randomcutforest.inspect.NearNeighborVisitor) IBoundingBoxView(com.amazon.randomcutforest.tree.IBoundingBoxView) Collector(java.util.stream.Collector) PointStoreCoordinator(com.amazon.randomcutforest.executor.PointStoreCoordinator) AnomalyAttributionVisitor(com.amazon.randomcutforest.anomalydetection.AnomalyAttributionVisitor) OneSidedConvergingDoubleAccumulator(com.amazon.randomcutforest.returntypes.OneSidedConvergingDoubleAccumulator) AnomalyScoreVisitor(com.amazon.randomcutforest.anomalydetection.AnomalyScoreVisitor) AbstractForestTraversalExecutor(com.amazon.randomcutforest.executor.AbstractForestTraversalExecutor) BinaryOperator(java.util.function.BinaryOperator) SequentialForestTraversalExecutor(com.amazon.randomcutforest.executor.SequentialForestTraversalExecutor) List(java.util.List) Math.max(java.lang.Math.max) Optional(java.util.Optional) DensityOutput(com.amazon.randomcutforest.returntypes.DensityOutput) CommonUtils.toDoubleArray(com.amazon.randomcutforest.CommonUtils.toDoubleArray) Precision(com.amazon.randomcutforest.config.Precision) CompactSampler(com.amazon.randomcutforest.sampler.CompactSampler) SamplerPlusTree(com.amazon.randomcutforest.executor.SamplerPlusTree) ShingleBuilder(com.amazon.randomcutforest.util.ShingleBuilder) Function(java.util.function.Function) ArrayList(java.util.ArrayList) SimulatedTransductiveScalarScoreVisitor(com.amazon.randomcutforest.anomalydetection.SimulatedTransductiveScalarScoreVisitor) PointStore(com.amazon.randomcutforest.store.PointStore) DynamicAttributionVisitor(com.amazon.randomcutforest.anomalydetection.DynamicAttributionVisitor) ConvergingAccumulator(com.amazon.randomcutforest.returntypes.ConvergingAccumulator) Config(com.amazon.randomcutforest.config.Config) SimpleInterpolationVisitor(com.amazon.randomcutforest.interpolation.SimpleInterpolationVisitor) InterpolationMeasure(com.amazon.randomcutforest.returntypes.InterpolationMeasure) IPointStore(com.amazon.randomcutforest.store.IPointStore) SequentialForestUpdateExecutor(com.amazon.randomcutforest.executor.SequentialForestUpdateExecutor) ArrayUtils(com.amazon.randomcutforest.util.ArrayUtils) OneSidedConvergingDiVectorAccumulator(com.amazon.randomcutforest.returntypes.OneSidedConvergingDiVectorAccumulator) CommonUtils.checkArgument(com.amazon.randomcutforest.CommonUtils.checkArgument) DynamicScoreVisitor(com.amazon.randomcutforest.anomalydetection.DynamicScoreVisitor) DiVector(com.amazon.randomcutforest.returntypes.DiVector) ITree(com.amazon.randomcutforest.tree.ITree) ConditionalTreeSample(com.amazon.randomcutforest.returntypes.ConditionalTreeSample) ConditionalSampleSummary(com.amazon.randomcutforest.returntypes.ConditionalSampleSummary) Collections(java.util.Collections) IStreamSampler(com.amazon.randomcutforest.sampler.IStreamSampler) SimulatedTransductiveScalarScoreVisitor(com.amazon.randomcutforest.anomalydetection.SimulatedTransductiveScalarScoreVisitor)

Example 20 with BinaryOperator

use of java.util.function.BinaryOperator in project random-cut-forest-by-aws by aws.

the class RandomCutForest method getDynamicScore.

/**
 * Score a point using the given scoring functions.
 *
 * @param point                   input point being scored
 * @param ignoreLeafMassThreshold said threshold
 * @param seen                    the function that applies if input is equal to
 *                                a previously seen sample in a leaf
 * @param unseen                  if the input does not have a match in the
 *                                leaves
 * @param damp                    damping function based on the duplicity of the
 *                                previously seen samples
 * @return anomaly score
 */
public double getDynamicScore(float[] point, int ignoreLeafMassThreshold, BiFunction<Double, Double, Double> seen, BiFunction<Double, Double, Double> unseen, BiFunction<Double, Double, Double> damp) {
    checkArgument(ignoreLeafMassThreshold >= 0, "ignoreLeafMassThreshold should be greater than or equal to 0");
    if (!isOutputReady()) {
        return 0.0;
    }
    VisitorFactory<Double> visitorFactory = new VisitorFactory<>((tree, y) -> new DynamicScoreVisitor(tree.projectToTree(y), tree.getMass(), ignoreLeafMassThreshold, seen, unseen, damp));
    BinaryOperator<Double> accumulator = Double::sum;
    Function<Double, Double> finisher = sum -> sum / numberOfTrees;
    return traverseForest(transformToShingledPoint(point), visitorFactory, accumulator, finisher);
}
Also used : CommonUtils.checkNotNull(com.amazon.randomcutforest.CommonUtils.checkNotNull) Arrays(java.util.Arrays) BiFunction(java.util.function.BiFunction) ParallelForestTraversalExecutor(com.amazon.randomcutforest.executor.ParallelForestTraversalExecutor) Random(java.util.Random) ParallelForestUpdateExecutor(com.amazon.randomcutforest.executor.ParallelForestUpdateExecutor) AbstractForestUpdateExecutor(com.amazon.randomcutforest.executor.AbstractForestUpdateExecutor) IStateCoordinator(com.amazon.randomcutforest.executor.IStateCoordinator) RandomCutTree(com.amazon.randomcutforest.tree.RandomCutTree) CommonUtils.toFloatArray(com.amazon.randomcutforest.CommonUtils.toFloatArray) Neighbor(com.amazon.randomcutforest.returntypes.Neighbor) ConditionalSampleSummarizer(com.amazon.randomcutforest.imputation.ConditionalSampleSummarizer) ImputeVisitor(com.amazon.randomcutforest.imputation.ImputeVisitor) NearNeighborVisitor(com.amazon.randomcutforest.inspect.NearNeighborVisitor) IBoundingBoxView(com.amazon.randomcutforest.tree.IBoundingBoxView) Collector(java.util.stream.Collector) PointStoreCoordinator(com.amazon.randomcutforest.executor.PointStoreCoordinator) AnomalyAttributionVisitor(com.amazon.randomcutforest.anomalydetection.AnomalyAttributionVisitor) OneSidedConvergingDoubleAccumulator(com.amazon.randomcutforest.returntypes.OneSidedConvergingDoubleAccumulator) AnomalyScoreVisitor(com.amazon.randomcutforest.anomalydetection.AnomalyScoreVisitor) AbstractForestTraversalExecutor(com.amazon.randomcutforest.executor.AbstractForestTraversalExecutor) BinaryOperator(java.util.function.BinaryOperator) SequentialForestTraversalExecutor(com.amazon.randomcutforest.executor.SequentialForestTraversalExecutor) List(java.util.List) Math.max(java.lang.Math.max) Optional(java.util.Optional) DensityOutput(com.amazon.randomcutforest.returntypes.DensityOutput) CommonUtils.toDoubleArray(com.amazon.randomcutforest.CommonUtils.toDoubleArray) Precision(com.amazon.randomcutforest.config.Precision) CompactSampler(com.amazon.randomcutforest.sampler.CompactSampler) SamplerPlusTree(com.amazon.randomcutforest.executor.SamplerPlusTree) ShingleBuilder(com.amazon.randomcutforest.util.ShingleBuilder) Function(java.util.function.Function) ArrayList(java.util.ArrayList) SimulatedTransductiveScalarScoreVisitor(com.amazon.randomcutforest.anomalydetection.SimulatedTransductiveScalarScoreVisitor) PointStore(com.amazon.randomcutforest.store.PointStore) DynamicAttributionVisitor(com.amazon.randomcutforest.anomalydetection.DynamicAttributionVisitor) ConvergingAccumulator(com.amazon.randomcutforest.returntypes.ConvergingAccumulator) Config(com.amazon.randomcutforest.config.Config) SimpleInterpolationVisitor(com.amazon.randomcutforest.interpolation.SimpleInterpolationVisitor) InterpolationMeasure(com.amazon.randomcutforest.returntypes.InterpolationMeasure) IPointStore(com.amazon.randomcutforest.store.IPointStore) SequentialForestUpdateExecutor(com.amazon.randomcutforest.executor.SequentialForestUpdateExecutor) ArrayUtils(com.amazon.randomcutforest.util.ArrayUtils) OneSidedConvergingDiVectorAccumulator(com.amazon.randomcutforest.returntypes.OneSidedConvergingDiVectorAccumulator) CommonUtils.checkArgument(com.amazon.randomcutforest.CommonUtils.checkArgument) DynamicScoreVisitor(com.amazon.randomcutforest.anomalydetection.DynamicScoreVisitor) DiVector(com.amazon.randomcutforest.returntypes.DiVector) ITree(com.amazon.randomcutforest.tree.ITree) ConditionalTreeSample(com.amazon.randomcutforest.returntypes.ConditionalTreeSample) ConditionalSampleSummary(com.amazon.randomcutforest.returntypes.ConditionalSampleSummary) Collections(java.util.Collections) IStreamSampler(com.amazon.randomcutforest.sampler.IStreamSampler) DynamicScoreVisitor(com.amazon.randomcutforest.anomalydetection.DynamicScoreVisitor)

Aggregations

BinaryOperator (java.util.function.BinaryOperator)38 List (java.util.List)20 ArrayList (java.util.ArrayList)12 Arrays (java.util.Arrays)12 Function (java.util.function.Function)10 Test (org.junit.jupiter.api.Test)10 Collections (java.util.Collections)8 Optional (java.util.Optional)8 Collectors (java.util.stream.Collectors)8 Stream (java.util.stream.Stream)8 BiFunction (java.util.function.BiFunction)7 Map (java.util.Map)6 Collector (java.util.stream.Collector)6 CommonUtils.checkArgument (com.amazon.randomcutforest.CommonUtils.checkArgument)4 CommonUtils.checkNotNull (com.amazon.randomcutforest.CommonUtils.checkNotNull)4 CommonUtils.toDoubleArray (com.amazon.randomcutforest.CommonUtils.toDoubleArray)4 CommonUtils.toFloatArray (com.amazon.randomcutforest.CommonUtils.toFloatArray)4 AnomalyAttributionVisitor (com.amazon.randomcutforest.anomalydetection.AnomalyAttributionVisitor)4 AnomalyScoreVisitor (com.amazon.randomcutforest.anomalydetection.AnomalyScoreVisitor)4 DynamicAttributionVisitor (com.amazon.randomcutforest.anomalydetection.DynamicAttributionVisitor)4