id stringlengths 7 14 | test_class dict | test_case dict | focal_class dict | focal_method dict | repository dict |
|---|---|---|---|---|---|
128393918_306 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/algorithms/graphtraversal/DifferentiableCheckerTest.java",
"identifier": "DifferentiableCheckerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void constantVerticesAreCached() {\n GaussianVertex baseVertex = new GaussianVertex(1., 1.);\n DoubleVertex addVertex = baseVertex.plus(new ConstantDoubleVertex(1.));\n DoubleVertex mockedVertex = Mockito.spy(addVertex);\n DoubleVertex nonDiffable = mockedVerte... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/algorithms/graphtraversal/DifferentiableChecker.java",
"identifier": "DifferentiableChecker",
"interfaces": "",
"methods": [
{
"class_method_signature": "DifferentiableChecker.isDifferentiableWrtLatents(Collection<Vertex> verti... | {
"body": "public static boolean isDifferentiableWrtLatents(Collection<Vertex> vertices) {\n // All probabilistic need to be double or observed to ensure that the dLogProb can be calculated, for example\n // the dLogProb of BernoulliVertex can only be calculated when it is observed.\n if (!allPro... | {
"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_185 | {
"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\n DoubleVertex scale = ConstantVertex.of(1., 1.);\n HalfCauchyVertex halfCauchyVertex = new HalfCauchyVertex(scale);\n LogProbGraph logProbGraph = halfCauchyVertex.logProbGraph();\n LogProbGraphValueFeeder.f... | {
"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_255 | {
"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 theLogProbAtToIsMultivariateGaussian() {\n double logProb = proposalDistribution.logProbAtToGivenFrom(proposal);\n DoubleTensor mu = DoubleTensor.concat(currentStateForVertex1, currentStateForVertex2);\n DoubleTensor cov = DoubleTensor.concat(sigmaForVertex1, sig... | {
"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_310 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/algorithms/graphtraversal/TopologicalSortTest.java",
"identifier": "TopologicalSortTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void sortsComplexGraph() {\n DoubleVertex A = new GaussianVertex(5.0, 1.0);\n DoubleVertex B = new GaussianVertex(5.0, 1.0);\n DoubleVertex C = new GaussianVertex(A, B);\n DoubleVertex D = new GaussianVertex(5.0, 1.0);\n DoubleVertex F = new GaussianVert... | {
"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_193 | {
"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/floating/dbl/probabilistic/ChiSqua... | {
"body": "@Test\n public void logProbGraphMatchesKnownLogDensityOfScalar() {\n IntegerVertex k = ConstantVertex.of(1);\n ChiSquaredVertex vertex = new ChiSquaredVertex(k);\n LogProbGraph logProbGraph = vertex.logProbGraph();\n\n LogProbGraphValueFeeder.feedValue(logProbGraph, k, k.getV... | {
"fields": [
{
"declarator": "k",
"modifier": "private",
"original_string": "private IntegerVertex k;",
"type": "IntegerVertex",
"var_name": "k"
},
{
"declarator": "K_NAME = \"k\"",
"modifier": "private static final",
"original_string": "private static fina... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceHolder = new DoublePlaceholderVertex(this.getShape());\n final IntegerPlaceholderVertex kPlaceHolder = new IntegerPlaceholderVertex(k.getShape());\n\n return LogProbGraph.builder()\n .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_53 | {
"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 outputContainsHyperparameters() throws IOException {\n GaussianVertex gaussianV = new GaussianVertex(0, 1);\n BayesianNetwork gaussianNet = new BayesianNetwork(gaussianV.getConnectedGraph());\n\n DotSaver dotSaver = new DotSaver(gaussianNet);\n dotSaver.sa... | {
"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_202 | {
"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 logProbGraphIsCorrectForKnownVectorValues() {\n DoubleVertex p = ConstantVertex.of(0.25);\n IntegerVertex n = ConstantVertex.of(100);\n int k1 = 20;\n int k2 = 80;\n\n BinomialVertex testBinomialVertex = new BinomialVertex(new long[]{2}, p, n);\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_347 | {
"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 canSampleLaplaceScalar() {\n assertEquals(0, random.nextLaplace(new long[0], DoubleTensor.scalar(2), DoubleTensor.scalar(2)).getRank());\n assertEquals(1, random.nextLaplace(new long[]{1}, DoubleTensor.scalar(2), DoubleTensor.scalar(2)).getRank());\n assertEquals... | {
"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 nextLaplace(long[] shape, DoubleTensor mu, DoubleTensor beta) {\n return Laplace.withParameters(mu, beta).sample(shape, this);\n }",
"class_method_signature": "KeanuRandom.nextLaplace(long[] shape, DoubleTensor mu, DoubleTensor beta)",
"constructor": false,
"full_signatu... | {
"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_296 | {
"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": "@Category(Slow.class)\n @Test\n public void samplesComplexDiscretePriorWithDefaults() {\n\n MCMCTestCase testCase = new MultiVariateDiscreteTestCase();\n\n BayesianNetwork bayesNet = testCase.getModel();\n KeanuProbabilisticModel model = new KeanuProbabilisticModel(bayesNet);\n\n... | {
"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_28 | {
"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 checkIsBroadcastableWith1AndExtraRank() {\n\n long[] a = new long[]{2, 1, 2, 2};\n long[] b = new long[]{3, 2, 2};\n\n assertTrue(TensorShapeValidation.isBroadcastable(a, b));\n }",
"class_method_signature": "TensorShapeValidationTest.checkIsBroadcastableWit... | {
"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_279 | {
"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 doesDecreaseKineticEnergyWhenLogProbDecreases() {\n\n double startEnergy = start.getKineticEnergy();\n\n LeapfrogState leap = integrator.step(start, gradientCalculator, 1e-3);\n\n double afterLeapEnergy = leap.getKineticEnergy();\n\n assertThat(startEnergy... | {
"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_150 | {
"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 logProbGraphMatchesKnownLogDensityOfScalar() {\n DoubleVertex xMin = ConstantVertex.of(0.);\n DoubleVertex xMax = ConstantVertex.of(20.);\n DoubleVertex c = ConstantVertex.of(10.);\n TriangularVertex triangularVertex = new TriangularVertex(xMin, xMax, c);\... | {
"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 LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceholder = new DoublePlaceholderVertex(this.getShape());\n final DoublePlaceholderVertex xMinPlaceholder = new DoublePlaceholderVertex(xMin.getShape());\n final DoublePlaceholderVertex xMaxPlacehold... | {
"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_90 | {
"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(expected = IllegalArgumentException.class)\n public void networkWithNonSaveableVerticesThrowsExceptionOnSave() throws IOException {\n DoubleVertex testVertex = new TestNonSaveableVertex();\n BayesianNetwork net = new BayesianNetwork(testVertex.getConnectedGraph());\n NetworkSa... | {
"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 void save(NetworkSaver networkSaver) {\n if (isAllSavable()) {\n for (Vertex vertex : TopologicalSort.sort(vertices)) {\n networkSaver.save(unwrapIfNeeded(vertex));\n }\n } else {\n throw new IllegalArgumentException(\"Trying to save a Ba... | {
"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_107 | {
"fields": [
{
"declarator": "values = ImmutableList.of(\n BooleanTensor.create(new boolean[]{true, false}, 1, 2),\n BooleanTensor.create(new boolean[]{true, false}, 1, 2)\n )",
"modifier": "",
"original_string": "List<BooleanTensor> values = ImmutableList.of(\n BooleanT... | {
"body": "@Test\n public void canGetSamplesAsTensor() {\n BooleanTensor samplesAsTensor = samples.asTensor();\n BooleanTensor expectedTensor = BooleanTensor.create(\n new boolean[]{true, false, true, false},\n 2, 1, 2\n );\n\n assertThat(samplesAsTensor, valuesAnd... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/vertices/tensor/bool/BooleanVertexSamples.java",
"identifier": "BooleanVertexSamples",
"interfaces": "",
"methods": [
{
"class_method_signature": "BooleanVertexSamples.BooleanVertexSamples(List<BooleanTensor> samples)",
"... | {
"body": "@Override\n public BooleanTensor asTensor() {\n return BooleanTensor.stack(0, samples.stream().toArray(BooleanTensor[]::new));\n }",
"class_method_signature": "BooleanVertexSamples.asTensor()",
"constructor": false,
"full_signature": "@Override public BooleanTensor asTensor()",
"identi... | {
"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_86 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/network/NetworkSnapshotTest.java",
"identifier": "NetworkSnapshotTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void itInspectsTheVerticesState() {\n Vertex v1 = mock(Vertex.class);\n Vertex v2 = mock(Vertex.class);\n\n NetworkSnapshot.create(ImmutableSet.of(v1, v2));\n verify(v1).getState();\n verify(v2).getState();\n verifyNoMoreInteractions(v1, v2);\n ... | {
"fields": [
{
"declarator": "vertexStates",
"modifier": "private final",
"original_string": "private final Map<Vertex, VertexState> vertexStates;",
"type": "Map<Vertex, VertexState>",
"var_name": "vertexStates"
}
],
"file": "keanu-project/src/main/java/io/improbable/keanu/n... | {
"body": "public static NetworkSnapshot create(Set<? extends Vertex> vertices) {\n return new NetworkSnapshot(vertices);\n }",
"class_method_signature": "NetworkSnapshot.create(Set<? extends Vertex> vertices)",
"constructor": false,
"full_signature": "public static NetworkSnapshot create(Set<? extend... | {
"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_69 | {
"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 writeColumnOfIntegerTensorsToCsv() throws IOException {\n File file = WriteCsv.asColumns(integerColumnTensors).toFile(File.createTempFile(\"test\", \".csv\"));\n\n CsvReader reader = ReadCsv.fromFile(file).expectHeader(false);\n List<List<String>> lines = reader.... | {
"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_238 | {
"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 itUsesADotToPrint() {\n VertexLabel foo = new VertexLabel(\"outer\", \"inner\", \"foo\");\n assertThat(foo.toString(), equalTo(\"outer.inner.foo\"));\n }",
"class_method_signature": "VertexLabelTest.itUsesADotToPrint()",
"constructor": false,
"full_signature": ... | {
"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 String toString() {\n return getQualifiedName();\n }",
"class_method_signature": "VertexLabel.toString()",
"constructor": false,
"full_signature": "@Override public String toString()",
"identifier": "toString",
"invocations": [
"getQualifiedName"
],
"modifi... | {
"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_111 | {
"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 whenPrintStreamIsNullThenFails() {\n thrown.expect(NullPointerException.class);\n PrintVertex.setPrintStream(null);\n }",
"class_method_signature": "PrintVertexTest.whenPrintStreamIsNullThenFails()",
"constructor": false,
"full_signature": "@Test public void wh... | {
"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 void setPrintStream(PrintStream printStream) {\n PrintVertex.printStream = Preconditions.checkNotNull(printStream);\n }",
"class_method_signature": "PrintVertex.setPrintStream(PrintStream printStream)",
"constructor": false,
"full_signature": "public static void setPrintStream... | {
"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_280 | {
"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 doesValidateAdapStepSizeCount() {\n NUTS.builder().adaptCount(-1);\n }",
"class_method_signature": "NUTSTest.doesValidateAdapStepSizeCount()",
"constructor": false,
"full_signature": "@Test(expected = IllegalArgumentException... | {
"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_146 | {
"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 canLogProbWithBatchSigma() {\n DoubleTensor mu = DoubleTensor.create(-1, 2);\n DoubleTensor sigma = DoubleTensor.create(0.5, 1.0, 0.25, 2).reshape(2, 2);\n GaussianVertex g = new GaussianVertex(mu, sigma);\n DoubleTensor sample = g.sample();\n\n ass... | {
"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 double logProb(DoubleTensor value) {\n\n DoubleTensor muValues = mu.getValue();\n DoubleTensor sigmaValues = sigma.getValue();\n\n DoubleTensor logPdfs = Gaussian.withParameters(muValues, sigmaValues).logProb(value);\n\n return logPdfs.sumNumber();\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_321 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/algorithms/variational/optimizer/nongradient/BOBYQATest.java",
"identifier": "BOBYQATest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void canFindMAPGivenBounds() {\n DoubleVertex A = new GaussianVertex(new long[]{2}, ConstantVertex.of(new double[]{1, -3}), 1);\n A.setValue(new double[]{0, 0});\n\n OptimizerBounds bounds = new OptimizerBounds();\n bounds.addBound(A.getId(), DoubleTensor.creat... | {
"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_264 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/algorithms/mcmc/NetworkSamplesGeneratorTest.java",
"identifier": "NetworkSamplesGeneratorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void doesUpdateStatusAndFinishStatusOnGeneration() {\n AtomicInteger stepCount = new AtomicInteger(0);\n AtomicInteger sampleCount = new AtomicInteger(0);\n\n StatusBar statusBar = mock(StatusBar.class);\n TestSamplingAlgorithm algorithm = new TestSamplingAlgor... | {
"fields": [
{
"declarator": "algorithm",
"modifier": "private final",
"original_string": "private final SamplingAlgorithm algorithm;",
"type": "SamplingAlgorithm",
"var_name": "algorithm"
},
{
"declarator": "dropCount = 0",
"modifier": "private",
"original... | {
"body": "public NetworkSamples generate(final int totalSampleCount) {\n Preconditions.checkArgument(dropCount < totalSampleCount,\n \"Cannot drop more samples than requested or all of the samples. Samples requested %s and dropping %s\",\n totalSampleCount, dropCount\n );\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_35 | {
"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 canStackVectors() {\n BooleanTensor x = BooleanTensor.create(true, false);\n BooleanTensor y = BooleanTensor.create(true, false);\n\n assertEquals(BooleanTensor.create(true, false, true, false).reshape(2, 2), BooleanTensor.stack(0, x, y));\n assertEquals(B... | {
"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_62 | {
"fields": [
{
"declarator": "csv = \"a,b,c\\nhel,lo,world\"",
"modifier": "",
"original_string": "String csv = \"a,b,c\\nhel,lo,world\";",
"type": "String",
"var_name": "csv"
}
],
"file": "keanu-project/src/test/java/io/improbable/keanu/util/csv/ReadCsvTest.java",
"identi... | {
"body": "@Test\n public void canReadFromString() {\n canRead(ReadCsv.fromString(csv));\n }",
"class_method_signature": "ReadCsvTest.canReadFromString()",
"constructor": false,
"full_signature": "@Test public void canReadFromString()",
"identifier": "canReadFromString",
"invocations": [
"c... | {
"fields": [],
"file": "keanu-project/src/main/java/io/improbable/keanu/util/csv/ReadCsv.java",
"identifier": "ReadCsv",
"interfaces": "",
"methods": [
{
"class_method_signature": "ReadCsv.ReadCsv()",
"constructor": true,
"full_signature": "private ReadCsv()",
"identifier": "Read... | {
"body": "public static CsvReader fromString(String csvString) {\n return new CsvReader(() -> new StringReader(csvString));\n }",
"class_method_signature": "ReadCsv.fromString(String csvString)",
"constructor": false,
"full_signature": "public static CsvReader fromString(String csvString)",
"identi... | {
"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_233 | {
"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 youCanGetTheOuterNamespace() {\n String innerNamespace = \"inner\";\n String outerNamespace = \"outer\";\n String name = \"foo\";\n VertexLabel foo = new VertexLabel(outerNamespace, innerNamespace, name);\n Optional<String> outerNamespace1 = foo.get... | {
"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 Optional<String> getOuterNamespace() {\n return namespace.stream().findFirst();\n }",
"class_method_signature": "VertexLabel.getOuterNamespace()",
"constructor": false,
"full_signature": "public Optional<String> getOuterNamespace()",
"identifier": "getOuterNamespace",
"invocation... | {
"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_225 | {
"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": "@Category(Slow.class)\n @Test\n public void samplingProducesRealisticMeanAndStandardDeviation() {\n int sampleCount = 10000;\n DoubleTensor p = DoubleTensor.create(0.1, 0.2, 0.3, 0.4);\n int n = 500;\n\n MultinomialVertex vertex = new MultinomialVertex(n, p);\n\n In... | {
"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 IntegerTensor sampleWithShape(long[] shape, KeanuRandom random) {\n return Multinomial.withParameters(n.getValue(), p.getValue(), validationEnabled).sample(shape, random);\n }",
"class_method_signature": "MultinomialVertex.sampleWithShape(long[] shape, KeanuRandom random)"... | {
"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_74 | {
"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 writeRowOfScalarsToCsv() throws IOException {\n File file = WriteCsv.asColumns(scalarTensors).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 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_337 | {
"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_Size() {\n Sequence sequence = new SequenceBuilder<Bean>()\n .fromIterator(ROWS.iterator())\n .withFactory((item, bean) -> {\n })\n .build();\n assertEquals(ROWS.size(), sequence.size());\n }",
"clas... | {
"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_23 | {
"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 acceptsMatchingParentsShape() {\n TensorShapeValidation.checkTensorsMatchNonLengthOneShapeOrAreLengthOne(new long[]{2, 2}, twoByTwo1, scalar1);\n }",
"class_method_signature": "TensorShapeValidationTest.acceptsMatchingParentsShape()",
"constructor": false,
"full_signa... | {
"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 checkTensorsMatchNonLengthOneShapeOrAreLengthOne(long[] proposalShape, long[]... shapes) {\n\n Set<TensorShape> nonLengthOneShapes = getNonLengthOneShapes(shapes);\n\n if (!nonLengthOneShapes.isEmpty()) {\n\n boolean moreThanOneNonLengthOneShape = nonLengthOneSha... | {
"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_272 | {
"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 canPowAMapOfValues() {\n\n Map<VariableReference, DoubleTensor> result = VariableValues.pow(left, 2);\n\n DoubleTensor expectedA = DoubleTensor.create(1, 4);\n DoubleTensor expectedB = DoubleTensor.create(9, 16);\n\n assertEquals(expectedA, result.get(ARef... | {
"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> pow(Map<VariableReference, DoubleTensor> values, double exponent) {\n Map<VariableReference, DoubleTensor> result = new HashMap<>();\n for (VariableReference v : values.keySet()) {\n result.put(v, values.get(v).pow(exponent));\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_58 | {
"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 dotSaveShowsAllDisconnectedVertices() throws IOException {\n DoubleVertex v1 = new ConstantDoubleVertex(0.);\n DoubleVertex v2 = new ConstantDoubleVertex(1.);\n DoubleVertex gamma1 = new GammaVertex(1., v2);\n gamma1.setLabel(\"gamma1\");\n Gaussian... | {
"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_209 | {
"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 logProbGraphIsCorrectVector() {\n DoubleVertex p = ConstantVertex.of(0.8);\n int[] values = new int[]{3, 5, 15};\n GeometricVertex myVertex = new GeometricVertex(new long[]{values.length}, p);\n LogProbGraph logProbGraph = myVertex.logProbGraph();\n\n ... | {
"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_120 | {
"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 canCreateCategoricalVertexIfShapeIsSpecifiedAndNonScalarShapeMatchProposalShapeOrIsScalar() {\n Map<TestEnum, DoubleVertex> selectableValues = new LinkedHashMap<>();\n selectableValues.put(TestEnum.A, ConstantVertex.of(t1));\n selectableValues.put(TestEnum.B, Con... | {
"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_198 | {
"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 canReverseAutoDiffOfMultiplicationLogSinAndSumWithSingleConditionalOutputWithRespectToMany() {\n\n DoubleVertex A = new GaussianVertex(new long[]{2, 2}, 0, 1);\n A.setValue(DoubleTensor.create(3.0, new long[]{2, 2}));\n DoubleVertex B = new GaussianVertex(new lon... | {
"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_177 | {
"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 logProbIsNegInfWhereXLessThanOne() {\n DoubleTensor matrixX = DoubleTensor.create(new double[]{1, -2}, new long[]{2, 1});\n\n DoubleTensor maskResult = Exponential.withParameters(DoubleTensor.scalar(1.0)).logProb(matrixX);\n assertArrayEquals(new double[]{-1, Dou... | {
"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 double logProb(DoubleTensor value) {\n\n DoubleTensor lambdaValues = rate.getValue();\n\n DoubleTensor logPdfs = Exponential.withParameters(lambdaValues).logProb(value);\n\n return logPdfs.sumNumber();\n }",
"class_method_signature": "ExponentialVertex.logPro... | {
"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_19 | {
"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 suggestHighestRankLengthOne() {\n long[] shapeProposal = TensorShapeValidation.checkHasOneNonLengthOneShapeOrAllLengthOne(new long[]{1, 1}, new long[]{1, 1, 1}, new long[]{1});\n assertArrayEquals(new long[]{1, 1, 1}, shapeProposal);\n }",
"class_method_signature":... | {
"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_248 | {
"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 throwsWhenAddingNullExtraNamespace() {\n expectedException.expect(NullPointerException.class);\n VertexLabel label = new VertexLabel(\"outer\", \"inner\", \"foo\");\n label.withExtraNamespace(null);\n }",
"class_method_signature": "VertexLabelTest.throwsWhen... | {
"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_161 | {
"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 sigma = ConstantVertex.of(1.);\n HalfGaussianVertex halfGaussianVertex = new HalfGaussianVertex(sigma);\n LogProbGraph logProbGraph = halfGaussianVertex.logProbGraph();\n LogProbGraphValueFeeder... | {
"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_136 | {
"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 canConcatenateAutoDiffMatricesAlongDimensionZero() {\n UniformVertex sharedMatrix = new UniformVertex(0, 10);\n sharedMatrix.setValue(DoubleTensor.create(new double[]{1, 2, 3, 4}, 2, 2));\n\n UniformVertex a = new UniformVertex(0, 10);\n a.setValue(DoubleT... | {
"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_141 | {
"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 canGetSamplesAsTensor() {\n List<DoubleTensor> samplesAsList = samples.asList();\n DoubleTensor samplesAsTensor = samples.asTensor();\n\n assertThat(samplesAsTensor.getShape(), equalTo(new long[]{4, 1, 3}));\n\n List<DoubleTensor> samplesAsTensorSliced = s... | {
"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": "@Override\n public DoubleTensor asTensor() {\n return DoubleTensor.stack(0, samples.stream().toArray(DoubleTensor[]::new));\n }",
"class_method_signature": "DoubleVertexSamples.asTensor()",
"constructor": false,
"full_signature": "@Override public DoubleTensor asTensor()",
"identifier"... | {
"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_287 | {
"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 treeGrowthEvaluatesOneLogProbPerStep() {\n\n ProbabilisticModelWithGradient mockModel = mock(ProbabilisticModelWithGradient.class);\n\n Map<VariableReference, DoubleTensor> mockGradient = ImmutableMap.of(vertex.getId(), DoubleTensor.scalar(0.0));\n\n when(mockMod... | {
"fields": [
{
"declarator": "logProbGradientCalculator",
"modifier": "private final",
"original_string": "private final ProbabilisticModelWithGradient logProbGradientCalculator;",
"type": "ProbabilisticModelWithGradient",
"var_name": "logProbGradientCalculator"
},
{
"... | {
"body": "public void grow(int buildDirection,\n double timeStep) {\n\n SubTree otherHalfTree = buildTree(\n buildDirection == -1 ? backward : forward,\n buildDirection,\n treeHeight,\n timeStep\n );\n\n if (buildDirection == -1) {\... | {
"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_39 | {
"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(expected = IllegalArgumentException.class)\n public void cannotStackIfNegativeDimensionIsOutOfBounds() {\n BooleanTensor matrixD = BooleanTensor.create(new boolean[]{true, false}, 1, 2);\n BooleanTensor.stack(-4, matrixD, matrixD);\n }",
"class_method_signature": "JVMBooleanTens... | {
"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_268 | {
"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 canAddTwoMapsOfValues() {\n\n Map<VariableReference, DoubleTensor> result = VariableValues.add(left, right);\n\n DoubleTensor expectedA = DoubleTensor.create(6, 8);\n DoubleTensor expectedB = DoubleTensor.create(10, 12);\n\n assertEquals(expectedA, result.... | {
"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> add(Map<VariableReference, DoubleTensor> left, Map<VariableReference, DoubleTensor> right) {\n Map<VariableReference, DoubleTensor> result = new HashMap<>();\n for (VariableReference v : left.keySet()) {\n result.put(v, left.get(v)... | {
"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_116 | {
"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 canCreateCategoricalVertexIfShapeIsNotSpecifiedAndNonScalarShapesMatch() {\n Map<TestEnum, DoubleVertex> selectableValues = new LinkedHashMap<>();\n selectableValues.put(TestEnum.A, ConstantVertex.of(t1));\n selectableValues.put(TestEnum.B, ConstantVertex.of(t1))... | {
"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_81 | {
"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 canCreateLongArrayFromByteArray() {\n byte byte1 = Byte.parseByte(\"00000110\", 2);\n byte byte2 = Byte.parseByte(\"00000011\", 2);\n byte zeroByte = Byte.parseByte(\"00000000\", 2);\n byte[] bytes = new byte[]{\n byte1, zeroByte, zeroByte, zero... | {
"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 long[] toLongArray(byte[] byteArray) {\n long[] longs = new long[byteArray.length / Long.BYTES];\n for (int i = 0; i < longs.length; i++) {\n longs[i] = ByteBuffer.wrap(byteArray, i * Long.BYTES, Long.BYTES).order(ByteOrder.LITTLE_ENDIAN).getLong();\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_100 | {
"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 doesGetUpstreamProbabilisticVertices() {\n TransitiveClosure transitiveClosure = TransitiveClosure.getUpstreamVertices(C, false);\n assertThat(transitiveClosure.getAllVertices(), containsInAnyOrder(A, B, C));\n }",
"class_method_signature": "TransitiveClosureTest.d... | {
"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 getUpstreamVertices(Vertex<?, ?> aVertex, boolean includeNonProbabilistic) {\n return getUpstreamVerticesForCollection(Collections.singletonList(aVertex), includeNonProbabilistic);\n }",
"class_method_signature": "TransitiveClosure.getUpstreamVertices(Vertex<?, ?... | {
"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_97 | {
"fields": [
{
"declarator": "A",
"modifier": "",
"original_string": "GaussianVertex A;",
"type": "GaussianVertex",
"var_name": "A"
},
{
"declarator": "B",
"modifier": "",
"original_string": "GaussianVertex B;",
"type": "GaussianVertex",
"var_na... | {
"body": "@Test\n public void canCalculateLogLikelihoodGradient() {\n\n Map<? extends VariableReference, DoubleTensor> logProbGradients = model.logProbGradients();\n LogProbGradientCalculator logProbGradientCalculator = new LogProbGradientCalculator(\n Arrays.asList(C, A, B), Arrays.asLis... | {
"fields": [
{
"declarator": "logProbGradientCalculator",
"modifier": "private final",
"original_string": "private final LogProbGradientCalculator logProbGradientCalculator;",
"type": "LogProbGradientCalculator",
"var_name": "logProbGradientCalculator"
},
{
"declarator... | {
"body": "@Override\n public Map<VariableReference, DoubleTensor> logProbGradients(Map<VariableReference, ?> inputs) {\n return gradients(inputs, logProbGradientCalculator);\n }",
"class_method_signature": "KeanuProbabilisticModelWithGradient.logProbGradients(Map<VariableReference, ?> inputs)",
"con... | {
"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_78 | {
"fields": [
{
"declarator": "csv = \"a,b,c\\nhel,lo,world\"",
"modifier": "",
"original_string": "String csv = \"a,b,c\\nhel,lo,world\";",
"type": "String",
"var_name": "csv"
},
{
"declarator": "tsv = \"a\\tb\\tc\\nhel\\tlo\\tworld\"",
"modifier": "",
"ori... | {
"body": "@Test\n public void givenCsvStringWithoutHeaderThenReturnsData() {\n CsvReader csvReader = ReadCsv.fromString(csv).expectHeader(false);\n testWithoutHeader(csvReader);\n }",
"class_method_signature": "CsvReaderTest.givenCsvStringWithoutHeaderThenReturnsData()",
"constructor": false,... | {
"fields": [
{
"declarator": "DEFAULT_DELIMITER = \",\"",
"modifier": "private static final",
"original_string": "private static final String DEFAULT_DELIMITER = \",\";",
"type": "String",
"var_name": "DEFAULT_DELIMITER"
},
{
"declarator": "sourceSupplier",
"modi... | {
"body": "public CsvReader expectHeader(boolean expectHeader) {\n this.expectHeader = expectHeader;\n return this;\n }",
"class_method_signature": "CsvReader.expectHeader(boolean expectHeader)",
"constructor": false,
"full_signature": "public CsvReader expectHeader(boolean expectHeader)",
"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_229 | {
"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 vertexLabelsWithDifferentNamesAreNotEqual() {\n VertexLabel foo = new VertexLabel(\"foo\");\n VertexLabel bar = new VertexLabel(\"bar\");\n assertThat(foo, not(equalTo(bar)));\n assertThat(foo.hashCode(), not(equalTo(bar.hashCode())));\n }",
"class_me... | {
"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_157 | {
"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 logProbGraphThrowsExceptionIfSumOfXIsNotEqualTo1WithEpsilon() {\n DoubleVertex concentration = ConstantVertex.of(3., 4., 5.);\n DirichletVertex vertex = new DirichletVertex(concentration);\n DoubleTensor x = DoubleTensor.create(0.1, 0.6, 0.300011);\n asser... | {
"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_291 | {
"fields": [
{
"declarator": "deterministicRule = new DeterministicRule()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public DeterministicRule deterministicRule = new DeterministicRule();",
"type": "DeterministicRule",
"var_name": "deterministicRule"
},
... | {
"body": "@Category(Slow.class)\n @Test\n public void doesAllowCustomProposalDistribution() {\n DoubleVertex A = new GaussianVertex(0, 1);\n A.setValue(0.0);\n ProbabilisticModel model = new KeanuProbabilisticModel(A.getConnectedGraph());\n\n MetropolisHastingsStep mhStep = stepFunc... | {
"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_205 | {
"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 logProbLowerBoundIsNotNegativeInfinity() {\n UniformIntVertex testUniformVertex = new UniformIntVertex(new long[]{1, N}, lowerBound, upperBound);\n assertNotEquals(testUniformVertex.logProb(IntegerTensor.scalar(lowerBound)), Double.NEGATIVE_INFINITY, 1e-6);\n }",
"... | {
"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 double logProb(IntegerTensor value) {\n return UniformInt.withParameters(min.getValue(), max.getValue()).logProb(value).sumNumber();\n }",
"class_method_signature": "UniformIntVertex.logProb(IntegerTensor value)",
"constructor": false,
"full_signature": "@Override publ... | {
"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_54 | {
"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 outputtingComplexNet() throws IOException {\n complexNetDotSaver.save(outputWriter, false);\n String expectedComplexOutput = readFileToString(COMPLEX_OUTPUT_FILENAME);\n checkDotFilesMatch(outputWriter.toString(), expectedComplexOutput);\n }",
"class_method_... | {
"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_340 | {
"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 youCanCreateASequenceWithACommonParameterFromACount() {\n GaussianVertex commonTheta = new GaussianVertex(0.5, 0.01);\n\n VertexLabel label = new VertexLabel(\"flip\");\n\n Sequence sequence = new SequenceBuilder<Bean>()\n .count(10)\n .with... | {
"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 FromCount count(int count) {\n return new FromCount(count, initialState);\n }",
"class_method_signature": "SequenceBuilder.count(int count)",
"constructor": false,
"full_signature": "public FromCount count(int count)",
"identifier": "count",
"invocations": [],
"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_194 | {
"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/floating/dbl/probabilistic/ChiSqua... | {
"body": "@Test\n public void logProbGraphMatchesKnownLogDensityOfVector() {\n IntegerVertex k = ConstantVertex.of(1, 1);\n ChiSquaredVertex vertex = new ChiSquaredVertex(k);\n LogProbGraph logProbGraph = vertex.logProbGraph();\n\n LogProbGraphValueFeeder.feedValue(logProbGraph, k, k.g... | {
"fields": [
{
"declarator": "k",
"modifier": "private",
"original_string": "private IntegerVertex k;",
"type": "IntegerVertex",
"var_name": "k"
},
{
"declarator": "K_NAME = \"k\"",
"modifier": "private static final",
"original_string": "private static fina... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n final DoublePlaceholderVertex xPlaceHolder = new DoublePlaceholderVertex(this.getShape());\n final IntegerPlaceholderVertex kPlaceHolder = new IntegerPlaceholderVertex(k.getShape());\n\n return LogProbGraph.builder()\n .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_252 | {
"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 autocorrAtLagZeroIsOne() {\n double[] samples = generateUniformRandomArray(20);\n double[] autocorr = Autocorrelation.calculate(samples);\n assertEquals(autocorr[0], 1.0, 0.0);\n }",
"class_method_signature": "AutocorrelationTest.autocorrAtLagZeroIsOne()",
... | {
"fields": [
{
"declarator": "ffTransformer = new FastFourierTransformer(DftNormalization.STANDARD)",
"modifier": "private static final",
"original_string": "private static final FastFourierTransformer ffTransformer = new FastFourierTransformer(DftNormalization.STANDARD);",
"type": "FastF... | {
"body": "public static double[] calculate(double[] samples) {\n double[] acovResult = autocovariance(samples);\n double variance = acovResult[0];\n double[] autocorr = Arrays.stream(acovResult).map(x -> x / variance).toArray();\n return autocorr;\n }",
"class_method_signature": "Aut... | {
"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_317 | {
"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 klDivergenceReturnsZeroIfPAndQAreZero() {\n when(qDist.getLogOfMasterP(any(NetworkState.class))).thenReturn(Double.NEGATIVE_INFINITY);\n NetworkSamples samples = createNetworkSamplesWithOneVertexAndOneSample(Double.NEGATIVE_INFINITY);\n\n assertEquals(0., KLDiver... | {
"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_182 | {
"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 logProbGraphMatchesKnownLogDensityOfVector() {\n DoubleVertex alpha = ConstantVertex.of(2., 2.);\n DoubleVertex beta = ConstantVertex.of(3., 3.);\n BetaVertex tensorBetaVertex = new BetaVertex(alpha, beta);\n LogProbGraph logProbGraph = tensorBetaVertex.lo... | {
"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_244 | {
"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 isNotInSubNamespace() {\n VertexLabel label = new VertexLabel(\"outer\", \"foo\");\n assertFalse(label.isInNamespace(\"outer\", \"inner\"));\n }",
"class_method_signature": "VertexLabelTest.isNotInSubNamespace()",
"constructor": false,
"full_signature": "@Test ... | {
"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_15 | {
"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 youCanGetTheStandardErrorForTheIntercept() {\n assertThat(stats.standardErrorForIntercept(), greaterThan(0.));\n }",
"class_method_signature": "BivariateDataStatisticsCalculatorTest.youCanGetTheStandardErrorForTheIntercept()",
"constructor": false,
"full_signature": "... | {
"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 standardErrorForIntercept() {\n double value = xMean() * xMean() / secondMomentOf(xData);\n value += 1. / size();\n value *= meanSquaredError();\n return Math.sqrt(value);\n }",
"class_method_signature": "BivariateDataStatisticsCalculator.standardErrorForInter... | {
"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_301 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/algorithms/particlefiltering/LatentIncrementSortTest.java",
"identifier": "LatentIncrementSortTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void simpleGraph() {\n DoubleVertex muA = ConstantVertex.of(0.0);\n DoubleVertex muB = ConstantVertex.of(3.0);\n DoubleVertex sigma = new UniformVertex(1.0, 2.0);\n\n DoubleVertex gA = new GaussianVertex(muA, sigma);\n DoubleVertex gB = new GaussianVerte... | {
"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_3 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/tensor/TensorShapeTest.java",
"identifier": "TensorShapeTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void canGetAbsoluteDimensionsFromRelative() {\n int[] actual = TensorShape.getAbsoluteDimensions(3, new int[]{-2, 1, 2});\n int[] expected = new int[]{1, 1, 2};\n assertArrayEquals(actual, expected);\n }",
"class_method_signature": "TensorShapeTest.canGetAbsolute... | {
"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 int[] getAbsoluteDimensions(int rank, int[] input) {\n int[] output = new int[input.length];\n for (int i = 0; i < output.length; i++) {\n output[i] = getAbsoluteDimension(input[i], rank);\n }\n return output;\n }",
"class_method_signature": "Tensor... | {
"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_42 | {
"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 canBroadcastXor() {\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 actualFromLeft = a.xor(b);\n ... | {
"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_213 | {
"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 itThrowsIfTheSampleShapeIsNotBroadcastableToTheVertexShape() {\n thrown.expect(IllegalArgumentException.class);\n thrown.expectMessage(\n \"Shape [2, 2] is incompatible with n shape [4] and p shape [4, 2].\" +\n \" It must be broadcastable with... | {
"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 IntegerTensor sampleWithShape(long[] shape, KeanuRandom random) {\n return Multinomial.withParameters(n.getValue(), p.getValue(), validationEnabled).sample(shape, random);\n }",
"class_method_signature": "MultinomialVertex.sampleWithShape(long[] shape, KeanuRandom random)"... | {
"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_356 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "testFol... | {
"body": "@Test\n public void canCreateFileWriterForNewFile() {\n Path path = Paths.get(testFolder.getRoot().toString(), TEST_GENERATED_FILE);\n\n assertFalse(Files.exists(path));\n\n TemplateProcessor.createFileWriter(path.toAbsolutePath().toString());\n assertTrue(Files.exists(path))... | {
"fields": [],
"file": "codegen/src/main/java/io/improbable/keanu/codegen/python/TemplateProcessor.java",
"identifier": "TemplateProcessor",
"interfaces": "",
"methods": [
{
"class_method_signature": "TemplateProcessor.processDataModel(Map<String, Object> dataModel, Template fileTemplate, Writer fi... | {
"body": "public Writer createFileWriter(String fileToWrite) {\n try {\n Files.deleteIfExists(Paths.get(fileToWrite));\n return new FileWriter(new File(fileToWrite), true);\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n }",
"class_met... | {
"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_43 | {
"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 canSliceBooleanTensor() {\n BooleanTensor a = BooleanTensor.create(\n true, true, false,\n true, false, true\n ).reshape(2, 3);\n\n assertThat(a.slice(0, 0), valuesAndShapesMatch(BooleanTensor.create(true, true, false)));\n assertThat... | {
"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_212 | {
"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 logProbGraphIsNegativeInfinityIfPLessThanOrEqualToZero() {\n DoubleVertex p = ConstantVertex.of(0.);\n GeometricVertex myVertex = new GeometricVertex(p);\n LogProbGraph logProbGraph = myVertex.logProbGraph();\n LogProbGraphValueFeeder.feedValue(logProbGrap... | {
"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_357 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "testFol... | {
"body": "@Test\n public void canCreateFileWriterForExistingFile() throws IOException {\n Path path = Paths.get(testFolder.getRoot().toString(), TEST_GENERATED_FILE);\n\n testFolder.newFile(TEST_GENERATED_FILE);\n assertTrue(Files.exists(path));\n\n TemplateProcessor.createFileWriter(p... | {
"fields": [],
"file": "codegen/src/main/java/io/improbable/keanu/codegen/python/TemplateProcessor.java",
"identifier": "TemplateProcessor",
"interfaces": "",
"methods": [
{
"class_method_signature": "TemplateProcessor.processDataModel(Map<String, Object> dataModel, Template fileTemplate, Writer fi... | {
"body": "public Writer createFileWriter(String fileToWrite) {\n try {\n Files.deleteIfExists(Paths.get(fileToWrite));\n return new FileWriter(new File(fileToWrite), true);\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n }",
"class_met... | {
"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_2 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/tensor/TensorShapeTest.java",
"identifier": "TensorShapeTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void canGetDimensionRange() {\n int[] actual = TensorShape.dimensionRange(2, 5);\n int[] expected = new int[]{2, 3, 4};\n assertArrayEquals(actual, expected);\n }",
"class_method_signature": "TensorShapeTest.canGetDimensionRange()",
"constructor": false,
"ful... | {
"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 int[] dimensionRange(int fromDimension, int toDimension) {\n if (fromDimension > toDimension) {\n throw new IllegalArgumentException(\"from dimension must be less than to dimension\");\n }\n\n int dimensionCount = toDimension - fromDimension;\n int[] dim... | {
"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_245 | {
"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 isNotInNamespaceWithDifferentOuter() {\n VertexLabel label = new VertexLabel(\"outer\", \"inner\", \"foo\");\n assertFalse(label.isInNamespace(\"differentOuter\", \"inner\"));\n }",
"class_method_signature": "VertexLabelTest.isNotInNamespaceWithDifferentOuter()",
... | {
"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_14 | {
"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 youCanGetTheStandardErrorForTheGradient() {\n assertThat(stats.standardErrorForGradient(), greaterThan(0.));\n }",
"class_method_signature": "BivariateDataStatisticsCalculatorTest.youCanGetTheStandardErrorForTheGradient()",
"constructor": false,
"full_signature": "@Te... | {
"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 standardErrorForGradient() {\n return Math.sqrt(meanSquaredError() / secondMomentOf(xData));\n }",
"class_method_signature": "BivariateDataStatisticsCalculator.standardErrorForGradient()",
"constructor": false,
"full_signature": "public double standardErrorForGradient()",
"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_300 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "random"... | {
"body": "@Test\n public void nonProbabilisticVerticesAreRecomputedDuringForwardSample() {\n GaussianVertex A = mock(GaussianVertex.class);\n NonProbabilisticVertex B = mock(NonProbabilisticVertex.class);\n\n when(A.getChildren()).thenReturn(Collections.singleton(B));\n when(A.getId())... | {
"fields": [
{
"declarator": "LOG_PROB_OF_PRIOR = 0.",
"modifier": "private static final",
"original_string": "private static final double LOG_PROB_OF_PRIOR = 0.;",
"type": "double",
"var_name": "LOG_PROB_OF_PRIOR"
},
{
"declarator": "network",
"modifier": "priva... | {
"body": "@Override\n public void sample(Map<VariableReference, List<?>> samples, List<Double> logOfMasterPForEachSample) {\n step();\n takeSamples(samples, variablesToSampleFrom);\n double logProb = calculateSampleProbability ? network.getLogOfMasterP() : LOG_PROB_OF_PRIOR;\n logOfMas... | {
"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_183 | {
"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\n DoubleVertex scale = ConstantVertex.of(1.);\n HalfCauchyVertex halfCauchyVertex = new HalfCauchyVertex(scale);\n LogProbGraph logProbGraph = halfCauchyVertex.logProbGraph();\n LogProbGraphValueFeeder.feedV... | {
"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_253 | {
"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 randomlyGeneratedSamplesHaveCloseToZeroAutocorrelationAtLowLags() {\n double[] samples = generateUniformRandomArray(500);\n double[] autocorr = Autocorrelation.calculate(samples);\n\n for (int lag = 1; lag < 10; lag++) {\n assertThat(autocorr[lag], les... | {
"fields": [
{
"declarator": "ffTransformer = new FastFourierTransformer(DftNormalization.STANDARD)",
"modifier": "private static final",
"original_string": "private static final FastFourierTransformer ffTransformer = new FastFourierTransformer(DftNormalization.STANDARD);",
"type": "FastF... | {
"body": "public static double[] calculate(double[] samples) {\n double[] acovResult = autocovariance(samples);\n double variance = acovResult[0];\n double[] autocorr = Arrays.stream(acovResult).map(x -> x / variance).toArray();\n return autocorr;\n }",
"class_method_signature": "Aut... | {
"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_316 | {
"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 klDivergenceReturnsZeroIfPIsZeroButQIsNot() {\n when(qDist.getLogOfMasterP(any(NetworkState.class))).thenReturn(Math.log(0.5));\n NetworkSamples samples = createNetworkSamplesWithOneVertexAndOneSample(Double.NEGATIVE_INFINITY);\n\n assertEquals(0., KLDivergence.c... | {
"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_195 | {
"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 canForwardAutoDiffOfSingleOuputWithRespectToMany() {\n\n GaussianVertex A = new GaussianVertex(0, 1);\n GaussianVertex B = new GaussianVertex(0, 1);\n DoubleVertex C = A.times(B);\n\n DoubleTensor dCdA = Differentiator.forwardModeAutoDiff(A, C).of(C);\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 <V extends Vertex> PartialsWithRespectTo forwardModeAutoDiff(V wrt, V... of) {\n return forwardModeAutoDiff(wrt, new HashSet<>(Arrays.asList(of)));\n }",
"class_method_signature": "Differentiator.forwardModeAutoDiff(V wrt, V... of)",
"constructor": false,
"full_signature": "pu... | {
"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_204 | {
"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 logProbGraphUpperBoundIsNegativeInfinity() {\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 testUniformVe... | {
"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_55 | {
"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 dotVertexLabelsAreSetCorrectly() throws IOException {\n int[] intValues = new int[]{1, 2, 3};\n ConstantIntegerVertex constantIntVertex = new ConstantIntegerVertex(intValues);\n ConstantIntegerVertex constantIntVertex2 = new ConstantIntegerVertex(2);\n Int... | {
"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_341 | {
"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 youCanPutTheSequenceIntoABayesNet() {\n GaussianVertex commonTheta = new GaussianVertex(0.5, 0.01);\n\n VertexLabel label = new VertexLabel(\"flip\");\n\n Sequence sequence = new SequenceBuilder<Bean>()\n .count(10)\n .withFactory((item) -> ... | {
"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 FromCount count(int count) {\n return new FromCount(count, initialState);\n }",
"class_method_signature": "SequenceBuilder.count(int count)",
"constructor": false,
"full_signature": "public FromCount count(int count)",
"identifier": "count",
"invocations": [],
"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_290 | {
"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 doesCalculateCorrectLogProbAfterAcceptingStep() {\n DoubleVertex A = new GaussianVertex(0, 1);\n A.setValue(1.0);\n DoubleVertex B = A.times(2);\n DoubleVertex observedB = new GaussianVertex(B, 1);\n observedB.observe(5);\n\n BayesianNetwork ... | {
"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_156 | {
"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 logProbGraphMatchesMontrealDirichletLogPdf() {\n DoubleVertex concentration = ConstantVertex.of(3., 4., 5.);\n DirichletVertex vertex = new DirichletVertex(concentration);\n DirichletDist baseline = new DirichletDist(new double[]{3, 4, 5});\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_96 | {
"fields": [
{
"declarator": "A",
"modifier": "",
"original_string": "GaussianVertex A;",
"type": "GaussianVertex",
"var_name": "A"
},
{
"declarator": "B",
"modifier": "",
"original_string": "GaussianVertex B;",
"type": "GaussianVertex",
"var_na... | {
"body": "@Test\n public void canCalculateLogProbGradient() {\n\n Map<? extends VariableReference, DoubleTensor> logLikelihoodGradients = model.logLikelihoodGradients();\n\n LogProbGradientCalculator logLikelihoodGradientCalculator = new LogProbGradientCalculator(\n Collections.singletonL... | {
"fields": [
{
"declarator": "logProbGradientCalculator",
"modifier": "private final",
"original_string": "private final LogProbGradientCalculator logProbGradientCalculator;",
"type": "LogProbGradientCalculator",
"var_name": "logProbGradientCalculator"
},
{
"declarator... | {
"body": "@Override\n public Map<VariableReference, DoubleTensor> logLikelihoodGradients(Map<VariableReference, ?> inputs) {\n return gradients(inputs, logLikelihoodGradientCalculator);\n }",
"class_method_signature": "KeanuProbabilisticModelWithGradient.logLikelihoodGradients(Map<VariableReference, ?... | {
"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_79 | {
"fields": [
{
"declarator": "csv = \"a,b,c\\nhel,lo,world\"",
"modifier": "",
"original_string": "String csv = \"a,b,c\\nhel,lo,world\";",
"type": "String",
"var_name": "csv"
},
{
"declarator": "tsv = \"a\\tb\\tc\\nhel\\tlo\\tworld\"",
"modifier": "",
"ori... | {
"body": "@Test\n public void givenTsvStringWithHeaderThenReturnsDataAndHeader() {\n CsvReader csvReader = ReadCsv.fromString(tsv).withDelimiter(\"\\t\");\n testWithHeader(csvReader);\n }",
"class_method_signature": "CsvReaderTest.givenTsvStringWithHeaderThenReturnsDataAndHeader()",
"construc... | {
"fields": [
{
"declarator": "DEFAULT_DELIMITER = \",\"",
"modifier": "private static final",
"original_string": "private static final String DEFAULT_DELIMITER = \",\";",
"type": "String",
"var_name": "DEFAULT_DELIMITER"
},
{
"declarator": "sourceSupplier",
"modi... | {
"body": "public CsvReader withDelimiter(String delimiter) {\n this.delimiter = delimiter;\n return this;\n }",
"class_method_signature": "CsvReader.withDelimiter(String delimiter)",
"constructor": false,
"full_signature": "public CsvReader withDelimiter(String delimiter)",
"identifier": "wi... | {
"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_228 | {
"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 vertexLabelsWithTheSameNameAreEqual() {\n VertexLabel foo1 = new VertexLabel(\"foo\");\n VertexLabel foo2 = new VertexLabel(\"foo\");\n assertThat(foo1, equalTo(foo2));\n assertThat(foo1.hashCode(), equalTo(foo2.hashCode()));\n }",
"class_method_signa... | {
"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_101 | {
"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 doesGetAllUpstreamVertices() {\n TransitiveClosure transitiveClosure = TransitiveClosure.getUpstreamVertices(C, true);\n assertThat(transitiveClosure.getAllVertices(), containsInAnyOrder(Amu, Asigma, Bmu, Bsigma, A, B, aPlusB, cSigma, C));\n }",
"class_method_signa... | {
"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 getUpstreamVertices(Vertex<?, ?> aVertex, boolean includeNonProbabilistic) {\n return getUpstreamVerticesForCollection(Collections.singletonList(aVertex), includeNonProbabilistic);\n }",
"class_method_signature": "TransitiveClosure.getUpstreamVertices(Vertex<?, ?... | {
"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_80 | {
"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 canCreateIntegerArrayFromByteArray() {\n byte byte1 = Byte.parseByte(\"00000110\", 2);\n byte byte2 = Byte.parseByte(\"00000011\", 2);\n byte zeroByte = Byte.parseByte(\"00000000\", 2);\n byte[] bytes = new byte[]{\n byte1, zeroByte, zeroByte, z... | {
"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 int[] toIntegerArray(byte[] byteArray) {\n int[] ints = new int[byteArray.length / Integer.BYTES];\n for (int i = 0; i < ints.length; i++) {\n ints[i] = ByteBuffer.wrap(byteArray, i * Integer.BYTES, Integer.BYTES).order(ByteOrder.LITTLE_ENDIAN).getInt();\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_117 | {
"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 canCreateCategoricalVertexIfShapeIsNotSpecifiedAndAllShapesAreScalar() {\n Map<TestEnum, DoubleVertex> selectableValues = new LinkedHashMap<>();\n selectableValues.put(TestEnum.A, ConstantVertex.of(0.5));\n selectableValues.put(TestEnum.B, ConstantVertex.of(0.8))... | {
"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_286 | {
"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 treeSizeAndHeightGrows() {\n\n Tree tree = new Tree(\n start,\n null,\n 1000,\n gradientCalculator,\n leapfrogIntegrator,\n singletonList(vertex),\n KeanuRandom.getDefaultRandom()\n );\n\n ... | {
"fields": [
{
"declarator": "logProbGradientCalculator",
"modifier": "private final",
"original_string": "private final ProbabilisticModelWithGradient logProbGradientCalculator;",
"type": "ProbabilisticModelWithGradient",
"var_name": "logProbGradientCalculator"
},
{
"... | {
"body": "public void grow(int buildDirection,\n double timeStep) {\n\n SubTree otherHalfTree = buildTree(\n buildDirection == -1 ? backward : forward,\n buildDirection,\n treeHeight,\n timeStep\n );\n\n if (buildDirection == -1) {\... | {
"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_38 | {
"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(expected = IllegalArgumentException.class)\n public void cannotStackIfPositiveDimensionIsOutOfBounds() {\n BooleanTensor matrixD = BooleanTensor.create(new boolean[]{true, false}, 1, 2);\n BooleanTensor.stack(3, matrixD, matrixD);\n }",
"class_method_signature": "JVMBooleanTenso... | {
"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_269 | {
"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 canTimesTwoMapsOfValues() {\n\n Map<VariableReference, DoubleTensor> result = VariableValues.times(left, right);\n\n DoubleTensor expectedA = DoubleTensor.create(5, 12);\n DoubleTensor expectedB = DoubleTensor.create(21, 32);\n\n assertEquals(expectedA, re... | {
"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> times(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).times(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_140 | {
"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 doesCalculateVariance() {\n\n DoubleTensor variances = samples.getVariances();\n\n DoubleTensor expectedValues = DoubleTensor.create(\n stats.stream().mapToDouble(SummaryStatistics::getVariance).toArray()\n );\n assertThat(variances, allCloseTo(... | {
"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 getVariances() {\n DoubleTensor sumOfSquares = this.samples.stream()\n .reduce(DoubleTensor.zeros(sampleShape), (l, r) -> l.plusInPlace(r.pow(2)));\n return sumOfSquares\n .divInPlace((double) samples.size())\n .minusInPlace(getAverages().p... | {
"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_137 | {
"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 canConcatenateAutoDiffMatricesAlongDimensionOne() {\n UniformVertex sharedMatrix = new UniformVertex(0, 10);\n sharedMatrix.setValue(DoubleTensor.create(new double[]{1, 2, 3, 4}, 2, 2));\n\n UniformVertex a = new UniformVertex(0, 10);\n a.setValue(DoubleTe... | {
"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_160 | {
"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 LogNormalVertex logNormalVertex = new LogNormalVertex(mu, sigma);\n LogProbGraph logProbGraph = logNormalVerte... | {
"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_18 | {
"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 suggestScalar() {\n long[] shapeProposal = TensorShapeValidation.checkHasOneNonLengthOneShapeOrAllLengthOne(scalar1, scalar2);\n assertArrayEquals(Tensor.SCALAR_SHAPE, shapeProposal);\n }",
"class_method_signature": "TensorShapeValidationTest.suggestScalar()",
"c... | {
"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_249 | {
"fields": [
{
"declarator": "vertex1 = mock(Vertex.class)",
"modifier": "",
"original_string": "Vertex vertex1 = mock(Vertex.class);",
"type": "Vertex",
"var_name": "vertex1"
},
{
"declarator": "vertex2 = mock(Vertex.class)",
"modifier": "",
"original_stri... | {
"body": "@Test\n public void ifYouChangeTheUnderlyingMapItChangesTheDictionary() {\n VertexLabel label3 = new VertexLabel(\"label3\");\n Vertex<?, ?> vertex3 = mock(Vertex.class);\n map.put(label3, vertex3);\n assertThat(dictionary.get(label3), sameInstance(vertex3));\n }",
"clas... | {
"fields": [
{
"declarator": "dictionary",
"modifier": "private final",
"original_string": "private final Map<VertexLabel, Vertex<?, ?>> dictionary;",
"type": "Map<VertexLabel, Vertex<?, ?>>",
"var_name": "dictionary"
}
],
"file": "keanu-project/src/main/java/io/improbable/k... | {
"body": "@Override\n public <V extends Vertex<?, ?>> V get(VertexLabel label) {\n return (V) dictionary.get(label);\n }",
"class_method_signature": "SimpleVertexDictionary.get(VertexLabel label)",
"constructor": false,
"full_signature": "@Override public V get(VertexLabel label)",
"identifier":... | {
"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_199 | {
"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/PoissonV... | {
"body": "@Test\n public void logProbGraphForValuesGreaterThanTwenty() {\n DoubleVertex mu = ConstantVertex.of(25.0);\n\n PoissonVertex poissonVertex = new PoissonVertex(mu);\n LogProbGraph logProbGraph = poissonVertex.logProbGraph();\n LogProbGraphValueFeeder.feedValue(logProbGraph, m... | {
"fields": [
{
"declarator": "mu",
"modifier": "private final",
"original_string": "private final DoubleVertex mu;",
"type": "DoubleVertex",
"var_name": "mu"
},
{
"declarator": "MU_NAME = \"mu\"",
"modifier": "private static final",
"original_string": "priv... | {
"body": "@Override\n public LogProbGraph logProbGraph() {\n IntegerPlaceholderVertex valuePlaceholder = new IntegerPlaceholderVertex(this.getShape());\n DoublePlaceholderVertex muPlaceholder = new DoublePlaceholderVertex(mu.getShape());\n\n return LogProbGraph.builder()\n .input(t... | {
"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_176 | {
"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 logProbGraphIsNegInfIfXIsLessThanOrEqualToLocation() {\n DoubleVertex location = ConstantVertex.of(1., 1.);\n DoubleVertex scale = ConstantVertex.of(10., 10.);\n ParetoVertex paretoVertex = new ParetoVertex(location, scale);\n LogProbGraph logProbGraph = p... | {
"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_121 | {
"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 fourValuesEquallyWeightedSummingToOne() {\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.25))... | {
"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_59 | {
"fields": [],
"file": "keanu-project/src/test/java/io/improbable/keanu/util/status/KeanuAnimationComponentTest.java",
"identifier": "KeanuAnimationComponentTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void animationChangesEachRender() {\n KeanuAnimationComponent animationComponent = new KeanuAnimationComponent();\n assertThat(animationComponent.render(), equalTo(\"\\r|Keanu|\"));\n assertThat(animationComponent.render(), equalTo(\"\\r\\\\Keanu/\"));\n }",
"cla... | {
"fields": [
{
"declarator": "nextFrameIndex = new AtomicInteger(0)",
"modifier": "private final",
"original_string": "private final AtomicInteger nextFrameIndex = new AtomicInteger(0);",
"type": "AtomicInteger",
"var_name": "nextFrameIndex"
},
{
"declarator": "MIDDLE_... | {
"body": "@Override\n public String render() {\n String result = \"\\r\";\n result += FRAMES[nextFrameIndex.getAndIncrement() % FRAMES.length];\n return result;\n }",
"class_method_signature": "KeanuAnimationComponent.render()",
"constructor": false,
"full_signature": "@Override publ... | {
"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_208 | {
"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 logProbGraphIsCorrectScalar() {\n DoubleVertex p = ConstantVertex.of(0.25);\n GeometricVertex myVertex = new GeometricVertex(p);\n LogProbGraph logProbGraph = myVertex.logProbGraph();\n\n LogProbGraphValueFeeder.feedValue(logProbGraph, p, p.getValue());\n\... | {
"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"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.