use of java.util.Arrays in project portfolio by buchen.
the class CSVSecurityExtractorTest method testSecurityCreation.
@Test
public void testSecurityCreation() throws ParseException {
Client client = new Client();
CSVExtractor extractor = new CSVSecurityExtractor(client);
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(0, Arrays.<String[]>asList(new String[] { "DE0007164600", "716460", "SAP.DE", "SAP SE", "EUR", "Notiz" }), buildField2Column(extractor), errors);
assertThat(errors, empty());
assertThat(results.size(), is(1));
new AssertImportActions().check(results, CurrencyUnit.EUR);
Security security = results.stream().filter(i -> i instanceof SecurityItem).findAny().get().getSecurity();
assertThat(security.getName(), is("SAP SE"));
assertThat(security.getIsin(), is("DE0007164600"));
assertThat(security.getWkn(), is("716460"));
assertThat(security.getTickerSymbol(), is("SAP.DE"));
assertThat(security.getCurrencyCode(), is("EUR"));
assertThat(security.getNote(), is("Notiz"));
}
use of java.util.Arrays in project MindsEye by SimiaCryptus.
the class TrainingTester method testCompleteLearning.
/**
* Test complete learning apply result.
*
* @param log the log
* @param component the component
* @param random the random
* @param inputPrototype the input prototype
* @return the apply result
*/
@Nonnull
public TestResult testCompleteLearning(@Nonnull final NotebookOutput log, @Nonnull final Layer component, final Random random, @Nonnull final Tensor[] inputPrototype) {
@Nonnull final Layer network_target = shuffle(random, component.copy()).freeze();
final Tensor[][] input_target = shuffleCopy(random, inputPrototype);
log.p("In this apply, attempt to train a network to emulate a randomized network given an example input/output. The target state is:");
log.code(() -> {
return network_target.state().stream().map(Arrays::toString).reduce((a, b) -> a + "\n" + b).orElse("");
});
log.p("We simultaneously regress this target input:");
log.code(() -> {
return Arrays.stream(input_target).flatMap(x -> Arrays.stream(x)).map(x -> x.prettyPrint()).reduce((a, b) -> a + "\n" + b).orElse("");
});
log.p("Which produces the following output:");
Result[] inputs = ConstantResult.batchResultArray(input_target);
Result eval = network_target.eval(inputs);
network_target.freeRef();
Arrays.stream(inputs).forEach(ReferenceCounting::freeRef);
TensorList result = eval.getData();
eval.freeRef();
final Tensor[] output_target = result.stream().toArray(i -> new Tensor[i]);
log.code(() -> {
return Stream.of(output_target).map(x -> x.prettyPrint()).reduce((a, b) -> a + "\n" + b).orElse("");
});
// if (output_target.length != inputPrototype.length) return null;
return trainAll("Integrated Convergence", log, append(shuffleCopy(random, inputPrototype), output_target), shuffle(random, component.copy()), buildMask(inputPrototype.length));
}
use of java.util.Arrays in project qpp-conversion-tool by CMSgov.
the class CpcQualityMeasureSectionValidatorTest method setupMeasures.
private Node setupMeasures(String[]... measureGroups) {
Node[] nodes = Arrays.stream(measureGroups).flatMap(Arrays::stream).map(this::mockMeasureNode).toArray(Node[]::new);
Node node = new Node();
node.addChildNodes(nodes);
return node;
}
use of java.util.Arrays in project presto by prestodb.
the class TestSelectiveOrcReader method testArraysWithSubfieldPruning.
@Test
public void testArraysWithSubfieldPruning() throws Exception {
tester.assertRoundTripWithSettings(arrayType(INTEGER), createList(NUM_ROWS, i -> ImmutableList.of(1, 2, 3, 4)), ImmutableList.of(OrcReaderSettings.builder().addRequiredSubfields(0, "c[1]").build(), OrcReaderSettings.builder().addRequiredSubfields(0, "c[1]", "c[2]").build(), OrcReaderSettings.builder().addRequiredSubfields(0, "c[2]").build()));
Random random = new Random(0);
tester.assertRoundTripWithSettings(arrayType(INTEGER), createList(NUM_ROWS, i -> ImmutableList.of(random.nextInt(10), random.nextInt(10), 3, 4)), ImmutableList.of(OrcReaderSettings.builder().addRequiredSubfields(0, "c[1]", "c[3]").setColumnFilters(ImmutableMap.of(0, ImmutableMap.of(new Subfield("c[1]"), BigintRange.of(0, 4, false)))).build(), OrcReaderSettings.builder().addRequiredSubfields(0, "c[2]", "c[3]").setColumnFilters(ImmutableMap.of(0, ImmutableMap.of(new Subfield("c[2]"), BigintRange.of(0, 4, false)))).build()));
// arrays of arrays
tester.assertRoundTripWithSettings(arrayType(arrayType(INTEGER)), createList(NUM_ROWS, i -> nCopies(1 + random.nextInt(5), ImmutableList.of(1, 2, 3))), ImmutableList.of(OrcReaderSettings.builder().addRequiredSubfields(0, "c[1][1]").build(), OrcReaderSettings.builder().addRequiredSubfields(0, "c[2][2]", "c[4][2]", "c[5][3]").build(), OrcReaderSettings.builder().addRequiredSubfields(0, "c[2][3]", "c[10][2]", "c[3][10]").build()));
// arrays of maps
tester.assertRoundTripWithSettings(arrayType(mapType(INTEGER, INTEGER)), createList(NUM_ROWS, i -> nCopies(5, ImmutableMap.of(1, 10, 2, 20))), ImmutableList.of(OrcReaderSettings.builder().addRequiredSubfields(0, "c[1][1]").build(), OrcReaderSettings.builder().addRequiredSubfields(0, "c[2][1]").build(), OrcReaderSettings.builder().addRequiredSubfields(0, "c[2][1]", "c[4][1]", "c[3][2]").build()));
}
use of java.util.Arrays in project cassandra by apache.
the class ColumnFilterTest method beforeClass.
@BeforeClass
public static void beforeClass() {
DatabaseDescriptor.setSeedProvider(Arrays::asList);
DatabaseDescriptor.setEndpointSnitch(new SimpleSnitch());
DatabaseDescriptor.setDefaultFailureDetector();
Gossiper.instance.start(0);
}
Aggregations