id stringlengths 7 14 | test_class dict | test_case dict | focal_class dict | focal_method dict | repository dict |
|---|---|---|---|---|---|
128393918_103 | {
"fields": [
{
"declarator": "Amu",
"modifier": "",
"original_string": "DoubleVertex Amu;",
"type": "DoubleVertex",
"var_name": "Amu"
},
{
"declarator": "Asigma",
"modifier": "",
"original_string": "DoubleVertex Asigma;",
"type": "DoubleVertex",
... | {
"body": "@Test\n public void doesGetDownstreamProbabilisticVerticesOfCollection() {\n TransitiveClosure transitiveClosure = TransitiveClosure.getDownstreamVerticesForCollection(Arrays.asList(A, B), false);\n assertThat(transitiveClosure.getAllVertices(), containsInAnyOrder(A, C, B));\n }",
"cl... | {
"fields": [
{
"declarator": "ADD_ALL = vertex -> true",
"modifier": "private static final",
"original_string": "private static final Predicate<Vertex> ADD_ALL = vertex -> true;",
"type": "Predicate<Vertex>",
"var_name": "ADD_ALL"
},
{
"declarator": "PROBABILISTIC_OR_O... | {
"body": "public static TransitiveClosure getDownstreamVerticesForCollection(List<Vertex> vertices, boolean includeNonProbabilistic) {\n\n Predicate<Vertex> shouldAdd = includeNonProbabilistic ? ADD_ALL : PROBABILISTIC_OR_OBSERVED_ONLY;\n\n Set<Vertex> downstreamVertices = getVertices(\n ver... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_94 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "network... | {
"body": "@Test\n public void networkReturnsAllWithSameInnerLabel() {\n BooleanVertex a0 = new BernoulliVertex(0.5).setLabel(new VertexLabel(\"root\", \"a\", \"0\"));\n BooleanVertex a1 = new BernoulliVertex(0.5).setLabel(new VertexLabel(\"root\", \"a\", \"1\"));\n BooleanVertex b0 = new Bern... | {
"fields": [
{
"declarator": "vertices",
"modifier": "private final",
"original_string": "private final List<? extends Vertex> vertices;",
"type": "List<? extends Vertex>",
"var_name": "vertices"
},
{
"declarator": "vertexLabels",
"modifier": "private final",
... | {
"body": "public List<Vertex> getVerticesIgnoringNamespace(String innerNamespace) {\n return vertices.stream()\n .filter(v -> v.getLabel() != null && v.getLabel().getUnqualifiedName().equals(innerNamespace))\n .collect(Collectors.toList());\n }",
"class_method_signature": "BayesianN... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_154 | {
"fields": [
{
"declarator": "random",
"modifier": "private",
"original_string": "private KeanuRandom random;",
"type": "KeanuRandom",
"var_name": "random"
},
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_st... | {
"body": "@Test\n public void twoDimensionalDirichletLogProbGraphEqualsABeta() {\n DoubleVertex concentration = ConstantVertex.of(0.4, 1.);\n DirichletVertex vertex = new DirichletVertex(concentration);\n BetaDistribution betaDistribution = new BetaDistribution(0.4, 1.);\n LogProbGraph... | {
"fields": [
{
"declarator": "concentration",
"modifier": "private final",
"original_string": "private final DoubleVertex concentration;",
"type": "DoubleVertex",
"var_name": "concentration"
},
{
"declarator": "CONCENTRATION_NAME = \"concentration\"",
"modifier":... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n DoublePlaceholderVertex xPlaceholder = new DoublePlaceholderVertex(this.getShape());\n DoublePlaceholderVertex concentrationPlaceholder = new DoublePlaceholderVertex(concentration.getShape());\n\n return LogProbGraph.builder()\n ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_292 | {
"fields": [
{
"declarator": "deterministicRule = new DeterministicRule()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public DeterministicRule deterministicRule = new DeterministicRule();",
"type": "DeterministicRule",
"var_name": "deterministicRule"
},
... | {
"body": "@Test\n public void doesRejectOnImpossibleProposal() {\n DoubleVertex A = new UniformVertex(0, 1);\n A.setValue(0.5);\n ProbabilisticModel model = new KeanuProbabilisticModel(A.getConnectedGraph());\n\n MetropolisHastingsStep mhStep = stepFunctionWithConstantProposal(model, -... | {
"fields": [
{
"declarator": "DEFAULT_TEMPERATURE = 1.0",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_TEMPERATURE = 1.0;",
"type": "double",
"var_name": "DEFAULT_TEMPERATURE"
},
{
"declarator": "model",
"modifier": ... | {
"body": "public StepResult step(final Set<Variable> chosenVariables,\n final double logProbabilityBeforeStep) {\n return step(chosenVariables, logProbabilityBeforeStep, DEFAULT_TEMPERATURE);\n }",
"class_method_signature": "MetropolisHastingsStep.step(final Set<Variable> chosen... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_338 | {
"fields": [
{
"declarator": "ROWS = Arrays.asList(\n new Bean(0),\n new Bean(0),\n new Bean(0)\n )",
"modifier": "private static final",
"original_string": "private static final List<Bean> ROWS = Arrays.asList(\n new Bean(0),\n new Bean(0),\n new Be... | {
"body": "@Test\n public void buildSequenceFromData_Contents() {\n Sequence sequence = new SequenceBuilder<Bean>()\n .fromIterator(ROWS.iterator())\n .withFactory((item, bean) -> {\n assertEquals(0, bean.x);\n })\n .build();\n }",
"class_metho... | {
"fields": [
{
"declarator": "PROXY_LABEL_MARKER = \"proxy_for\"",
"modifier": "private static final",
"original_string": "private static final String PROXY_LABEL_MARKER = \"proxy_for\";",
"type": "String",
"var_name": "PROXY_LABEL_MARKER"
},
{
"declarator": "initialSt... | {
"body": "public FromIterator fromIterator(Iterator<T> iterator) {\n return new FromIterator(iterator, 0, initialState, transitionMapping);\n }",
"class_method_signature": "SequenceBuilder.fromIterator(Iterator<T> iterator)",
"constructor": false,
"full_signature": "public FromIterator fromIterator(I... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_343 | {
"fields": [
{
"declarator": "ROWS = Arrays.asList(\n new Bean(0),\n new Bean(0),\n new Bean(0)\n )",
"modifier": "private static final",
"original_string": "private static final List<Bean> ROWS = Arrays.asList(\n new Bean(0),\n new Bean(0),\n new Be... | {
"body": "@Test\n public void youCanCreateASequenceWithACommonParameterFromAnIterator() {\n GaussianVertex commonTheta = new GaussianVertex(0.5, 0.01);\n\n VertexLabel label = new VertexLabel(\"flip\");\n\n Sequence sequence = new SequenceBuilder<Bean>()\n .fromIterator(ROWS.iterat... | {
"fields": [
{
"declarator": "PROXY_LABEL_MARKER = \"proxy_for\"",
"modifier": "private static final",
"original_string": "private static final String PROXY_LABEL_MARKER = \"proxy_for\";",
"type": "String",
"var_name": "PROXY_LABEL_MARKER"
},
{
"declarator": "initialSt... | {
"body": "public FromIterator fromIterator(Iterator<T> iterator) {\n return new FromIterator(iterator, 0, initialState, transitionMapping);\n }",
"class_method_signature": "SequenceBuilder.fromIterator(Iterator<T> iterator)",
"constructor": false,
"full_signature": "public FromIterator fromIterator(I... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_57 | {
"fields": [
{
"declarator": "complexResultVertex",
"modifier": "private static",
"original_string": "private static Vertex complexResultVertex;",
"type": "Vertex",
"var_name": "complexResultVertex"
},
{
"declarator": "complexNetDotSaver",
"modifier": "private st... | {
"body": "@Test\n public void metadataIsWrittenOut() throws IOException {\n Map<String, String> metadata = ImmutableMap.of(\"Author\", \"Jane Doe\", \"Version\", \"V1\");\n complexNetDotSaver.save(outputWriter, false, metadata);\n String expectedOutputWithMetadata = readFileToString(OUTPUT_WI... | {
"fields": [
{
"declarator": "DOT_HEADER = \"digraph BayesianNetwork {\\n\"",
"modifier": "private static final",
"original_string": "private static final String DOT_HEADER = \"digraph BayesianNetwork {\\n\";",
"type": "String",
"var_name": "DOT_HEADER"
},
{
"declarato... | {
"body": "public void save(OutputStream output, boolean saveValues) throws IOException {\n save(output, saveValues, null);\n }",
"class_method_signature": "DotSaver.save(OutputStream output, boolean saveValues)",
"constructor": false,
"full_signature": "public void save(OutputStream output, boolean s... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_206 | {
"fields": [
{
"declarator": "N = 100000",
"modifier": "private",
"original_string": "private int N = 100000;",
"type": "int",
"var_name": "N"
},
{
"declarator": "epsilon = 0.05",
"modifier": "private",
"original_string": "private double epsilon = 0.05;",
... | {
"body": "@Test\n public void logProbGraphLowerBoundIsNotNegativeInfinity() {\n IntegerVertex min = ConstantVertex.of(IntegerTensor.create(lowerBound, new long[]{1, N}));\n IntegerVertex max = ConstantVertex.of(IntegerTensor.create(upperBound, new long[]{1, N}));\n UniformIntVertex testUnifor... | {
"fields": [
{
"declarator": "min",
"modifier": "private",
"original_string": "private IntegerVertex min;",
"type": "IntegerVertex",
"var_name": "min"
},
{
"declarator": "max",
"modifier": "private",
"original_string": "private IntegerVertex max;",
"t... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n IntegerPlaceholderVertex valuePlaceholder = new IntegerPlaceholderVertex(this.getShape());\n IntegerPlaceholderVertex minPlaceholder = new IntegerPlaceholderVertex(min.getShape());\n IntegerPlaceholderVertex maxPlaceholder = new Int... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_178 | {
"fields": [
{
"declarator": "DELTA = 0.0001",
"modifier": "private static final",
"original_string": "private static final double DELTA = 0.0001;",
"type": "double",
"var_name": "DELTA"
},
{
"declarator": "random",
"modifier": "private",
"original_string":... | {
"body": "@Test\n public void logProbGraphIsNegInfWhereXLessThanOne() {\n DoubleVertex rate = ConstantVertex.of(DoubleTensor.scalar(1.0));\n ExponentialVertex tensorExponentialVertex = new ExponentialVertex(rate);\n LogProbGraph logProbGraph = tensorExponentialVertex.logProbGraph();\n ... | {
"fields": [
{
"declarator": "rate",
"modifier": "private final",
"original_string": "private final DoubleVertex rate;",
"type": "DoubleVertex",
"var_name": "rate"
},
{
"declarator": "RATE_NAME = \"rate\"",
"modifier": "private static final",
"original_stri... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceholder = new DoublePlaceholderVertex(this.getShape());\n final DoublePlaceholderVertex ratePlaceholder = new DoublePlaceholderVertex(rate.getShape());\n\n return LogProbGraph.builder()\n ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_197 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/vertices/tensor/number/floating/dbl/DifferentiatorTest.java",
"identifier": "DifferentiatorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void canReverseAutoDiffOfMultiplicationAndLogWithSingleOutputWithRespectToMany() {\n\n DoubleVertex A = new GaussianVertex(0, 1);\n A.setValue(3.0);\n DoubleVertex B = new GaussianVertex(0, 1);\n B.setValue(5.0);\n\n DoubleVertex C = A.times(B);\n ... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/vertices/tensor/number/floating/dbl/Differentiator.java",
"identifier": "Differentiator",
"interfaces": "",
"methods": [
{
"class_method_signature": "Differentiator.forwardModeAutoDiff(V wrt, V... of)",
"constructor": fal... | {
"body": "public static PartialsOf reverseModeAutoDiff(Vertex ofVertex, Set<? extends Vertex> wrt) {\n if (ofVertex.isObserved()) {\n return new PartialsOf(ofVertex, Collections.emptyMap());\n } else {\n return reverseModeAutoDiff(ofVertex, Differentiable.ofSelfWrtSelf(ofVertex.ge... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_314 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "qDist",... | {
"body": "@Test\n public void klDivergenceIsZeroIfPAndQAreIdentical() {\n double identicalProb = Math.log(0.5);\n\n when(qDist.getLogOfMasterP(any(NetworkState.class))).thenReturn(identicalProb);\n NetworkSamples samples = createNetworkSamplesWithOneVertexAndOneSample(identicalProb);\n\n ... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/algorithms/variational/KLDivergence.java",
"identifier": "KLDivergence",
"interfaces": "",
"methods": [
{
"class_method_signature": "KLDivergence.compute(QDistribution q, NetworkSamples p)",
"constructor": false,
"f... | {
"body": "public static double compute(QDistribution q, NetworkSamples p) {\n return compute(p, q::getLogOfMasterP);\n }",
"class_method_signature": "KLDivergence.compute(QDistribution q, NetworkSamples p)",
"constructor": false,
"full_signature": "public static double compute(QDistribution q, Networ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_251 | {
"fields": [
{
"declarator": "A",
"modifier": "private",
"original_string": "private DoubleVertex A;",
"type": "DoubleVertex",
"var_name": "A"
},
{
"declarator": "B",
"modifier": "private",
"original_string": "private DoubleVertex B;",
"type": "Double... | {
"body": "@Test\n public void canConvertGraphToComputationalGraph() {\n DoubleVertex C = A.plus(B);\n DoubleVertex D = C.plus(A);\n DoubleVertex E = C.plus(B);\n DoubleVertex F = D.plus(E);\n F.getValue();\n\n List<Vertex> toposortedGraph = F.getConnectedGraph().stream()\... | {
"fields": [
{
"declarator": "vertexLookup",
"modifier": "private final",
"original_string": "private final Map<VariableReference, Vertex> vertexLookup;",
"type": "Map<VariableReference, Vertex>",
"var_name": "vertexLookup"
},
{
"declarator": "topoSortedGraph",
"... | {
"body": "@Override\n public Map<VariableReference, ?> compute(Map<VariableReference, ?> inputs) {\n\n for (Map.Entry<VariableReference, ?> input : inputs.entrySet()) {\n vertexLookup.get(input.getKey()).setValue(input.getValue());\n }\n\n for (int i = 0; i < topoSortedGraph.size()... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_181 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "DELTA =... | {
"body": "@Test\n public void logProbGraphMatchesKnownLogDensityOfScalar() {\n DoubleVertex alpha = ConstantVertex.of(2.);\n DoubleVertex beta = ConstantVertex.of(3.);\n BetaVertex tensorBetaVertex = new BetaVertex(alpha, beta);\n LogProbGraph logProbGraph = tensorBetaVertex.logProbGra... | {
"fields": [
{
"declarator": "alpha",
"modifier": "private final",
"original_string": "private final DoubleVertex alpha;",
"type": "DoubleVertex",
"var_name": "alpha"
},
{
"declarator": "beta",
"modifier": "private final",
"original_string": "private final ... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceHolder = new DoublePlaceholderVertex(this.getShape());\n final DoublePlaceholderVertex alphaPlaceHolder = new DoublePlaceholderVertex(alpha.getShape());\n final DoublePlaceholderVertex betaPlaceHo... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_302 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/algorithms/particlefiltering/LatentIncrementSortTest.java",
"identifier": "LatentIncrementSortTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void moreComplexGraph() {\n DoubleVertex mu = ConstantVertex.of(0.0);\n DoubleVertex sigma1 = new UniformVertex(1.0, 2.0);\n DoubleVertex g1 = new GaussianVertex(mu, sigma1);\n g1.observe(0.0);\n\n DoubleVertex sigma2 = new UniformVertex(1.0, 2.0);\n ... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/algorithms/particlefiltering/LatentIncrementSort.java",
"identifier": "LatentIncrementSort",
"interfaces": "",
"methods": [
{
"class_method_signature": "LatentIncrementSort.LatentIncrementSort()",
"constructor": true,
... | {
"body": "public static Map<Vertex, Set<Vertex>> sort(Collection<? extends Vertex> vertices) {\n\n Map<Vertex, Set<Vertex>> dependencies = getObservedVertexLatentDependencies(vertices);\n Map<Vertex, Set<Vertex>> dependants = mapDependents(dependencies);\n LinkedHashMap<Vertex, Set<Vertex>> obse... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_16 | {
"fields": [
{
"declarator": "scalar1 = new long[0]",
"modifier": "private",
"original_string": "private long[] scalar1 = new long[0];",
"type": "long[]",
"var_name": "scalar1"
},
{
"declarator": "scalar2 = new long[0]",
"modifier": "private",
"original_str... | {
"body": "@Test\n public void suggestSingleNonScalarShape() {\n long[] shapeProposal = TensorShapeValidation.checkHasOneNonLengthOneShapeOrAllLengthOne(scalar1, twoByTwo1, scalar2);\n assertArrayEquals(new long[]{2, 2}, shapeProposal);\n }",
"class_method_signature": "TensorShapeValidationTest.... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/tensor/TensorShapeValidation.java",
"identifier": "TensorShapeValidation",
"interfaces": "",
"methods": [
{
"class_method_signature": "TensorShapeValidation.TensorShapeValidation()",
"constructor": true,
"full_signa... | {
"body": "public static long[] checkHasOneNonLengthOneShapeOrAllLengthOne(long[]... shapes) {\n Set<TensorShape> nonLengthOneShapes = getNonLengthOneShapes(shapes);\n List<TensorShape> lengthOneShapes = getLengthOneShapesSortedByRank(shapes);\n\n if (nonLengthOneShapes.isEmpty()) {\n ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_247 | {
"fields": [
{
"declarator": "expectedException = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException expectedException = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "expectedException"
}
... | {
"body": "@Test\n public void isNotInNamespaceWithMissingOuter() {\n VertexLabel label = new VertexLabel(\"outer\", \"inner\", \"foo\");\n assertFalse(label.isInNamespace(\"inner\"));\n }",
"class_method_signature": "VertexLabelTest.isNotInNamespaceWithMissingOuter()",
"constructor": false,
... | {
"fields": [
{
"declarator": "NAMESPACE_SEPARATOR = '.'",
"modifier": "private static final",
"original_string": "private static final char NAMESPACE_SEPARATOR = '.';",
"type": "char",
"var_name": "NAMESPACE_SEPARATOR"
},
{
"declarator": "namespace",
"modifier": ... | {
"body": "public boolean isInNamespace(String... namespace) {\n\n if (namespace.length > this.namespace.size()) {\n return false;\n }\n\n for (int i = 0; i < namespace.length; i++) {\n if (!this.namespace.get(i).equals(namespace[i])) {\n return false;\n ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_139 | {
"fields": [
{
"declarator": "values = ImmutableList.of(\n DoubleTensor.create(new double[]{0, 16, 4}, 1, 3),\n DoubleTensor.create(new double[]{-4, -8, 4}, 1, 3),\n DoubleTensor.create(new double[]{8, -4, 12}, 1, 3),\n DoubleTensor.create(new double[]{4, 4, 8}, 1, 3)\n )",
... | {
"body": "@Test\n public void doesCalculateAverage() {\n\n DoubleTensor averages = samples.getAverages();\n\n double[] expectedValues = stats.stream().mapToDouble(SummaryStatistics::getMean).toArray();\n assertThat(averages.asFlatDoubleArray(), equalTo(expectedValues));\n assertThat(av... | {
"fields": [
{
"declarator": "sampleShape[]",
"modifier": "private final",
"original_string": "private final long sampleShape[];",
"type": "long",
"var_name": "sampleShape"
}
],
"file": "keanu-project/src/main/java/io/improbable/keanu/vertices/tensor/number/floating/dbl/Doub... | {
"body": "public DoubleTensor getAverages() {\n return this.samples.stream()\n .reduce(DoubleTensor.zeros(sampleShape), DoubleTensor::plusInPlace)\n .divInPlace((double) samples.size());\n }",
"class_method_signature": "DoubleVertexSamples.getAverages()",
"constructor": false,
"... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_0 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/tensor/TensorShapeTest.java",
"identifier": "TensorShapeTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void canCalculateRowFirstStride() {\n long[] shape = new long[]{2, 3, 7, 4};\n\n assertArrayEquals(new long[]{84, 28, 4, 1}, TensorShape.getRowFirstStride(shape));\n }",
"class_method_signature": "TensorShapeTest.canCalculateRowFirstStride()",
"constructor": false,
... | {
"fields": [
{
"declarator": "shape",
"modifier": "private",
"original_string": "private long[] shape;",
"type": "long[]",
"var_name": "shape"
}
],
"file": "keanu-project/src/main/java/io/improbable/keanu/tensor/TensorShape.java",
"identifier": "TensorShape",
"interfaces... | {
"body": "public static long[] getRowFirstStride(long[] shape) {\n long[] stride = new long[shape.length];\n\n if (shape.length == 0) {\n return stride;\n }\n\n stride[stride.length - 1] = 1;\n\n int buffer = 1;\n for (int i = stride.length - 2; i >= 0; i--) {\n ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_355 | {
"fields": [
{
"declarator": "FIRST_PARAM_NAME_CAMEL_CASE = \"paramTest\"",
"modifier": "private static final",
"original_string": "private static final String FIRST_PARAM_NAME_CAMEL_CASE = \"paramTest\";",
"type": "String",
"var_name": "FIRST_PARAM_NAME_CAMEL_CASE"
},
{
... | {
"body": "@Test\n public void testParamStringMapping() {\n Map<String, String> nameToCommentMap = getNameToCommentMapping(constructorDoc);\n Set<String> keySet = nameToCommentMap.keySet();\n assertThat(keySet, hasItems(FIRST_PARAM_NAME_SNAKE_CASE, SECOND_PARAM_NAME_SNAKE_CASE));\n asse... | {
"fields": [],
"file": "codegen/src/main/java/io/improbable/keanu/codegen/python/ParamStringProcessor.java",
"identifier": "ParamStringProcessor",
"interfaces": "",
"methods": [
{
"class_method_signature": "ParamStringProcessor.getNameToCommentMapping(ConstructorDoc constructorDoc)",
"constru... | {
"body": "Map<String, String> getNameToCommentMapping(ConstructorDoc constructorDoc) {\n ImmutableMap.Builder<String, String> nameToCommentMapping = ImmutableMap.builder();\n Tag[] params = constructorDoc.tags(\"@param\");\n for (Tag param: params) {\n String[] text = param.text().spl... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_210 | {
"fields": [
{
"declarator": "myRule = new DeterministicRule()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public DeterministicRule myRule = new DeterministicRule();",
"type": "DeterministicRule",
"var_name": "myRule"
}
],
"file": "keanu-project/src/tes... | {
"body": "@Test\n public void logProbGraphIsNegativeInfinityOutsideKSupport() {\n DoubleVertex p = ConstantVertex.of(0.5);\n GeometricVertex myVertex = new GeometricVertex(p);\n LogProbGraph logProbGraph = myVertex.logProbGraph();\n LogProbGraphValueFeeder.feedValue(logProbGraph, p, p.... | {
"fields": [
{
"declarator": "p",
"modifier": "private final",
"original_string": "private final DoubleVertex p;",
"type": "DoubleVertex",
"var_name": "p"
},
{
"declarator": "P_NAME = \"p\"",
"modifier": "private final static",
"original_string": "private f... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n IntegerPlaceholderVertex valuePlaceholder = new IntegerPlaceholderVertex(this.getShape());\n DoublePlaceholderVertex pPlaceholder = new DoublePlaceholderVertex(p.getShape());\n\n return LogProbGraph.builder()\n .input(thi... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_41 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
}
],
"file": "keanu-project/src/t... | {
"body": "@Test\n public void canBroadcastOr() {\n BooleanTensor a = BooleanTensor.create(\n true, true, false,\n true, false, true\n ).reshape(2, 3);\n\n BooleanTensor b = BooleanTensor.create(true, false, true);\n\n BooleanTensor actual = a.or(b);\n Boole... | {
"fields": [
{
"declarator": "factory = BooleanBuffer.factory",
"modifier": "private static final",
"original_string": "private static final BooleanBuffer.BooleanArrayWrapperFactory factory = BooleanBuffer.factory;",
"type": "BooleanBuffer.BooleanArrayWrapperFactory",
"var_name": "f... | {
"body": "@Override\n protected JVMBooleanTensor create(BooleanBuffer.PrimitiveBooleanWrapper buffer, long[] shape, long[] stride) {\n return new JVMBooleanTensor(buffer, shape, stride);\n }",
"class_method_signature": "JVMBooleanTensor.create(BooleanBuffer.PrimitiveBooleanWrapper buffer, long[] shape... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_36 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
}
],
"file": "keanu-project/src/t... | {
"body": "@Test\n public void canStackMatrices() {\n BooleanTensor matrixD = BooleanTensor.create(new boolean[]{true, false}, 1, 2);\n assertThat(BooleanTensor.create(true, false, true, false).reshape(2, 1, 2), valuesAndShapesMatch(BooleanTensor.stack(0, matrixD, matrixD)));\n assertThat(Bool... | {
"fields": [
{
"declarator": "factory = BooleanBuffer.factory",
"modifier": "private static final",
"original_string": "private static final BooleanBuffer.BooleanArrayWrapperFactory factory = BooleanBuffer.factory;",
"type": "BooleanBuffer.BooleanArrayWrapperFactory",
"var_name": "f... | {
"body": "@Override\n protected JVMBooleanTensor create(BooleanBuffer.PrimitiveBooleanWrapper buffer, long[] shape, long[] stride) {\n return new JVMBooleanTensor(buffer, shape, stride);\n }",
"class_method_signature": "JVMBooleanTensor.create(BooleanBuffer.PrimitiveBooleanWrapper buffer, long[] shape... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_267 | {
"fields": [
{
"declarator": "random",
"modifier": "private",
"original_string": "private KeanuRandom random;",
"type": "KeanuRandom",
"var_name": "random"
},
{
"declarator": "A",
"modifier": "private",
"original_string": "private DoubleVertex A;",
"t... | {
"body": "@Test\n public void findsMaxAposterioriWithAnnealing() {\n\n BayesianNetwork network = new BayesianNetwork(A.getConnectedGraph());\n network.probeForNonZeroProbability(100, random);\n KeanuProbabilisticModel model = new KeanuProbabilisticModel(network);\n\n NetworkState maxAP... | {
"fields": [
{
"declarator": "DEFAULT_VARIABLE_SELECTOR = SINGLE_VARIABLE_SELECTOR",
"modifier": "private static final",
"original_string": "private static final MHStepVariableSelector DEFAULT_VARIABLE_SELECTOR = SINGLE_VARIABLE_SELECTOR;",
"type": "MHStepVariableSelector",
"var_nam... | {
"body": "public NetworkState getMaxAPosteriori(ProbabilisticModel model,\n int sampleCount) {\n AnnealingSchedule schedule = exponentialSchedule(sampleCount, 2, 0.01);\n return getMaxAPosteriori(model, sampleCount, schedule);\n }",
"class_method_signature"... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_288 | {
"fields": [
{
"declarator": "vertex",
"modifier": "private",
"original_string": "private GaussianVertex vertex;",
"type": "GaussianVertex",
"var_name": "vertex"
},
{
"declarator": "start",
"modifier": "private",
"original_string": "private LeapfrogState st... | {
"body": "@Test\n public void canLogSumExp() {\n\n double a = -0.25;\n double b = 0.5;\n double expected = Math.log(Math.exp(a) + Math.exp(b));\n double actual = Tree.logSumExp(a, b);\n\n assertEquals(expected, actual, 1e-6);\n }",
"class_method_signature": "TreeTest.canLog... | {
"fields": [
{
"declarator": "logProbGradientCalculator",
"modifier": "private final",
"original_string": "private final ProbabilisticModelWithGradient logProbGradientCalculator;",
"type": "ProbabilisticModelWithGradient",
"var_name": "logProbGradientCalculator"
},
{
"... | {
"body": "public static double logSumExp(double a, double b) {\n double max = Math.max(a, b);\n return max + Math.log(Math.exp(a - max) + Math.exp(b - max));\n }",
"class_method_signature": "Tree.logSumExp(double a, double b)",
"constructor": false,
"full_signature": "public static double logS... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_322 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/algorithms/variational/optimizer/nongradient/BOBYQATest.java",
"identifier": "BOBYQATest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void throwsIfLessThanTwoDimensions() {\n DoubleVertex A = new GaussianVertex(0, 1);\n\n OptimizerBounds bounds = new OptimizerBounds();\n bounds.addBound(A.getId(), -1.0, 1.);\n\n NonGradientOptimizer optimizer = Keanu... | {
"fields": [
{
"declarator": "maxEvaluations",
"modifier": "private final",
"original_string": "private final int maxEvaluations;",
"type": "int",
"var_name": "maxEvaluations"
},
{
"declarator": "boundsRange",
"modifier": "private final",
"original_string":... | {
"body": "public static BOBYQABuilder builder() {\n return new BOBYQABuilder();\n }",
"class_method_signature": "BOBYQA.builder()",
"constructor": false,
"full_signature": "public static BOBYQABuilder builder()",
"identifier": "builder",
"invocations": [],
"modifiers": "public static",
"param... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_230 | {
"fields": [
{
"declarator": "expectedException = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException expectedException = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "expectedException"
}
... | {
"body": "@Test\n public void vertexLabelsWithTheSameNameButDifferentNamespacesAreNotEqual() {\n VertexLabel foo1 = new VertexLabel(\"namespace1\", \"foo\");\n VertexLabel foo2 = new VertexLabel(\"namespace2\", \"foo\");\n assertThat(foo1, not(equalTo(foo2)));\n assertThat(foo1.hashCod... | {
"fields": [
{
"declarator": "NAMESPACE_SEPARATOR = '.'",
"modifier": "private static final",
"original_string": "private static final char NAMESPACE_SEPARATOR = '.';",
"type": "char",
"var_name": "NAMESPACE_SEPARATOR"
},
{
"declarator": "namespace",
"modifier": ... | {
"body": "@Override\n public int hashCode() {\n\n return Objects.hash(namespace, name);\n }",
"class_method_signature": "VertexLabel.hashCode()",
"constructor": false,
"full_signature": "@Override public int hashCode()",
"identifier": "hashCode",
"invocations": [
"hash"
],
"modifiers":... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_61 | {
"fields": [
{
"declarator": "progressUpdateCall",
"modifier": "private",
"original_string": "private AtomicReference<Runnable> progressUpdateCall;",
"type": "AtomicReference<Runnable>",
"var_name": "progressUpdateCall"
},
{
"declarator": "statusBar",
"modifier":... | {
"body": "@Test\n public void doesLimitProgressTo100Percent() {\n StatusBar.enable();\n\n percentageComponent.progress(-0.7);\n progressUpdateCall.get().run();\n percentageComponent.progress(1.5);\n statusBar.finish();\n\n String result = getResultWithNewLinesInsteadOfCR(... | {
"fields": [
{
"declarator": "percentage = new AtomicDouble(0.0)",
"modifier": "private",
"original_string": "private AtomicDouble percentage = new AtomicDouble(0.0);",
"type": "AtomicDouble",
"var_name": "percentage"
}
],
"file": "keanu-project/src/main/java/io/improbable/k... | {
"body": "public void progress(double percentage) {\n this.percentage.set(percentage);\n }",
"class_method_signature": "PercentageComponent.progress(double percentage)",
"constructor": false,
"full_signature": "public void progress(double percentage)",
"identifier": "progress",
"invocations": [
... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_119 | {
"fields": [
{
"declarator": "epsilon = 0.01",
"modifier": "private static",
"original_string": "private static double epsilon = 0.01;",
"type": "double",
"var_name": "epsilon"
},
{
"declarator": "N = 100000",
"modifier": "private static",
"original_string"... | {
"body": "@Test\n public void cantCreateCategoricalVertexIfShapeIsSpecifiedAndNonScalarShapeDoNotMatch() {\n DoubleTensor t2 = DoubleTensor.create(0.5, new long[]{4, 4, 4});\n\n Map<TestEnum, DoubleVertex> selectableValues = new LinkedHashMap<>();\n selectableValues.put(TestEnum.A, ConstantVe... | {
"fields": [
{
"declarator": "selectableValues",
"modifier": "private final",
"original_string": "private final Map<CATEGORY, DoubleVertex> selectableValues;",
"type": "Map<CATEGORY, DoubleVertex>",
"var_name": "selectableValues"
}
],
"file": "keanu-project/src/main/java/io/... | {
"body": "public static <CATEGORY> CategoricalVertex<CATEGORY> of(\n Map<CATEGORY, Double> selectableValues\n ) {\n return new CategoricalVertex<>(toDoubleVertices(selectableValues));\n }",
"class_method_signature": "CategoricalVertex.of(\n Map<CATEGORY, Double> selectableValues\n )",... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_77 | {
"fields": [
{
"declarator": "samples",
"modifier": "private",
"original_string": "private NetworkSamples samples;",
"type": "NetworkSamples",
"var_name": "samples"
},
{
"declarator": "rowTensors = new ArrayList<>()",
"modifier": "private",
"original_string... | {
"body": "@Test\n public void writeRowOfScalarsToCsvWithCustomDelimiter() throws IOException {\n File file = WriteCsv.asColumns(scalarTensors).withSeparator('\\t').toFile(File.createTempFile(\"test\", \".csv\"));\n\n CsvReader reader = ReadCsv.fromFile(file).expectHeader(false).withDelimiter(\"\\t\"... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/util/csv/WriteCsv.java",
"identifier": "WriteCsv",
"interfaces": "",
"methods": [
{
"class_method_signature": "WriteCsv.asSamples(NetworkSamples samples, List<? extends Vertex<? extends Tensor, ?>> vertices)",
"constructo... | {
"body": "public static ColumnWriter asColumns(List<? extends Vertex<? extends Tensor, ?>> vertices) {\n return new ColumnWriter(vertices);\n }",
"class_method_signature": "WriteCsv.asColumns(List<? extends Vertex<? extends Tensor, ?>> vertices)",
"constructor": false,
"full_signature": "public stati... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_226 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/vertices/tensor/ReshapeVertexTest.java",
"identifier": "ReshapeVertexTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void reshapeVertex() {\n DoubleVertex a = new UniformVertex(0, 10);\n a.setValue(DoubleTensor.create(new double[]{1, 2, 3, 4}, 2, 2));\n\n DoubleVertex reshapeVertex = a.reshape(4, 1);\n reshapeVertex.getValue();\n\n Assert.assertArrayEquals(new long[]{4... | {
"fields": [
{
"declarator": "SHAPE_NAME = \"proposedShape\"",
"modifier": "private static final",
"original_string": "private static final String SHAPE_NAME = \"proposedShape\";",
"type": "String",
"var_name": "SHAPE_NAME"
}
],
"file": "keanu-project/src/main/java/io/improb... | {
"body": "@ExportVertexToPythonBindings\n public ReshapeVertex(@LoadVertexParam(INPUT_NAME) TensorVertex<T, TENSOR, VERTEX> inputVertex,\n @LoadVertexParam(SHAPE_NAME) long... proposedShape) {\n super(proposedShape, inputVertex, inputVertex.ofType());\n }",
"class_method_signat... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_98 | {
"fields": [
{
"declarator": "Amu",
"modifier": "",
"original_string": "DoubleVertex Amu;",
"type": "DoubleVertex",
"var_name": "Amu"
},
{
"declarator": "Asigma",
"modifier": "",
"original_string": "DoubleVertex Asigma;",
"type": "DoubleVertex",
... | {
"body": "@Test\n public void doesGetDownstreamProbabilisticVertices() {\n TransitiveClosure transitiveClosure = TransitiveClosure.getDownstreamVertices(A, false);\n assertThat(transitiveClosure.getAllVertices(), containsInAnyOrder(A, C));\n }",
"class_method_signature": "TransitiveClosureTest.... | {
"fields": [
{
"declarator": "ADD_ALL = vertex -> true",
"modifier": "private static final",
"original_string": "private static final Predicate<Vertex> ADD_ALL = vertex -> true;",
"type": "Predicate<Vertex>",
"var_name": "ADD_ALL"
},
{
"declarator": "PROBABILISTIC_OR_O... | {
"body": "public static TransitiveClosure getDownstreamVertices(Vertex<?, ?> aVertex, boolean includeNonProbabilistic) {\n return getDownstreamVerticesForCollection(Collections.singletonList(aVertex), includeNonProbabilistic);\n }",
"class_method_signature": "TransitiveClosure.getDownstreamVertices(Verte... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_271 | {
"fields": [
{
"declarator": "AReference",
"modifier": "private",
"original_string": "private VariableReference AReference;",
"type": "VariableReference",
"var_name": "AReference"
},
{
"declarator": "BReference",
"modifier": "private",
"original_string": "p... | {
"body": "@Test\n public void canDivideAMapOfValues() {\n\n Map<VariableReference, DoubleTensor> result = VariableValues.divide(left, 2.0);\n\n DoubleTensor expectedA = DoubleTensor.create(0.5, 1.0);\n DoubleTensor expectedB = DoubleTensor.create(1.5, 2.0);\n\n assertEquals(expectedA, ... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/algorithms/mcmc/nuts/VariableValues.java",
"identifier": "VariableValues",
"interfaces": "",
"methods": [
{
"class_method_signature": "VariableValues.VariableValues()",
"constructor": true,
"full_signature": "privat... | {
"body": "public static Map<VariableReference, DoubleTensor> divide(Map<VariableReference, DoubleTensor> left, double right) {\n Map<VariableReference, DoubleTensor> result = new HashMap<>();\n for (VariableReference v : left.keySet()) {\n result.put(v, left.get(v).div(right));\n }\n ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_20 | {
"fields": [
{
"declarator": "scalar1 = new long[0]",
"modifier": "private",
"original_string": "private long[] scalar1 = new long[0];",
"type": "long[]",
"var_name": "scalar1"
},
{
"declarator": "scalar2 = new long[0]",
"modifier": "private",
"original_str... | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void rejectsMultipleNonScalars() {\n TensorShapeValidation.checkHasOneNonLengthOneShapeOrAllLengthOne(scalar1, twoByThree, twoByTwo1);\n }",
"class_method_signature": "TensorShapeValidationTest.rejectsMultipleNonScalars()",
"constru... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/tensor/TensorShapeValidation.java",
"identifier": "TensorShapeValidation",
"interfaces": "",
"methods": [
{
"class_method_signature": "TensorShapeValidation.TensorShapeValidation()",
"constructor": true,
"full_signa... | {
"body": "public static long[] checkHasOneNonLengthOneShapeOrAllLengthOne(long[]... shapes) {\n Set<TensorShape> nonLengthOneShapes = getNonLengthOneShapes(shapes);\n List<TensorShape> lengthOneShapes = getLengthOneShapesSortedByRank(shapes);\n\n if (nonLengthOneShapes.isEmpty()) {\n ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_334 | {
"fields": [
{
"declarator": "expectedException = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException expectedException = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "expectedException"
},
... | {
"body": "@Test\n public void itThrowsIfYouAddAVertexWithNoLabel() {\n expectedException.expect(SequenceConstructionException.class);\n expectedException.expectMessage(endsWith(\" must contain a label in order to be added to a sequence item\"));\n item.add(ConstantVertex.of(1.));\n }",
"... | {
"fields": [
{
"declarator": "NAME_PREFIX = \"Sequence_Item_\"",
"modifier": "private static final",
"original_string": "private static final String NAME_PREFIX = \"Sequence_Item_\";",
"type": "String",
"var_name": "NAME_PREFIX"
},
{
"declarator": "NAME_REGEX = Pattern... | {
"body": "public <T extends Vertex<?, ?>> T add(T v) {\n return add(v.getLabel(), v);\n }",
"class_method_signature": "SequenceItem.add(T v)",
"constructor": false,
"full_signature": "public T add(T v)",
"identifier": "add",
"invocations": [
"add",
"getLabel"
],
"modifiers": "public",... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_158 | {
"fields": [
{
"declarator": "random",
"modifier": "private",
"original_string": "private KeanuRandom random;",
"type": "KeanuRandom",
"var_name": "random"
},
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_st... | {
"body": "@Test\n public void dLogProbMatchesFiniteDifferenceCalculationFordPdconcentration() {\n UniformVertex concentrationHyperParam = new UniformVertex(1.5, 3.0);\n DoubleTensor hyperParamValue = DoubleTensor.create(new double[]{7, 7}, 1, 2);\n concentrationHyperParam.setValue(hyperParamV... | {
"fields": [
{
"declarator": "concentration",
"modifier": "private final",
"original_string": "private final DoubleVertex concentration;",
"type": "DoubleVertex",
"var_name": "concentration"
},
{
"declarator": "CONCENTRATION_NAME = \"concentration\"",
"modifier":... | {
"body": "@Override\n public double logProb(DoubleTensor value) {\n DoubleTensor concentrationValues = concentration.getValue();\n DoubleTensor logPdfs = Dirichlet.withParameters(concentrationValues).logProb(value);\n return logPdfs.sumNumber();\n }",
"class_method_signature": "Dirichlet... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_123 | {
"fields": [
{
"declarator": "epsilon = 0.01",
"modifier": "private static",
"original_string": "private static double epsilon = 0.01;",
"type": "double",
"var_name": "epsilon"
},
{
"declarator": "N = 100000",
"modifier": "private static",
"original_string"... | {
"body": "@Category(Slow.class)\n @Test\n public void fourValuesEquallyWeightedSummingToFour() {\n\n Map<TestEnum, DoubleVertex> selectableValues = new LinkedHashMap<>();\n selectableValues.put(TestEnum.A, ConstantVertex.of(1.0));\n selectableValues.put(TestEnum.B, ConstantVertex.of(1.0));... | {
"fields": [
{
"declarator": "selectableValues",
"modifier": "private final",
"original_string": "private final Map<CATEGORY, DoubleVertex> selectableValues;",
"type": "Map<CATEGORY, DoubleVertex>",
"var_name": "selectableValues"
}
],
"file": "keanu-project/src/main/java/io/... | {
"body": "public static <CATEGORY> CategoricalVertex<CATEGORY> of(\n Map<CATEGORY, Double> selectableValues\n ) {\n return new CategoricalVertex<>(toDoubleVertices(selectableValues));\n }",
"class_method_signature": "CategoricalVertex.of(\n Map<CATEGORY, Double> selectableValues\n )",... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_318 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "qDist",... | {
"body": "@Test\n public void returnsLargerKLDivergenceIfTheLocationOfQIsFurtherFromP_QIsProbabilisticDouble() {\n GaussianVertex v1 = new GaussianVertex(0., 1.);\n ConstantDoubleVertex v2 = new ConstantDoubleVertex(0.1);\n DoubleVertex v3 = v1.plus(v2);\n\n KeanuProbabilisticModel mod... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/algorithms/variational/KLDivergence.java",
"identifier": "KLDivergence",
"interfaces": "",
"methods": [
{
"class_method_signature": "KLDivergence.compute(QDistribution q, NetworkSamples p)",
"constructor": false,
"f... | {
"body": "public static double compute(QDistribution q, NetworkSamples p) {\n return compute(p, q::getLogOfMasterP);\n }",
"class_method_signature": "KLDivergence.compute(QDistribution q, NetworkSamples p)",
"constructor": false,
"full_signature": "public static double compute(QDistribution q, Networ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_174 | {
"fields": [
{
"declarator": "VERTEX_INCREMENT = 0.1",
"modifier": "private final",
"original_string": "private final double VERTEX_INCREMENT = 0.1;",
"type": "double",
"var_name": "VERTEX_INCREMENT"
},
{
"declarator": "random",
"modifier": "private",
"orig... | {
"body": "@Test\n public void logProbGraphIsNegInfIfScaleIsNotPositive() {\n DoubleVertex location = ConstantVertex.of(1., 1.);\n DoubleVertex scale = ConstantVertex.of(-3., 3.);\n ParetoVertex paretoVertex = new ParetoVertex(location, scale);\n LogProbGraph logProbGraph = paretoVertex... | {
"fields": [
{
"declarator": "scale",
"modifier": "private final",
"original_string": "private final DoubleVertex scale;",
"type": "DoubleVertex",
"var_name": "scale"
},
{
"declarator": "location",
"modifier": "private final",
"original_string": "private fi... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceholder = new DoublePlaceholderVertex(this.getShape());\n final DoublePlaceholderVertex locationPlaceholder = new DoublePlaceholderVertex(location.getShape());\n final DoublePlaceholderVertex scale... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_162 | {
"fields": [
{
"declarator": "DELTA = 0.0001",
"modifier": "private static final",
"original_string": "private static final double DELTA = 0.0001;",
"type": "double",
"var_name": "DELTA"
},
{
"declarator": "random",
"modifier": "private",
"original_string":... | {
"body": "@Test\n public void logProbGraphMatchesKnownLogDensityOfNegativeScalar() {\n DoubleVertex sigma = ConstantVertex.of(1.);\n HalfGaussianVertex halfGaussianVertex = new HalfGaussianVertex(sigma);\n LogProbGraph logProbGraph = halfGaussianVertex.logProbGraph();\n LogProbGraphVal... | {
"fields": [
{
"declarator": "MU_ZERO = 0.0",
"modifier": "private static final",
"original_string": "private static final double MU_ZERO = 0.0;",
"type": "double",
"var_name": "MU_ZERO"
},
{
"declarator": "LOG_TWO = Math.log(2)",
"modifier": "private static fina... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceholder = new DoublePlaceholderVertex(this.getShape());\n final DoublePlaceholderVertex muPlaceholder = new DoublePlaceholderVertex(getMu().getShape());\n final DoublePlaceholderVertex sigmaPlaceho... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_135 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
}
],
"file": "keanu-project/src/t... | {
"body": "@Test\n public void canConcatenateSimpleAutoDiff() {\n UniformVertex a = new UniformVertex(0, 10);\n a.setValue(DoubleTensor.create(new double[]{5, 6, 7, 8}, 2, 2));\n\n UniformVertex b = new UniformVertex(0, 10);\n b.setValue(DoubleTensor.create(new double[]{10, 15, 20, 25},... | {
"fields": [
{
"declarator": "DIMENSION_NAME = \"dimension\"",
"modifier": "private final static",
"original_string": "private final static String DIMENSION_NAME = \"dimension\";",
"type": "String",
"var_name": "DIMENSION_NAME"
},
{
"declarator": "OPERANDS_NAME = \"ope... | {
"body": "public static ForwardModePartialDerivative concat(List<ForwardModePartialDerivative> partialsOfOperands,\n List<DoubleTensor> operandValues,\n int dimension) {\n\n long[] wrtShape = null;\n ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_352 | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(TextMessagingTest.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(TextMessagingTest.class);",
"type": "Logger",
"var_name": "log"
}
],
"file... | {
"body": "@Test\n public void testWhenTextMessagingScenarioIsRunThenSwitchPointIsAccurate() {\n TextMessaging.TextMessagingResults output = TextMessaging.run();\n\n log.info(\"Switch Point Mode \" + output.switchPointMode);\n log.info(\"Early Rate Mean \" + output.earlyRateMean);\n log... | {
"fields": [],
"file": "keanu-examples/bayesianMethodsForHackers/src/main/java/com/examples/TextMessaging.java",
"identifier": "TextMessaging",
"interfaces": "",
"methods": [
{
"class_method_signature": "TextMessaging.run()",
"constructor": false,
"full_signature": "public static TextMe... | {
"body": "public static TextMessagingResults run() {\n\n final TextMessagingData data = ReadCsv.fromResources(\"text_messaging_data.csv\")\n .asVectorizedColumnsDefinedBy(TextMessagingData.class)\n .load();\n\n final int numberOfDays = (int) data.numberOfMessages.getLength();\n\n ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_46 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
}
],
"file": "keanu-project/src/t... | {
"body": "@Test\n public void canDiagFromMatrix() {\n BooleanTensor actual = BooleanTensor.create(new boolean[]{true, false, false, false, true, false, false, false, false}, 3, 3).diagPart();\n BooleanTensor expected = BooleanTensor.create(true, true, false);\n\n Assert.assertEquals(expected,... | {
"fields": [
{
"declarator": "factory = BooleanBuffer.factory",
"modifier": "private static final",
"original_string": "private static final BooleanBuffer.BooleanArrayWrapperFactory factory = BooleanBuffer.factory;",
"type": "BooleanBuffer.BooleanArrayWrapperFactory",
"var_name": "f... | {
"body": "@Override\n protected JVMBooleanTensor create(BooleanBuffer.PrimitiveBooleanWrapper buffer, long[] shape, long[] stride) {\n return new JVMBooleanTensor(buffer, shape, stride);\n }",
"class_method_signature": "JVMBooleanTensor.create(BooleanBuffer.PrimitiveBooleanWrapper buffer, long[] shape... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_217 | {
"fields": [
{
"declarator": "rule = new DeterministicRule()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public DeterministicRule rule = new DeterministicRule();",
"type": "DeterministicRule",
"var_name": "rule"
},
{
"declarator": "thrown = Expect... | {
"body": "@Test\n public void itAllowsTheLogProbStateToSumToN() {\n IntegerVertex n = ConstantVertex.of(10);\n DoubleVertex p = ConstantVertex.of(DoubleTensor.create(0.2, 0.8));\n MultinomialVertex multinomial = new MultinomialVertex(n, p);\n multinomial.setValidationEnabled(true);\n ... | {
"fields": [
{
"declarator": "p",
"modifier": "private final",
"original_string": "private final DoubleVertex p;",
"type": "DoubleVertex",
"var_name": "p"
},
{
"declarator": "n",
"modifier": "private final",
"original_string": "private final IntegerVertex n... | {
"body": "@Override\n public double logProb(IntegerTensor x) {\n return Multinomial.withParameters(n.getValue(), p.getValue(), validationEnabled).logProb(x).sumNumber();\n }",
"class_method_signature": "MultinomialVertex.logProb(IntegerTensor x)",
"constructor": false,
"full_signature": "@Override... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_7 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/tensor/TensorShapeTest.java",
"identifier": "TensorShapeTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void throwsIfFlatIndexOverflowsShape() {\n long[] shapeIndices = TensorShape.getShapeIndices(new long[]{5, 4}, new long[]{4, 1}, 20);\n }",
"class_method_signature": "TensorShapeTest.throwsIfFlatIndexOverflowsShape()",
"constructor"... | {
"fields": [
{
"declarator": "shape",
"modifier": "private",
"original_string": "private long[] shape;",
"type": "long[]",
"var_name": "shape"
}
],
"file": "keanu-project/src/main/java/io/improbable/keanu/tensor/TensorShape.java",
"identifier": "TensorShape",
"interfaces... | {
"body": "public static long[] getShapeIndices(long[] shape, long[] stride, long flatIndex) {\n Preconditions.checkArgument(flatIndex >= 0, \"Flat index must be >= 0 and less than the length of the shape\");\n long[] shapeIndices = new long[stride.length];\n long remainder = flatIndex;\n ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_305 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "samples... | {
"body": "@Test\n public void doesNothingOnDropZero() {\n assertEquals(samples, samples.drop(0));\n }",
"class_method_signature": "NetworkSamplesTest.doesNothingOnDropZero()",
"constructor": false,
"full_signature": "@Test public void doesNothingOnDropZero()",
"identifier": "doesNothingOnDropZer... | {
"fields": [
{
"declarator": "samplesByVariable",
"modifier": "private final",
"original_string": "private final Map<VariableReference, ? extends List> samplesByVariable;",
"type": "Map<VariableReference, ? extends List>",
"var_name": "samplesByVariable"
},
{
"declarat... | {
"body": "public NetworkSamples drop(int dropCount) {\n Preconditions.checkArgument(dropCount >= 0, \"Cannot drop %s samples. Drop count must be positive.\", dropCount);\n if (dropCount == 0) {\n return this;\n }\n\n final Map<VariableReference, List<?>> withSamplesDropped = sa... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_240 | {
"fields": [
{
"declarator": "expectedException = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException expectedException = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "expectedException"
}
... | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void itThrowsIfYouDiminishTheNamespaceButThereIsNone() {\n VertexLabel foo = new VertexLabel(\"foo\");\n foo.withoutOuterNamespace();\n }",
"class_method_signature": "VertexLabelTest.itThrowsIfYouDiminishTheNamespaceButThereIsN... | {
"fields": [
{
"declarator": "NAMESPACE_SEPARATOR = '.'",
"modifier": "private static final",
"original_string": "private static final char NAMESPACE_SEPARATOR = '.';",
"type": "char",
"var_name": "NAMESPACE_SEPARATOR"
},
{
"declarator": "namespace",
"modifier": ... | {
"body": "public VertexLabel withoutOuterNamespace() {\n List<String> reducedNamespace = namespace.subList(1, namespace.size());\n return new VertexLabel(reducedNamespace, this.name);\n }",
"class_method_signature": "VertexLabel.withoutOuterNamespace()",
"constructor": false,
"full_signature":... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_11 | {
"fields": [
{
"declarator": "expectedException = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException expectedException = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "expectedException"
},
... | {
"body": "@Test\n public void youCanGetTheMeanOfY() {\n assertThat(stats.yMean(), equalTo(yStats.getMean()));\n }",
"class_method_signature": "BivariateDataStatisticsCalculatorTest.youCanGetTheMeanOfY()",
"constructor": false,
"full_signature": "@Test public void youCanGetTheMeanOfY()",
"identif... | {
"fields": [
{
"declarator": "xData",
"modifier": "private final",
"original_string": "private final DoubleTensor xData;",
"type": "DoubleTensor",
"var_name": "xData"
},
{
"declarator": "yData",
"modifier": "private final",
"original_string": "private final... | {
"body": "public double yMean() {\n return yData.mean().scalar();\n }",
"class_method_signature": "BivariateDataStatisticsCalculator.yMean()",
"constructor": false,
"full_signature": "public double yMean()",
"identifier": "yMean",
"invocations": [
"scalar",
"mean"
],
"modifiers": "pub... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_169 | {
"fields": [
{
"declarator": "DELTA = 0.0001",
"modifier": "private static final",
"original_string": "private static final double DELTA = 0.0001;",
"type": "double",
"var_name": "DELTA"
},
{
"declarator": "random",
"modifier": "private",
"original_string":... | {
"body": "@Test\n public void logProbGraphMatchesKnownLogDensityOfScalar() {\n DoubleVertex mu = ConstantVertex.of(0.5);\n DoubleVertex s = ConstantVertex.of(1.5);\n LogisticVertex logisticVertex = new LogisticVertex(mu, s);\n LogProbGraph logProbGraph = logisticVertex.logProbGraph();\... | {
"fields": [
{
"declarator": "mu",
"modifier": "private final",
"original_string": "private final DoubleVertex mu;",
"type": "DoubleVertex",
"var_name": "mu"
},
{
"declarator": "s",
"modifier": "private final",
"original_string": "private final DoubleVertex... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceholder = new DoublePlaceholderVertex(this.getShape());\n final DoublePlaceholderVertex muPlaceholder = new DoublePlaceholderVertex(mu.getShape());\n final DoublePlaceholderVertex sPlaceholder = ne... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_186 | {
"fields": [
{
"declarator": "DELTA = 0.0001",
"modifier": "private static final",
"original_string": "private static final double DELTA = 0.0001;",
"type": "double",
"var_name": "DELTA"
},
{
"declarator": "random",
"modifier": "private",
"original_string":... | {
"body": "@Test\n public void logProbGraphMatchesKnownLogDensityOfNegativeVector() {\n\n DoubleVertex scale = ConstantVertex.of(1.);\n HalfCauchyVertex halfCauchyVertex = new HalfCauchyVertex(scale);\n LogProbGraph logProbGraph = halfCauchyVertex.logProbGraph();\n LogProbGraphValueFeed... | {
"fields": [
{
"declarator": "LOC_ZERO = 0.0",
"modifier": "private static final",
"original_string": "private static final double LOC_ZERO = 0.0;",
"type": "double",
"var_name": "LOC_ZERO"
},
{
"declarator": "LOG_TWO = Math.log(2)",
"modifier": "private static f... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceholder = new DoublePlaceholderVertex(this.getShape());\n final DoublePlaceholderVertex locationPlaceholder = new DoublePlaceholderVertex(getLocation().getShape());\n final DoublePlaceholderVertex ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_313 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/algorithms/graphtraversal/MarkovBlanketTest.java",
"identifier": "MarkovBlanketTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void findBlanketFromDoubleDiamondGraph() {\n\n DoubleVertex A = new GaussianVertex(5.0, 1.0);\n DoubleVertex B = new GaussianVertex(A, 1.0);\n DoubleVertex C = new GaussianVertex(A, 1.0);\n DoubleVertex D = new GaussianVertex(B, C);\n DoubleVertex E = ne... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/algorithms/graphtraversal/MarkovBlanket.java",
"identifier": "MarkovBlanket",
"interfaces": "",
"methods": [
{
"class_method_signature": "MarkovBlanket.MarkovBlanket()",
"constructor": true,
"full_signature": "priva... | {
"body": "public static Set<Vertex> get(Vertex<?, ?> aVertex) {\n\n LambdaSection parents = LambdaSection.getUpstreamLambdaSection(aVertex, false);\n LambdaSection children = LambdaSection.getDownstreamLambdaSection(aVertex, false);\n Set<Vertex> childrensParents = getUpstreamProbabilisticVertic... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_256 | {
"fields": [
{
"declarator": "proposal",
"modifier": "public",
"original_string": "public Proposal proposal;",
"type": "Proposal",
"var_name": "proposal"
},
{
"declarator": "currentStateForVertex1 = DoubleTensor.create(4.2, 4.7)",
"modifier": "private static fina... | {
"body": "@Test\n public void theLogProbAtFromIsMultivariateGaussian() {\n double logProb = proposalDistribution.logProbAtFromGivenTo(proposal);\n DoubleTensor mu = DoubleTensor.concat(proposedStateForVertex1, proposedStateForVertex2);\n DoubleTensor cov = DoubleTensor.concat(sigmaForVertex1,... | {
"fields": [
{
"declarator": "sigmas",
"modifier": "private final",
"original_string": "private final Map<? extends Variable, DoubleTensor> sigmas;",
"type": "Map<? extends Variable, DoubleTensor>",
"var_name": "sigmas"
},
{
"declarator": "proposalNotifier",
"mod... | {
"body": "@Override\n public <T> double logProb(Probabilistic<T> variable, T ofValue, T givenValue) {\n if (!(ofValue instanceof DoubleTensor)) {\n throw new ClassCastException(\"Only DoubleTensor values are supported - not \" + ofValue.getClass().getSimpleName());\n }\n if (!sigma... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_190 | {
"fields": [
{
"declarator": "random",
"modifier": "private",
"original_string": "private KeanuRandom random;",
"type": "KeanuRandom",
"var_name": "random"
},
{
"declarator": "DELTA = 0.0001",
"modifier": "private static final",
"original_string": "private ... | {
"body": "@Test\n public void logProbGraphMatchesKnownLogDensityOfVector() {\n DoubleVertex theta = ConstantVertex.of(1.0, 1.0);\n DoubleVertex k = ConstantVertex.of(5., 5.);\n GammaVertex tensorGamma = new GammaVertex(theta, k);\n LogProbGraph logProbGraph = tensorGamma.logProbGraph()... | {
"fields": [
{
"declarator": "theta",
"modifier": "private final",
"original_string": "private final DoubleVertex theta;",
"type": "DoubleVertex",
"var_name": "theta"
},
{
"declarator": "k",
"modifier": "private final",
"original_string": "private final Dou... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceholder = new DoublePlaceholderVertex(this.getShape());\n final DoublePlaceholderVertex thetaPlaceholder = new DoublePlaceholderVertex(theta.getShape());\n final DoublePlaceholderVertex kPlaceholde... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_344 | {
"fields": [
{
"declarator": "random",
"modifier": "private",
"original_string": "private KeanuRandom random;",
"type": "KeanuRandom",
"var_name": "random"
}
],
"file": "keanu-project/src/test/java/io/improbable/keanu/KeanuRandomTest.java",
"identifier": "KeanuRandomTest",... | {
"body": "@Test\n public void canSampleGaussianScalar() {\n assertEquals(0, random.nextGaussian(new long[0]).getRank());\n assertEquals(1, random.nextGaussian(new long[]{1}).getRank());\n assertEquals(2, random.nextGaussian(new long[]{1, 1}).getRank());\n assertEquals(2, random.nextGau... | {
"fields": [
{
"declarator": "DEFAULT_RANDOM = new AtomicReference<>()",
"modifier": "private static final",
"original_string": "private static final AtomicReference<KeanuRandom> DEFAULT_RANDOM = new AtomicReference<>();",
"type": "AtomicReference<KeanuRandom>",
"var_name": "DEFAULT... | {
"body": "public DoubleTensor nextGaussian(long[] shape) {\n final int length = getLengthAsInt(shape);\n if (length > 1) {\n return DoubleTensor.create(nextGaussianBuffer(length), shape);\n } else {\n return DoubleTensor.create(nextGaussian(), shape);\n }\n }",
... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_201 | {
"fields": [
{
"declarator": "random",
"modifier": "private",
"original_string": "private KeanuRandom random;",
"type": "KeanuRandom",
"var_name": "random"
}
],
"file": "keanu-project/src/test/java/io/improbable/keanu/vertices/tensor/number/fixed/intgr/probabilistic/Binomial... | {
"body": "@Test\n public void logProbGraphIsCorrectForKnownScalarValues() {\n\n DoubleVertex p = ConstantVertex.of(0.25);\n IntegerVertex n = ConstantVertex.of(5);\n BinomialVertex binomialVertex = new BinomialVertex(p, n);\n LogProbGraph logProbGraph = binomialVertex.logProbGraph();\n... | {
"fields": [
{
"declarator": "p",
"modifier": "private final",
"original_string": "private final DoubleVertex p;",
"type": "DoubleVertex",
"var_name": "p"
},
{
"declarator": "n",
"modifier": "private final",
"original_string": "private final IntegerVertex n... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n IntegerPlaceholderVertex kPlaceholder = new IntegerPlaceholderVertex(this.getShape());\n DoublePlaceholderVertex pPlaceholder = new DoublePlaceholderVertex(p.getShape());\n IntegerPlaceholderVertex nPlaceholder = new IntegerPlacehol... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_50 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/tensor/generic/GenericTensorTest.java",
"identifier": "GenericTensorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void canBroadcastToShape() {\n GenericTensor<String> a = GenericTensor.create(\n \"a\", \"b\", \"c\"\n ).reshape(3);\n\n GenericTensor<String> expectedByRow = GenericTensor.create(\n \"a\", \"b\", \"c\",\n \"a\", \"b\", \"c\",\n ... | {
"fields": [
{
"declarator": "factory = new GenericBuffer.GenericArrayWrapperFactory()",
"modifier": "private static final",
"original_string": "private static final GenericBuffer.GenericArrayWrapperFactory factory = new GenericBuffer.GenericArrayWrapperFactory();",
"type": "GenericBuffer... | {
"body": "public static <T> GenericTensor<T> create(T... data) {\n return create(data, new long[]{data.length});\n }",
"class_method_signature": "GenericTensor.create(T... data)",
"constructor": false,
"full_signature": "public static GenericTensor<T> create(T... data)",
"identifier": "create",
"... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_128 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/vertices/tensor/number/floating/dbl/nonprobabilistic/diff/LogProbGradientCalculatorTest.java",
"identifier": "LogProbGradientCalculatorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void canFindGradientOfSingleVariateGaussianWrtSelf() {\n GaussianVertex A = new GaussianVertex(0, 1);\n A.setValue(0.5);\n\n LogProbGradientCalculator calculator = new LogProbGradientCalculator(ImmutableList.of(A), ImmutableList.of(A));\n\n Map<VertexId, Double... | {
"fields": [
{
"declarator": "logProbOfVertices",
"modifier": "private final",
"original_string": "private final Set<Vertex> logProbOfVertices;",
"type": "Set<Vertex>",
"var_name": "logProbOfVertices"
},
{
"declarator": "wrtVertices",
"modifier": "private final",... | {
"body": "public Map<VertexId, DoubleTensor> getJointLogProbGradientWrtLatents() {\n LogProbGradients totalLogProbGradients = new LogProbGradients();\n\n for (final Vertex<?, ?> ofVertex : logProbOfVertices) {\n LogProbGradients logProbGradientOfVertex = reverseModeLogProbGradientWrtLatents(... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_295 | {
"fields": [
{
"declarator": "rule = new DeterministicRule()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public DeterministicRule rule = new DeterministicRule();",
"type": "DeterministicRule",
"var_name": "rule"
}
],
"file": "keanu-project/src/test/java... | {
"body": "@Test\n public void samplesSimpleDiscretePriorWithDefaults() {\n\n MCMCTestCase testCase = new SingleVariateDiscreteTestCase();\n\n BayesianNetwork bayesNet = testCase.getModel();\n KeanuProbabilisticModel model = new KeanuProbabilisticModel(bayesNet);\n\n NetworkSamples post... | {
"fields": [
{
"declarator": "DEFAULT_VARIABLE_SELECTOR = SINGLE_VARIABLE_SELECTOR",
"modifier": "private static final",
"original_string": "private static final MHStepVariableSelector DEFAULT_VARIABLE_SELECTOR = SINGLE_VARIABLE_SELECTOR;",
"type": "MHStepVariableSelector",
"var_nam... | {
"body": "@Override\n public NetworkSamples getPosteriorSamples(ProbabilisticModel model,\n List<? extends Variable> variablesToSampleFrom,\n int sampleCount) {\n return generatePosteriorSamples(model, variablesToSamp... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_153 | {
"fields": [
{
"declarator": "DELTA = 0.001",
"modifier": "private static final",
"original_string": "private static final double DELTA = 0.001;",
"type": "double",
"var_name": "DELTA"
},
{
"declarator": "random",
"modifier": "private",
"original_string": "... | {
"body": "@Test\n public void logProbGraphMatchesKnownLogDensityOfVector() {\n DoubleVertex mu = ConstantVertex.of(0., 0.);\n DoubleVertex beta = ConstantVertex.of(1., 1.);\n LaplaceVertex laplaceVertex = new LaplaceVertex(mu, beta);\n LogProbGraph logProbGraph = laplaceVertex.logProbG... | {
"fields": [
{
"declarator": "mu",
"modifier": "private final",
"original_string": "private final DoubleVertex mu;",
"type": "DoubleVertex",
"var_name": "mu"
},
{
"declarator": "beta",
"modifier": "private final",
"original_string": "private final DoubleVer... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceholder = new DoublePlaceholderVertex(this.getShape());\n final DoublePlaceholderVertex muPlaceholder = new DoublePlaceholderVertex(mu.getShape());\n final DoublePlaceholderVertex betaPlaceholder =... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_93 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "network... | {
"body": "@Test\n public void networkReturnsVerticesInNamespace() {\n BooleanVertex a0 = new BernoulliVertex(0.5).setLabel(new VertexLabel(\"root\", \"a\", \"0\"));\n BooleanVertex a1 = new BernoulliVertex(0.5).setLabel(new VertexLabel(\"root\", \"a\", \"1\"));\n BooleanVertex b0 = new Bernou... | {
"fields": [
{
"declarator": "vertices",
"modifier": "private final",
"original_string": "private final List<? extends Vertex> vertices;",
"type": "List<? extends Vertex>",
"var_name": "vertices"
},
{
"declarator": "vertexLabels",
"modifier": "private final",
... | {
"body": "public List<Vertex> getVerticesInNamespace(String... namespace) {\n return vertices.stream()\n .filter(v -> v.getLabel() != null && v.getLabel().isInNamespace(namespace))\n .collect(Collectors.toList());\n }",
"class_method_signature": "BayesianNetwork.getVerticesInNamespa... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_104 | {
"fields": [
{
"declarator": "Amu",
"modifier": "",
"original_string": "DoubleVertex Amu;",
"type": "DoubleVertex",
"var_name": "Amu"
},
{
"declarator": "Asigma",
"modifier": "",
"original_string": "DoubleVertex Asigma;",
"type": "DoubleVertex",
... | {
"body": "@Test\n public void doesGetAllUpstreamVerticesOfCollection() {\n TransitiveClosure transitiveClosure = TransitiveClosure.getUpstreamVerticesForCollection(Arrays.asList(C, cSigma), true);\n assertThat(transitiveClosure.getAllVertices(), containsInAnyOrder(Amu, Asigma, Bmu, Bsigma, A, B, aPl... | {
"fields": [
{
"declarator": "ADD_ALL = vertex -> true",
"modifier": "private static final",
"original_string": "private static final Predicate<Vertex> ADD_ALL = vertex -> true;",
"type": "Predicate<Vertex>",
"var_name": "ADD_ALL"
},
{
"declarator": "PROBABILISTIC_OR_O... | {
"body": "public static TransitiveClosure getUpstreamVerticesForCollection(List<Vertex> vertices, boolean includeNonProbabilistic) {\n\n Predicate<Vertex> shouldAdd = includeNonProbabilistic ? ADD_ALL : PROBABILISTIC_OR_OBSERVED_ONLY;\n\n Set<Vertex> upstreamVertices = getVertices(\n vertice... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_85 | {
"fields": [
{
"declarator": "expectedException = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException expectedException = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "expectedException"
}
... | {
"body": "@Test\n public void throwsIfTooManyBooleansAreEncoded() {\n byte byte1 = (byte) Integer.parseInt(\"10101010\", 2);\n byte byte2 = (byte) Integer.parseInt(\"10000001\", 2);\n byte[] bytes = new byte[]{byte1, byte2};\n\n expectedException.expect(Py4jByteArrayConversionException... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/util/Py4jByteArrayConverter.java",
"identifier": "Py4jByteArrayConverter",
"interfaces": "",
"methods": [
{
"class_method_signature": "Py4jByteArrayConverter.toByteArray(double[] doubleArray)",
"constructor": false,
... | {
"body": "public static boolean[] toBooleanArray(byte[] byteArray, int numberOfBooleansInArray) {\n BitSet bits = BitSet.valueOf(byteArray);\n boolean[] bools = new boolean[numberOfBooleansInArray];\n for (int i = bits.nextSetBit(0); i != -1; i = bits.nextSetBit(i + 1)) {\n int positi... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_112 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "printSt... | {
"body": "@Test\n public void whenRunningMetropolisHastingsThenSamplesArePrinted() {\n final DoubleVertex temperature = new UniformVertex(20., 30.);\n\n new PrintVertex<>(temperature);\n\n KeanuProbabilisticModel model = new KeanuProbabilisticModel(temperature.getConnectedGraph());\n\n ... | {
"fields": [
{
"declarator": "printStream = System.out",
"modifier": "private static",
"original_string": "private static PrintStream printStream = System.out;",
"type": "PrintStream",
"var_name": "printStream"
},
{
"declarator": "PARENT = \"parent\"",
"modifier"... | {
"body": "public static <T> T print(T parentValue, String message, boolean printData) {\n final String dataOutput = printData ? parentValue.toString() + \"\\n\" : \"\";\n printStream.print(message + dataOutput);\n return parentValue;\n }",
"class_method_signature": "PrintVertex.print(T pare... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_329 | {
"fields": [
{
"declarator": "expectedException = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException expectedException = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "expectedException"
}
... | {
"body": "@Test\n public void failsIfThereAreNoSequences() throws IOException {\n expectedException.expect(SequenceConstructionException.class);\n expectedException.expectMessage(\"The provided BayesianNetwork contains no Sequences\");\n\n IntegerVertex two = new ConstantIntegerVertex(1).plus... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/templating/SequenceLoader.java",
"identifier": "SequenceLoader",
"interfaces": "",
"methods": [
{
"class_method_signature": "SequenceLoader.loadFromBayesNet(BayesianNetwork network)",
"constructor": false,
"full_sig... | {
"body": "public static Sequence loadFromBayesNet(BayesianNetwork network) {\n Collection<Sequence> sequences = loadSequences(network, false).values();\n return sequences.stream().findFirst().get();\n }",
"class_method_signature": "SequenceLoader.loadFromBayesNet(BayesianNetwork network)",
"cons... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_283 | {
"fields": [
{
"declarator": "rule = new DeterministicRule()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public DeterministicRule rule = new DeterministicRule();",
"type": "DeterministicRule",
"var_name": "rule"
}
],
"file": "keanu-project/src/test/java... | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void doesValidateTargetAcceptanceLower() {\n NUTS.builder().targetAcceptanceProb(-0.1);\n }",
"class_method_signature": "NUTSTest.doesValidateTargetAcceptanceLower()",
"constructor": false,
"full_signature": "@Test(expected = Ille... | {
"fields": [
{
"declarator": "random",
"modifier": "@Getter\n private final",
"original_string": "@Getter\n private final KeanuRandom random;",
"type": "KeanuRandom",
"var_name": "random"
},
{
"declarator": "targetAcceptanceProb",
"modifier": "@Getter\n ... | {
"body": "public static NUTSBuilder builder() {\n return new NUTSBuilder();\n }",
"class_method_signature": "NUTS.builder()",
"constructor": false,
"full_signature": "public static NUTSBuilder builder()",
"identifier": "builder",
"invocations": [],
"modifiers": "public static",
"parameters": ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_145 | {
"fields": [
{
"declarator": "DELTA = 0.0001",
"modifier": "private static final",
"original_string": "private static final double DELTA = 0.0001;",
"type": "double",
"var_name": "DELTA"
},
{
"declarator": "random",
"modifier": "private",
"original_string":... | {
"body": "@Test\n public void logProbGraphMatchesKnownLogDensityOfVector() {\n DoubleVertex mu = ConstantVertex.of(0., 0.);\n DoubleVertex sigma = ConstantVertex.of(1., 1.);\n GaussianVertex vertex = new GaussianVertex(mu, sigma);\n LogProbGraph logProbGraph = vertex.logProbGraph();\n\... | {
"fields": [
{
"declarator": "mu",
"modifier": "private final",
"original_string": "private final DoubleVertex mu;",
"type": "DoubleVertex",
"var_name": "mu"
},
{
"declarator": "sigma",
"modifier": "private final",
"original_string": "private final DoubleVe... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceholder = new DoublePlaceholderVertex(this.getShape());\n final DoublePlaceholderVertex muPlaceholder = new DoublePlaceholderVertex(mu.getShape());\n final DoublePlaceholderVertex sigmaPlaceholder ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_132 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/vertices/tensor/number/floating/dbl/nonprobabilistic/diff/LogProbGradientCalculatorTest.java",
"identifier": "LogProbGradientCalculatorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void canFindGradientOfMultivariantGaussianWrtSingleVariateLatentWithOp() {\n\n GaussianVertex A = new GaussianVertex(0, 1);\n DoubleTensor aValue = DoubleTensor.scalar(0.2);\n A.setValue(aValue);\n GaussianVertex C = new GaussianVertex(new long[]{3, 2}, 0, 1);\... | {
"fields": [
{
"declarator": "logProbOfVertices",
"modifier": "private final",
"original_string": "private final Set<Vertex> logProbOfVertices;",
"type": "Set<Vertex>",
"var_name": "logProbOfVertices"
},
{
"declarator": "wrtVertices",
"modifier": "private final",... | {
"body": "public Map<VertexId, DoubleTensor> getJointLogProbGradientWrtLatents() {\n LogProbGradients totalLogProbGradients = new LogProbGradients();\n\n for (final Vertex<?, ?> ofVertex : logProbOfVertices) {\n LogProbGradients logProbGradientOfVertex = reverseModeLogProbGradientWrtLatents(... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_165 | {
"fields": [
{
"declarator": "N = 100000",
"modifier": "private",
"original_string": "private int N = 100000;",
"type": "int",
"var_name": "N"
},
{
"declarator": "lowerBound = 10.",
"modifier": "private",
"original_string": "private Double lowerBound = 10.;... | {
"body": "@Test\n public void logProbUpperBoundIsNegativeInfinity() {\n UniformVertex testUniformVertex = new UniformVertex(new long[]{1, N}, lowerBound, upperBound);\n assertEquals(testUniformVertex.logProb(DoubleTensor.scalar(upperBound)), Double.NEGATIVE_INFINITY, 1e-6);\n }",
"class_method_... | {
"fields": [
{
"declarator": "xMin",
"modifier": "private final",
"original_string": "private final DoubleVertex xMin;",
"type": "DoubleVertex",
"var_name": "xMin"
},
{
"declarator": "xMax",
"modifier": "private final",
"original_string": "private final Dou... | {
"body": "@Override\n public double logProb(DoubleTensor value) {\n return Uniform.withParameters(xMin.getValue(), xMax.getValue()).logProb(value).sumNumber();\n }",
"class_method_signature": "UniformVertex.logProb(DoubleTensor value)",
"constructor": false,
"full_signature": "@Override public dou... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_309 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/algorithms/graphtraversal/TopologicalSortTest.java",
"identifier": "TopologicalSortTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void sortsDoubleDiamondGraph() {\n\n DoubleVertex A = new GaussianVertex(5.0, 1.0);\n DoubleVertex B = new GaussianVertex(A, 1.0);\n DoubleVertex C = new GaussianVertex(A, 1.0);\n DoubleVertex D = new GaussianVertex(B, C);\n DoubleVertex E = new Gaussian... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/algorithms/graphtraversal/TopologicalSort.java",
"identifier": "TopologicalSort",
"interfaces": "",
"methods": [
{
"class_method_signature": "TopologicalSort.TopologicalSort()",
"constructor": true,
"full_signature"... | {
"body": "public static List<Vertex> sort(Collection<? extends Vertex> vertices) {\n return vertices\n .stream()\n .sorted(Comparator.comparing(Vertex::getId, Comparator.naturalOrder()))\n .collect(Collectors.toList());\n }",
"class_method_signature": "TopologicalSort.sor... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_173 | {
"fields": [
{
"declarator": "VERTEX_INCREMENT = 0.1",
"modifier": "private final",
"original_string": "private final double VERTEX_INCREMENT = 0.1;",
"type": "double",
"var_name": "VERTEX_INCREMENT"
},
{
"declarator": "random",
"modifier": "private",
"orig... | {
"body": "@Test\n public void logProbGraphIsNegInfIfLocationIsNotPositive() {\n DoubleVertex location = ConstantVertex.of(-1., 1.);\n DoubleVertex scale = ConstantVertex.of(3., 3.);\n ParetoVertex paretoVertex = new ParetoVertex(location, scale);\n LogProbGraph logProbGraph = paretoVer... | {
"fields": [
{
"declarator": "scale",
"modifier": "private final",
"original_string": "private final DoubleVertex scale;",
"type": "DoubleVertex",
"var_name": "scale"
},
{
"declarator": "location",
"modifier": "private final",
"original_string": "private fi... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceholder = new DoublePlaceholderVertex(this.getShape());\n final DoublePlaceholderVertex locationPlaceholder = new DoublePlaceholderVertex(location.getShape());\n final DoublePlaceholderVertex scale... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_124 | {
"fields": [
{
"declarator": "epsilon = 0.01",
"modifier": "private static",
"original_string": "private static double epsilon = 0.01;",
"type": "double",
"var_name": "epsilon"
},
{
"declarator": "N = 100000",
"modifier": "private static",
"original_string"... | {
"body": "@Category(Slow.class)\n @Test\n public void fourValuesNotEquallyWeightedSummingToFour() {\n\n Map<TestEnum, DoubleVertex> selectableValues = new LinkedHashMap<>();\n selectableValues.put(TestEnum.A, ConstantVertex.of(0.25));\n selectableValues.put(TestEnum.B, ConstantVertex.of(0.... | {
"fields": [
{
"declarator": "selectableValues",
"modifier": "private final",
"original_string": "private final Map<CATEGORY, DoubleVertex> selectableValues;",
"type": "Map<CATEGORY, DoubleVertex>",
"var_name": "selectableValues"
}
],
"file": "keanu-project/src/main/java/io/... | {
"body": "public static <CATEGORY> CategoricalVertex<CATEGORY> of(\n Map<CATEGORY, Double> selectableValues\n ) {\n return new CategoricalVertex<>(toDoubleVertices(selectableValues));\n }",
"class_method_signature": "CategoricalVertex.of(\n Map<CATEGORY, Double> selectableValues\n )",... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_348 | {
"fields": [
{
"declarator": "random",
"modifier": "private",
"original_string": "private KeanuRandom random;",
"type": "KeanuRandom",
"var_name": "random"
}
],
"file": "keanu-project/src/test/java/io/improbable/keanu/KeanuRandomTest.java",
"identifier": "KeanuRandomTest",... | {
"body": "@Test\n public void randomNumberGenerationIsPlatformIndependent() {\n KeanuRandom keanuRandom = new KeanuRandom(1);\n assertEquals(keanuRandom.nextDouble(), new MersenneTwister(1L).nextDouble());\n assertEquals(keanuRandom.nextDouble(), 0.41782887182714457, 1e-16);\n }",
"class... | {
"fields": [
{
"declarator": "DEFAULT_RANDOM = new AtomicReference<>()",
"modifier": "private static final",
"original_string": "private static final AtomicReference<KeanuRandom> DEFAULT_RANDOM = new AtomicReference<>();",
"type": "AtomicReference<KeanuRandom>",
"var_name": "DEFAULT... | {
"body": "public DoubleTensor nextDouble(long[] shape) {\n final int length = getLengthAsInt(shape);\n if (length > 1) {\n return DoubleTensor.create(nextDoubleBuffer(length), shape);\n } else {\n return DoubleTensor.create(nextDouble(), shape);\n }\n }",
"class... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_27 | {
"fields": [
{
"declarator": "scalar1 = new long[0]",
"modifier": "private",
"original_string": "private long[] scalar1 = new long[0];",
"type": "long[]",
"var_name": "scalar1"
},
{
"declarator": "scalar2 = new long[0]",
"modifier": "private",
"original_str... | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void checkSquareMatrixFailsOnNonSquareBatchMatrices() {\n TensorShapeValidation.checkShapeIsSquareMatrix(new long[]{3, 3, 2});\n }",
"class_method_signature": "TensorShapeValidationTest.checkSquareMatrixFailsOnNonSquareBatchMatrices()... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/tensor/TensorShapeValidation.java",
"identifier": "TensorShapeValidation",
"interfaces": "",
"methods": [
{
"class_method_signature": "TensorShapeValidation.TensorShapeValidation()",
"constructor": true,
"full_signa... | {
"body": "public static void checkShapeIsSquareMatrix(long[] shape) {\n if (shape.length < 2) {\n throw new IllegalArgumentException(\"Input tensor must be a matrix\");\n }\n\n if (shape[shape.length - 1] != shape[shape.length - 2]) {\n throw new IllegalArgumentException(\"... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_276 | {
"fields": [
{
"declarator": "vertex",
"modifier": "private",
"original_string": "private GaussianVertex vertex;",
"type": "GaussianVertex",
"var_name": "vertex"
},
{
"declarator": "gradientCalculator",
"modifier": "private",
"original_string": "private Kea... | {
"body": "@Test\n public void canLeapForward() {\n\n LeapfrogState leap = integrator.step(start, gradientCalculator, 1.0);\n assertEquals(0.5, leap.getPosition().get(vertex.getId()).scalar(), 1e-6);\n }",
"class_method_signature": "LeapfrogIntegratorTest.canLeapForward()",
"constructor": fals... | {
"fields": [
{
"declarator": "potential",
"modifier": "private final",
"original_string": "private final Potential potential;",
"type": "Potential",
"var_name": "potential"
}
],
"file": "keanu-project/src/main/java/io/improbable/keanu/algorithms/mcmc/nuts/LeapfrogIntegrator.... | {
"body": "public LeapfrogState step(LeapfrogState fromState, final ProbabilisticModelWithGradient logProbGradientCalculator, final double timeStep) {\n\n final double halfTimeStep = timeStep / 2.0;\n\n Map<VariableReference, DoubleTensor> nextMomentum = stepMomentum(halfTimeStep, fromState.getMomentum(... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_333 | {
"fields": [
{
"declarator": "expectedException = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException expectedException = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "expectedException"
},
... | {
"body": "@Test\n public void unlabelledVerticesCanAlsoBeGotIfYouKnowTheLabelToUse() {\n Vertex<?, ?> vertex = item.get(VERTEX_LABEL_2);\n assertThat(vertex, equalTo(this.vertex2));\n }",
"class_method_signature": "SequenceItemTest.unlabelledVerticesCanAlsoBeGotIfYouKnowTheLabelToUse()",
"con... | {
"fields": [
{
"declarator": "NAME_PREFIX = \"Sequence_Item_\"",
"modifier": "private static final",
"original_string": "private static final String NAME_PREFIX = \"Sequence_Item_\";",
"type": "String",
"var_name": "NAME_PREFIX"
},
{
"declarator": "NAME_REGEX = Pattern... | {
"body": "@Override\n public <V extends Vertex<?, ?>> V get(VertexLabel label) {\n Vertex<?, ?> vertex = contents.getOrDefault(label, contents.get(scoped(label)));\n\n if (vertex == null) {\n throw new IllegalArgumentException(\"Cannot find VertexLabel \" + label);\n }\n ret... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_299 | {
"fields": [
{
"declarator": "rule = new DeterministicRule()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public DeterministicRule rule = new DeterministicRule();",
"type": "DeterministicRule",
"var_name": "rule"
}
],
"file": "keanu-project/src/test/java... | {
"body": "@Test\n public void canStreamSamples() {\n\n int sampleCount = 1000;\n int dropCount = 100;\n int downSampleInterval = 1;\n GaussianVertex A = new GaussianVertex(0, 1);\n KeanuProbabilisticModel model = new KeanuProbabilisticModel(A.getConnectedGraph());\n Metro... | {
"fields": [
{
"declarator": "DEFAULT_VARIABLE_SELECTOR = SINGLE_VARIABLE_SELECTOR",
"modifier": "private static final",
"original_string": "private static final MHStepVariableSelector DEFAULT_VARIABLE_SELECTOR = SINGLE_VARIABLE_SELECTOR;",
"type": "MHStepVariableSelector",
"var_nam... | {
"body": "@Override\n public NetworkSamplesGenerator generatePosteriorSamples(final ProbabilisticModel model,\n final List<? extends Variable> variablesToSampleFrom) {\n\n return new NetworkSamplesGenerator(setupSampler(model, variablesToSampleFrom... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_108 | {
"fields": [
{
"declarator": "rule = new DeterministicRule()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public DeterministicRule rule = new DeterministicRule();",
"type": "DeterministicRule",
"var_name": "rule"
}
],
"file": "keanu-project/src/test/java... | {
"body": "@Test\n public void doesExpectedLogProbGraphOnTensor() {\n DoubleVertex probTrue = ConstantVertex.of(0.25, 0.25);\n BernoulliVertex bernoulliVertex = new BernoulliVertex(probTrue);\n LogProbGraph logProbGraph = bernoulliVertex.logProbGraph();\n LogProbGraphValueFeeder.feedVal... | {
"fields": [
{
"declarator": "probTrue",
"modifier": "private final",
"original_string": "private final DoubleVertex probTrue;",
"type": "DoubleVertex",
"var_name": "probTrue"
},
{
"declarator": "PROBTRUE_NAME = \"probTrue\"",
"modifier": "private final static",
... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n BooleanPlaceholderVertex valuePlaceholder = new BooleanPlaceholderVertex(this.getShape());\n DoublePlaceholderVertex probTruePlaceholder = new DoublePlaceholderVertex(probTrue.getShape());\n\n return LogProbGraph.builder()\n ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_221 | {
"fields": [
{
"declarator": "rule = new DeterministicRule()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public DeterministicRule rule = new DeterministicRule();",
"type": "DeterministicRule",
"var_name": "rule"
},
{
"declarator": "thrown = Expect... | {
"body": "@Test\n public void itWorksWithVectorOfNAndMatrixOfProbabilities() {\n\n int n1 = 1;\n int n2 = 10;\n\n IntegerTensor n = IntegerTensor.create(new int[]{\n n1, n2\n }, 2);\n\n double[] p1 = new double[]{.3, .2, .5};\n double[] p2 = new double[]{.5, .3... | {
"fields": [
{
"declarator": "p",
"modifier": "private final",
"original_string": "private final DoubleVertex p;",
"type": "DoubleVertex",
"var_name": "p"
},
{
"declarator": "n",
"modifier": "private final",
"original_string": "private final IntegerVertex n... | {
"body": "@Override\n public double logProb(IntegerTensor x) {\n return Multinomial.withParameters(n.getValue(), p.getValue(), validationEnabled).logProb(x).sumNumber();\n }",
"class_method_signature": "MultinomialVertex.logProb(IntegerTensor x)",
"constructor": false,
"full_signature": "@Override... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_70 | {
"fields": [
{
"declarator": "samples",
"modifier": "private",
"original_string": "private NetworkSamples samples;",
"type": "NetworkSamples",
"var_name": "samples"
},
{
"declarator": "rowTensors = new ArrayList<>()",
"modifier": "private",
"original_string... | {
"body": "@Test\n public void writeColumnOfTensorsToCsvWithHeader() throws IOException {\n File file = WriteCsv.asColumns(columnTensors).withDefaultHeader().toFile(File.createTempFile(\"test\", \".csv\"));\n\n CsvReader reader = ReadCsv.fromFile(file).expectHeader(true);\n List<List<String>> ... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/util/csv/WriteCsv.java",
"identifier": "WriteCsv",
"interfaces": "",
"methods": [
{
"class_method_signature": "WriteCsv.asSamples(NetworkSamples samples, List<? extends Vertex<? extends Tensor, ?>> vertices)",
"constructo... | {
"body": "public static ColumnWriter asColumns(List<? extends Vertex<? extends Tensor, ?>> vertices) {\n return new ColumnWriter(vertices);\n }",
"class_method_signature": "WriteCsv.asColumns(List<? extends Vertex<? extends Tensor, ?>> vertices)",
"constructor": false,
"full_signature": "public stati... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_66 | {
"fields": [
{
"declarator": "samples",
"modifier": "private",
"original_string": "private NetworkSamples samples;",
"type": "NetworkSamples",
"var_name": "samples"
},
{
"declarator": "rowTensors = new ArrayList<>()",
"modifier": "private",
"original_string... | {
"body": "@Test\n public void writeSamplesToCsvWithHeader() throws IOException {\n File file = WriteCsv.asSamples(samples, rowTensors).withDefaultHeader().toFile(File.createTempFile(\"test\", \".csv\"));\n\n CsvReader reader = ReadCsv.fromFile(file).expectHeader(true);\n List<List<String>> li... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/util/csv/WriteCsv.java",
"identifier": "WriteCsv",
"interfaces": "",
"methods": [
{
"class_method_signature": "WriteCsv.asSamples(NetworkSamples samples, List<? extends Vertex<? extends Tensor, ?>> vertices)",
"constructo... | {
"body": "public static SampleWriter asSamples(NetworkSamples samples, List<? extends Vertex<? extends Tensor, ?>> vertices) {\n return new SampleWriter(samples, vertices);\n }",
"class_method_signature": "WriteCsv.asSamples(NetworkSamples samples, List<? extends Vertex<? extends Tensor, ?>> vertices)",
... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_237 | {
"fields": [
{
"declarator": "expectedException = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException expectedException = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "expectedException"
}
... | {
"body": "@Test\n public void youCanGetTheQualifiedName() {\n String innerNamespace = \"inner\";\n String outerNamespace = \"outer\";\n String name = \"foo\";\n VertexLabel foo = new VertexLabel(outerNamespace, innerNamespace, name);\n assertThat(foo.getQualifiedName(), equalTo(... | {
"fields": [
{
"declarator": "NAMESPACE_SEPARATOR = '.'",
"modifier": "private static final",
"original_string": "private static final char NAMESPACE_SEPARATOR = '.';",
"type": "char",
"var_name": "NAMESPACE_SEPARATOR"
},
{
"declarator": "namespace",
"modifier": ... | {
"body": "public String getQualifiedName() {\n ImmutableList<String> names = ImmutableList.<String>builder().addAll(namespace).add(name).build();\n return Joiner.on(NAMESPACE_SEPARATOR).join(names);\n }",
"class_method_signature": "VertexLabel.getQualifiedName()",
"constructor": false,
"full_s... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_89 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "network... | {
"body": "@Test\n public void youCanLabelVertices() {\n BooleanVertex a = new BernoulliVertex(0.5);\n BooleanVertex b = new BernoulliVertex(0.5);\n BooleanVertex ored = a.or(b);\n BooleanVertex unlabelled = ored.or(a);\n Vertex retrieved;\n VertexLabel labelA = new Vertex... | {
"fields": [
{
"declarator": "vertices",
"modifier": "private final",
"original_string": "private final List<? extends Vertex> vertices;",
"type": "List<? extends Vertex>",
"var_name": "vertices"
},
{
"declarator": "vertexLabels",
"modifier": "private final",
... | {
"body": "public Vertex getVertexByLabel(VertexLabel label) {\n Preconditions.checkArgument(vertexLabels.containsKey(label), String.format(\"Vertex with label %s was not found in BayesianNetwork.\", label));\n return vertexLabels.get(label);\n }",
"class_method_signature": "BayesianNetwork.getVert... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_149 | {
"fields": [
{
"declarator": "DELTA = 0.0001",
"modifier": "private static final",
"original_string": "private static final double DELTA = 0.0001;",
"type": "double",
"var_name": "DELTA"
},
{
"declarator": "random",
"modifier": "private",
"original_string":... | {
"body": "@Test\n public void logProbGraphMatchesKnownDensityOfVector() {\n DoubleVertex location = ConstantVertex.of(0., 0.);\n DoubleVertex scale = ConstantVertex.of(1., 1.);\n CauchyVertex vertex = new CauchyVertex(location, scale);\n LogProbGraph logProbGraph = vertex.logProbGraph(... | {
"fields": [
{
"declarator": "location",
"modifier": "private final",
"original_string": "private final DoubleVertex location;",
"type": "DoubleVertex",
"var_name": "location"
},
{
"declarator": "scale",
"modifier": "private final",
"original_string": "priv... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceholder = new DoublePlaceholderVertex(this.getShape());\n final DoublePlaceholderVertex locationPlaceholder = new DoublePlaceholderVertex(location.getShape());\n final DoublePlaceholderVertex scale... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_260 | {
"fields": [
{
"declarator": "vertex1 = mock(Vertex.class)",
"modifier": "private",
"original_string": "private Vertex vertex1 = mock(Vertex.class);",
"type": "Vertex",
"var_name": "vertex1"
},
{
"declarator": "vertex2 = mock(Vertex.class)",
"modifier": "private"... | {
"body": "@Test\n public void itThrowsIfYouAskForTheAcceptanceRateForAnUnrecognisedSetOfVertices() {\n expectedException.expect(IllegalStateException.class);\n expectedException.expectMessage(\"No proposals have been registered for [1]\");\n acceptanceRateTracker.getAcceptanceRate(vertex1.get... | {
"fields": [
{
"declarator": "numApplied = Maps.newHashMap()",
"modifier": "private",
"original_string": "private Map<VariableReference, Counter> numApplied = Maps.newHashMap();",
"type": "Map<VariableReference, Counter>",
"var_name": "numApplied"
},
{
"declarator": "n... | {
"body": "public double getAcceptanceRate(VariableReference variableReference) {\n if (!numApplied.keySet().contains(variableReference)) {\n throw new IllegalStateException(\"No proposals have been registered for \" + variableReference);\n }\n return 1. - (double) numRejected.getOrDef... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_31 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/tensor/jvm/JVMTensorTest.java",
"identifier": "JVMTensorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void canToStringVector() {\n DoubleTensor vector = JVMDoubleTensorFactory.INSTANCE.arange(0, 3);\n String actual = vector.toString();\n\n assertThat(actual, equalTo(\n \"{\\n\" +\n \"shape = [3]\\n\" +\n \"data = \\n\" +\n ... | {
"fields": [
{
"declarator": "buffer",
"modifier": "protected",
"original_string": "protected B buffer;",
"type": "B",
"var_name": "buffer"
},
{
"declarator": "shape",
"modifier": "protected",
"original_string": "protected long[] shape;",
"type": "lon... | {
"body": "@Override\n public String toString() {\n\n return \"{\\n\" +\n \"shape = \" + Arrays.toString(shape) +\n \"\\ndata = \\n\" + arrayToString(buffer.asArray(), shape, stride) +\n \"\\n}\";\n }",
"class_method_signature": "JVMTensor.toString()",
"constructor": ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_325 | {
"fields": [
{
"declarator": "expectedException = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException expectedException = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "expectedException"
}
... | {
"body": "@Test\n public void youCanConstructSingleSequenceItem() throws IOException {\n VertexLabel xLabel = new VertexLabel(\"x\");\n\n DoubleVertex two = new ConstantDoubleVertex(2.0);\n\n Consumer<SequenceItem> factory = sequenceItem -> {\n DoubleProxyVertex xInput = sequenceIt... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/templating/SequenceLoader.java",
"identifier": "SequenceLoader",
"interfaces": "",
"methods": [
{
"class_method_signature": "SequenceLoader.loadFromBayesNet(BayesianNetwork network)",
"constructor": false,
"full_sig... | {
"body": "public static Sequence loadFromBayesNet(BayesianNetwork network) {\n Collection<Sequence> sequences = loadSequences(network, false).values();\n return sequences.stream().findFirst().get();\n }",
"class_method_signature": "SequenceLoader.loadFromBayesNet(BayesianNetwork network)",
"cons... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_261 | {
"fields": [
{
"declarator": "vertex1 = mock(Vertex.class)",
"modifier": "private",
"original_string": "private Vertex vertex1 = mock(Vertex.class);",
"type": "Vertex",
"var_name": "vertex1"
},
{
"declarator": "vertex2 = mock(Vertex.class)",
"modifier": "private"... | {
"body": "@Test\n public void youCanTrackTheAcceptanceRateForASingleVertex() {\n Proposal proposal = new Proposal();\n proposal.setProposal(vertex1, 1.);\n notifier.notifyProposalCreated(proposal);\n notifier.notifyProposalRejected();\n assertThat(acceptanceRateTracker.getAccept... | {
"fields": [
{
"declarator": "numApplied = Maps.newHashMap()",
"modifier": "private",
"original_string": "private Map<VariableReference, Counter> numApplied = Maps.newHashMap();",
"type": "Map<VariableReference, Counter>",
"var_name": "numApplied"
},
{
"declarator": "n... | {
"body": "public double getAcceptanceRate(VariableReference variableReference) {\n if (!numApplied.keySet().contains(variableReference)) {\n throw new IllegalStateException(\"No proposals have been registered for \" + variableReference);\n }\n return 1. - (double) numRejected.getOrDef... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_30 | {
"fields": [
{
"declarator": "scalar1 = new long[0]",
"modifier": "private",
"original_string": "private long[] scalar1 = new long[0];",
"type": "long[]",
"var_name": "scalar1"
},
{
"declarator": "scalar2 = new long[0]",
"modifier": "private",
"original_str... | {
"body": "@Test\n public void checkScalarIsBroadcastable() {\n\n long[] a = new long[]{};\n long[] b = new long[]{4, 3, 2, 2};\n\n assertTrue(TensorShapeValidation.isBroadcastable(a, b));\n }",
"class_method_signature": "TensorShapeValidationTest.checkScalarIsBroadcastable()",
"constru... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/tensor/TensorShapeValidation.java",
"identifier": "TensorShapeValidation",
"interfaces": "",
"methods": [
{
"class_method_signature": "TensorShapeValidation.TensorShapeValidation()",
"constructor": true,
"full_signa... | {
"body": "public static boolean isBroadcastable(long[] left, long[] right) {\n try {\n TensorShape.getBroadcastResultShape(left, right);\n return true;\n } catch (IllegalArgumentException e) {\n return false;\n }\n }",
"class_method_signature": "TensorShapeV... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_324 | {
"fields": [
{
"declarator": "expectedException = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException expectedException = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "expectedException"
},
... | {
"body": "@Test\n public void itThrowsIfYouPassInMultipleOutputVertices() {\n expectedException.expect(LoopConstructionException.class);\n expectedException.expectMessage(\"Duplicate label found in base case\");\n Loop.withInitialConditions(ConstantVertex.of(0.).setLabel(Loop.VALUE_OUT_LABEL)... | {
"fields": [
{
"declarator": "VALUE_OUT_LABEL = new VertexLabel(\"loop_value_out\")",
"modifier": "public static final",
"original_string": "public static final VertexLabel VALUE_OUT_LABEL = new VertexLabel(\"loop_value_out\");",
"type": "VertexLabel",
"var_name": "VALUE_OUT_LABEL"
... | {
"body": "public static <V extends Vertex<?, ?>> LoopBuilder withInitialConditions(V first, V... others) {\n Map<VertexLabel, Vertex<?, ?>> map = buildMapForBaseCase(first, others);\n return withInitialConditions(SimpleVertexDictionary.backedBy(map));\n }",
"class_method_signature": "Loop.withInit... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_148 | {
"fields": [
{
"declarator": "DELTA = 0.0001",
"modifier": "private static final",
"original_string": "private static final double DELTA = 0.0001;",
"type": "double",
"var_name": "DELTA"
},
{
"declarator": "random",
"modifier": "private",
"original_string":... | {
"body": "@Test\n public void logProbGraphMatchesKnownLogDensityOfScalar() {\n DoubleVertex location = ConstantVertex.of(0.);\n DoubleVertex scale = ConstantVertex.of(1.);\n CauchyVertex vertex = new CauchyVertex(location, scale);\n LogProbGraph logProbGraph = vertex.logProbGraph();\n\... | {
"fields": [
{
"declarator": "location",
"modifier": "private final",
"original_string": "private final DoubleVertex location;",
"type": "DoubleVertex",
"var_name": "location"
},
{
"declarator": "scale",
"modifier": "private final",
"original_string": "priv... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceholder = new DoublePlaceholderVertex(this.getShape());\n final DoublePlaceholderVertex locationPlaceholder = new DoublePlaceholderVertex(location.getShape());\n final DoublePlaceholderVertex scale... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_67 | {
"fields": [
{
"declarator": "samples",
"modifier": "private",
"original_string": "private NetworkSamples samples;",
"type": "NetworkSamples",
"var_name": "samples"
},
{
"declarator": "rowTensors = new ArrayList<>()",
"modifier": "private",
"original_string... | {
"body": "@Test\n public void writeColumnOfTensorsToCsv() throws IOException {\n File file = WriteCsv.asColumns(columnTensors).toFile(File.createTempFile(\"test\", \".csv\"));\n\n CsvReader reader = ReadCsv.fromFile(file).expectHeader(false);\n List<List<String>> lines = reader.readLines();\n... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/util/csv/WriteCsv.java",
"identifier": "WriteCsv",
"interfaces": "",
"methods": [
{
"class_method_signature": "WriteCsv.asSamples(NetworkSamples samples, List<? extends Vertex<? extends Tensor, ?>> vertices)",
"constructo... | {
"body": "public static ColumnWriter asColumns(List<? extends Vertex<? extends Tensor, ?>> vertices) {\n return new ColumnWriter(vertices);\n }",
"class_method_signature": "WriteCsv.asColumns(List<? extends Vertex<? extends Tensor, ?>> vertices)",
"constructor": false,
"full_signature": "public stati... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_236 | {
"fields": [
{
"declarator": "expectedException = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException expectedException = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "expectedException"
}
... | {
"body": "@Test\n public void youCanAugmentTheNamespace() {\n String innerNamespace = \"inner\";\n String outerNamespace = \"outer\";\n String name = \"foo\";\n VertexLabel foo = new VertexLabel(innerNamespace, name);\n VertexLabel newFoo = foo.withExtraNamespace(outerNamespace)... | {
"fields": [
{
"declarator": "NAMESPACE_SEPARATOR = '.'",
"modifier": "private static final",
"original_string": "private static final char NAMESPACE_SEPARATOR = '.';",
"type": "char",
"var_name": "NAMESPACE_SEPARATOR"
},
{
"declarator": "namespace",
"modifier": ... | {
"body": "public VertexLabel withExtraNamespace(String topLevelNamespace) {\n List<String> newNamespace = ImmutableList.<String>builder().add(topLevelNamespace).addAll(namespace).build();\n return new VertexLabel(newNamespace, this.name);\n }",
"class_method_signature": "VertexLabel.withExtraNames... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_88 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "network... | {
"body": "@Test\n public void youCanObserveANonProbabilisticVariableAfterCreatingTheNetwork() {\n assertThat(network.getObservedVertices(), is(empty()));\n output.observe(true);\n assertThat(network.getObservedVertices(), contains(output));\n output.unobserve();\n assertThat(net... | {
"fields": [
{
"declarator": "vertices",
"modifier": "private final",
"original_string": "private final List<? extends Vertex> vertices;",
"type": "List<? extends Vertex>",
"var_name": "vertices"
},
{
"declarator": "vertexLabels",
"modifier": "private final",
... | {
"body": "public List<Vertex> getObservedVertices() {\n return getObservedVertices(Integer.MAX_VALUE);\n }",
"class_method_signature": "BayesianNetwork.getObservedVertices()",
"constructor": false,
"full_signature": "public List<Vertex> getObservedVertices()",
"identifier": "getObservedVertices",
... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_220 | {
"fields": [
{
"declarator": "rule = new DeterministicRule()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public DeterministicRule rule = new DeterministicRule();",
"type": "DeterministicRule",
"var_name": "rule"
},
{
"declarator": "thrown = Expect... | {
"body": "@Test\n public void itWorksWithMatrixOfNAndRank3OfProbabilities() {\n\n int n1 = 1;\n int n2 = 10;\n int n3 = 100;\n int n4 = 1000;\n\n IntegerTensor n = IntegerTensor.create(new int[]{\n n1, n2,\n n3, n4\n }, 2, 2);\n\n double[] p1 ... | {
"fields": [
{
"declarator": "p",
"modifier": "private final",
"original_string": "private final DoubleVertex p;",
"type": "DoubleVertex",
"var_name": "p"
},
{
"declarator": "n",
"modifier": "private final",
"original_string": "private final IntegerVertex n... | {
"body": "@Override\n public double logProb(IntegerTensor x) {\n return Multinomial.withParameters(n.getValue(), p.getValue(), validationEnabled).logProb(x).sumNumber();\n }",
"class_method_signature": "MultinomialVertex.logProb(IntegerTensor x)",
"constructor": false,
"full_signature": "@Override... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_71 | {
"fields": [
{
"declarator": "samples",
"modifier": "private",
"original_string": "private NetworkSamples samples;",
"type": "NetworkSamples",
"var_name": "samples"
},
{
"declarator": "rowTensors = new ArrayList<>()",
"modifier": "private",
"original_string... | {
"body": "@Test\n public void writeRowOfTensorsToCsv() throws IOException {\n File file = WriteCsv.asRows(rowTensors).toFile(File.createTempFile(\"test\", \".csv\"));\n\n CsvReader reader = ReadCsv.fromFile(file).expectHeader(false);\n List<List<String>> lines = reader.readLines();\n\n ... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/util/csv/WriteCsv.java",
"identifier": "WriteCsv",
"interfaces": "",
"methods": [
{
"class_method_signature": "WriteCsv.asSamples(NetworkSamples samples, List<? extends Vertex<? extends Tensor, ?>> vertices)",
"constructo... | {
"body": "public static RowWriter asRows(List<? extends Vertex<? extends Tensor, ?>> vertices) {\n return new RowWriter(vertices);\n }",
"class_method_signature": "WriteCsv.asRows(List<? extends Vertex<? extends Tensor, ?>> vertices)",
"constructor": false,
"full_signature": "public static RowWriter ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_109 | {
"fields": [
{
"declarator": "rule = new DeterministicRule()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public DeterministicRule rule = new DeterministicRule();",
"type": "DeterministicRule",
"var_name": "rule"
}
],
"file": "keanu-project/src/test/java... | {
"body": "@Test\n public void logProbGraphClampsProbTrueTo1() {\n DoubleVertex probTrue = ConstantVertex.of(2.);\n BernoulliVertex bernoulliVertex = new BernoulliVertex(probTrue);\n LogProbGraph logProbGraph = bernoulliVertex.logProbGraph();\n LogProbGraphValueFeeder.feedValue(logProbG... | {
"fields": [
{
"declarator": "probTrue",
"modifier": "private final",
"original_string": "private final DoubleVertex probTrue;",
"type": "DoubleVertex",
"var_name": "probTrue"
},
{
"declarator": "PROBTRUE_NAME = \"probTrue\"",
"modifier": "private final static",
... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n BooleanPlaceholderVertex valuePlaceholder = new BooleanPlaceholderVertex(this.getShape());\n DoublePlaceholderVertex probTruePlaceholder = new DoublePlaceholderVertex(probTrue.getShape());\n\n return LogProbGraph.builder()\n ... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_26 | {
"fields": [
{
"declarator": "scalar1 = new long[0]",
"modifier": "private",
"original_string": "private long[] scalar1 = new long[0];",
"type": "long[]",
"var_name": "scalar1"
},
{
"declarator": "scalar2 = new long[0]",
"modifier": "private",
"original_str... | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void checkSquareMatrixFailsOnNonSquareMatrices() {\n TensorShapeValidation.checkShapeIsSquareMatrix(new long[]{3, 2});\n }",
"class_method_signature": "TensorShapeValidationTest.checkSquareMatrixFailsOnNonSquareMatrices()",
"constru... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/tensor/TensorShapeValidation.java",
"identifier": "TensorShapeValidation",
"interfaces": "",
"methods": [
{
"class_method_signature": "TensorShapeValidation.TensorShapeValidation()",
"constructor": true,
"full_signa... | {
"body": "public static void checkShapeIsSquareMatrix(long[] shape) {\n if (shape.length < 2) {\n throw new IllegalArgumentException(\"Input tensor must be a matrix\");\n }\n\n if (shape[shape.length - 1] != shape[shape.length - 2]) {\n throw new IllegalArgumentException(\"... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_277 | {
"fields": [
{
"declarator": "vertex",
"modifier": "private",
"original_string": "private GaussianVertex vertex;",
"type": "GaussianVertex",
"var_name": "vertex"
},
{
"declarator": "gradientCalculator",
"modifier": "private",
"original_string": "private Kea... | {
"body": "@Test\n public void canLeapForwardAndBack() {\n\n LeapfrogState leap = integrator.step(start, gradientCalculator, 1.0);\n assertEquals(initialMomentum, leap.getPosition().get(vertex.getId()).scalar(), 1e-6);\n\n LeapfrogState leapBack = integrator.step(leap, gradientCalculator, -1.0... | {
"fields": [
{
"declarator": "potential",
"modifier": "private final",
"original_string": "private final Potential potential;",
"type": "Potential",
"var_name": "potential"
}
],
"file": "keanu-project/src/main/java/io/improbable/keanu/algorithms/mcmc/nuts/LeapfrogIntegrator.... | {
"body": "public LeapfrogState step(LeapfrogState fromState, final ProbabilisticModelWithGradient logProbGradientCalculator, final double timeStep) {\n\n final double halfTimeStep = timeStep / 2.0;\n\n Map<VariableReference, DoubleTensor> nextMomentum = stepMomentum(halfTimeStep, fromState.getMomentum(... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_332 | {
"fields": [
{
"declarator": "expectedException = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException expectedException = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "expectedException"
},
... | {
"body": "@Test\n public void youCanGetAVertexByName() {\n Vertex<?, ?> vertex = item.get(VERTEX_LABEL_1);\n assertThat(vertex, equalTo(this.vertex1));\n }",
"class_method_signature": "SequenceItemTest.youCanGetAVertexByName()",
"constructor": false,
"full_signature": "@Test public void you... | {
"fields": [
{
"declarator": "NAME_PREFIX = \"Sequence_Item_\"",
"modifier": "private static final",
"original_string": "private static final String NAME_PREFIX = \"Sequence_Item_\";",
"type": "String",
"var_name": "NAME_PREFIX"
},
{
"declarator": "NAME_REGEX = Pattern... | {
"body": "@Override\n public <V extends Vertex<?, ?>> V get(VertexLabel label) {\n Vertex<?, ?> vertex = contents.getOrDefault(label, contents.get(scoped(label)));\n\n if (vertex == null) {\n throw new IllegalArgumentException(\"Cannot find VertexLabel \" + label);\n }\n ret... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_298 | {
"fields": [
{
"declarator": "rule = new DeterministicRule()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public DeterministicRule rule = new DeterministicRule();",
"type": "DeterministicRule",
"var_name": "rule"
}
],
"file": "keanu-project/src/test/java... | {
"body": "@Test\n public void doesNotStoreSamplesThatWillBeDropped() {\n\n int sampleCount = 1000;\n int dropCount = 100;\n int downSampleInterval = 2;\n GaussianVertex A = new GaussianVertex(0, 1);\n KeanuProbabilisticModel model = new KeanuProbabilisticModel(A.getConnectedGrap... | {
"fields": [
{
"declarator": "DEFAULT_VARIABLE_SELECTOR = SINGLE_VARIABLE_SELECTOR",
"modifier": "private static final",
"original_string": "private static final MHStepVariableSelector DEFAULT_VARIABLE_SELECTOR = SINGLE_VARIABLE_SELECTOR;",
"type": "MHStepVariableSelector",
"var_nam... | {
"body": "@Override\n public NetworkSamplesGenerator generatePosteriorSamples(final ProbabilisticModel model,\n final List<? extends Variable> variablesToSampleFrom) {\n\n return new NetworkSamplesGenerator(setupSampler(model, variablesToSampleFrom... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
128393918_349 | {
"fields": [
{
"declarator": "random",
"modifier": "private",
"original_string": "private KeanuRandom random;",
"type": "KeanuRandom",
"var_name": "random"
}
],
"file": "keanu-project/src/test/java/io/improbable/keanu/KeanuRandomTest.java",
"identifier": "KeanuRandomTest",... | {
"body": "@Test\n public void canGetStandardDeviationOfGaussian() {\n DoubleTensor A = random.nextGaussian(new long[]{1000}).times(5.0);\n Assert.assertEquals(5.0, A.standardDeviation().scalar(), 0.1);\n }",
"class_method_signature": "KeanuRandomTest.canGetStandardDeviationOfGaussian()",
"con... | {
"fields": [
{
"declarator": "DEFAULT_RANDOM = new AtomicReference<>()",
"modifier": "private static final",
"original_string": "private static final AtomicReference<KeanuRandom> DEFAULT_RANDOM = new AtomicReference<>();",
"type": "AtomicReference<KeanuRandom>",
"var_name": "DEFAULT... | {
"body": "public DoubleTensor nextGaussian(long[] shape) {\n final int length = getLengthAsInt(shape);\n if (length > 1) {\n return DoubleTensor.create(nextGaussianBuffer(length), shape);\n } else {\n return DoubleTensor.create(nextGaussian(), shape);\n }\n }",
... | {
"created": null,
"fork": null,
"fork_count": 33,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 128393918,
"size": 15461,
"stargazer_count": 146,
"stars": null,
"updates": null,
"url": "https://github.com/improbable-research/keanu"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.