id
stringlengths
7
14
test_class
dict
test_case
dict
focal_class
dict
focal_method
dict
repository
dict
14333932_48
{ "fields": [ { "declarator": "VEC1 = {-1.0f, 2.5f, 3.0f}", "modifier": "private static final", "original_string": "private static final float[] VEC1 = {-1.0f, 2.5f, 3.0f};", "type": "float[]", "var_name": "VEC1" }, { "declarator": "VEC2 = {1.5f, -1.5f, 0.0f}", "m...
{ "body": "@Test\n public void testNormalize() {\n float[] vec = {-1.0f, 2.5f, 3.0f};\n SimpleVectorMath.normalize(vec);\n assertEquals(1.0f, (float) SimpleVectorMath.norm(vec));\n assertEquals((float) SimpleVectorMath.norm(VEC1), (float) SimpleVectorMath.dot(vec, VEC1));\n }", "class_method_signature...
{ "fields": [], "file": "common/src/main/java/com/cloudera/oryx/common/math/SimpleVectorMath.java", "identifier": "SimpleVectorMath", "interfaces": "", "methods": [ { "class_method_signature": "SimpleVectorMath.SimpleVectorMath()", "constructor": true, "full_signature": "private SimpleV...
{ "body": "public static void normalize(float[] x) {\n double norm = norm(x);\n for (int i = 0; i < x.length; i++) {\n x[i] /= norm;\n }\n }", "class_method_signature": "SimpleVectorMath.normalize(float[] x)", "constructor": false, "full_signature": "public static void normalize(float[] x)", "i...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_3
{ "fields": [], "file": "common-servcomp/src/test/java/com/cloudera/oryx/common/servcomp/NamespacesTest.java", "identifier": "NamespacesTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testNamespaces() throws Exception {\n Config config = ConfigUtils.getDefaultConfig();\n assertEquals(\"/tmp/OryxTest/00001/\",\n Namespaces.getInstanceGenerationPrefix(config.getString(\"model.instance-dir\"), 1L));\n assertEquals(\"/tmp/OryxTest/00001/tmp/iter...
{ "fields": [ { "declarator": "instance = new Namespaces()", "modifier": "private static final", "original_string": "private static final Namespaces instance = new Namespaces();", "type": "Namespaces", "var_name": "instance" }, { "declarator": "prefix", "modifier"...
{ "body": "private Namespaces() {\n if (ConfigUtils.getDefaultConfig().getBoolean(\"model.local\")) {\n prefix = \"file:\";\n } else {\n URI defaultURI = FileSystem.getDefaultUri(new OryxConfiguration());\n String host = defaultURI.getHost();\n int port = defaultURI.getPort();\n if (por...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_29
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/io/DelimitedDataUtilsTest.java", "identifier": "DelimitedDataUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testEncodeQuote() {\n assertEquals(\"foo,\\\"bar\\\"\\\"bing\\\"\", DelimitedDataUtils.encode(\"foo\", \"bar\\\"bing\"));\n }", "class_method_signature": "DelimitedDataUtilsTest.testEncodeQuote()", "constructor": false, "full_signature": "@Test public void testEncodeQuote()",...
{ "fields": [ { "declarator": "DELIMITER = ConfigUtils.getDefaultConfig().getString(\"inbound.delim\").charAt(0)", "modifier": "public static final", "original_string": "public static final char DELIMITER = ConfigUtils.getDefaultConfig().getString(\"inbound.delim\").charAt(0);", "type": "c...
{ "body": "public static String encode(Object... columns) {\n return encode(columns, DELIMITER);\n }", "class_method_signature": "DelimitedDataUtils.encode(Object... columns)", "constructor": false, "full_signature": "public static String encode(Object... columns)", "identifier": "encode", "invocations"...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_91
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/collection/LongSetTest.java", "identifier": "LongSetTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testIterator() {\n LongSet set = buildTestFastSet();\n Collection<Long> expected = new HashSet<Long>(3);\n expected.add(1L);\n expected.add(2L);\n expected.add(3L);\n LongPrimitiveIterator it = set.iterator();\n while (it.hasNext()) {\n expected.remove(it.next...
{ "fields": [ { "declarator": "LOAD_FACTOR = 1.25", "modifier": "private static final", "original_string": "private static final double LOAD_FACTOR = 1.25;", "type": "double", "var_name": "LOAD_FACTOR" }, { "declarator": "MAX_SIZE = (int) (RandomUtils.MAX_INT_SMALLER_TW...
{ "body": "@Override\n public LongPrimitiveIterator iterator() {\n return new KeyIterator();\n }", "class_method_signature": "LongSet.iterator()", "constructor": false, "full_signature": "@Override public LongPrimitiveIterator iterator()", "identifier": "iterator", "invocations": [], "modifiers": "@O...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_87
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/collection/LongSetTest.java", "identifier": "LongSetTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testRemove() {\n LongSet set = new LongSet();\n set.add(1);\n set.remove(1);\n assertEquals(0, set.size());\n assertTrue(set.isEmpty());\n assertFalse(set.contains(1));\n }", "class_method_signature": "LongSetTest.testRemove()", "constructor": false, "full_sign...
{ "fields": [ { "declarator": "LOAD_FACTOR = 1.25", "modifier": "private static final", "original_string": "private static final double LOAD_FACTOR = 1.25;", "type": "double", "var_name": "LOAD_FACTOR" }, { "declarator": "MAX_SIZE = (int) (RandomUtils.MAX_INT_SMALLER_TW...
{ "body": "public boolean remove(long key) {\n if (key == NULL || key == REMOVED) {\n return false;\n }\n int index = find(key);\n if (keys[index] == NULL) {\n return false;\n }\n keys[index] = REMOVED;\n numEntries--;\n return true;\n }", "class_method_signature": "LongSet.remove...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_68
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/LangUtilsTest.java", "identifier": "LangUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test(expected = IllegalArgumentException.class)\n public void testFloatNaN() {\n LangUtils.parseFloat(\"NaN\");\n }", "class_method_signature": "LangUtilsTest.testFloatNaN()", "constructor": false, "full_signature": "@Test(expected = IllegalArgumentException.class) public void testFloatNaN()", ...
{ "fields": [], "file": "common/src/main/java/com/cloudera/oryx/common/LangUtils.java", "identifier": "LangUtils", "interfaces": "", "methods": [ { "class_method_signature": "LangUtils.LangUtils()", "constructor": true, "full_signature": "private LangUtils()", "identifier": "LangU...
{ "body": "public static float parseFloat(String s) {\n float value = Float.parseFloat(s);\n Preconditions.checkArgument(Floats.isFinite(value), \"Bad value: %s\", value);\n return value;\n }", "class_method_signature": "LangUtils.parseFloat(String s)", "constructor": false, "full_signature": "public ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_44
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/math/MatrixUtilsTest.java", "identifier": "MatrixUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testTransposeTimesSelf() {\n LongObjectMap<float[]> M = new LongObjectMap<float[]>();\n M.put(1L, new float[] {4.0f, -1.0f, -5.0f});\n M.put(2L, new float[] {2.0f, 0.0f, 3.0f});\n RealMatrix MTM = MatrixUtils.transposeTimesSelf(M);\n assertArrayEquals(new double[]{20.0, ...
{ "fields": [ { "declarator": "MATRIX_DATA_FIELD = ClassUtils.loadField(Array2DRowRealMatrix.class, \"data\")", "modifier": "private static final", "original_string": "private static final Field MATRIX_DATA_FIELD = ClassUtils.loadField(Array2DRowRealMatrix.class, \"data\");", "type": "Fiel...
{ "body": "public static RealMatrix transposeTimesSelf(LongObjectMap<float[]> M) {\n if (M == null || M.isEmpty()) {\n return null;\n }\n RealMatrix result = null;\n for (LongObjectMap.MapEntry<float[]> entry : M.entrySet()) {\n float[] vector = entry.getValue();\n int dimension = vector.le...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_13
{ "fields": [], "file": "als-common/src/test/java/com/cloudera/oryx/als/common/TopNTest.java", "identifier": "TopNTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testTopPlusOne() {\n List<NumericIDValue> candidates = makeNCandidates(4);\n List<NumericIDValue> top3 = TopN.selectTopN(candidates.iterator(), 3);\n assertNotNull(top3);\n assertEquals(3, top3.size());\n assertEquals(4L, top3.get(0).getID());\n assertEquals(4.0f, top...
{ "fields": [], "file": "als-common/src/main/java/com/cloudera/oryx/als/common/TopN.java", "identifier": "TopN", "interfaces": "", "methods": [ { "class_method_signature": "TopN.TopN()", "constructor": true, "full_signature": "private TopN()", "identifier": "TopN", "modifier...
{ "body": "public static List<NumericIDValue> selectTopN(Iterator<NumericIDValue> values, int n) {\n Queue<NumericIDValue> topN = initialQueue(n);\n selectTopNIntoQueue(topN, values, n);\n return selectTopNFromQueue(topN, n);\n }", "class_method_signature": "TopN.selectTopN(Iterator<NumericIDValue> values...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_103
{ "fields": [], "file": "rdf-common/src/test/java/com/cloudera/oryx/rdf/common/information/InformationTest.java", "identifier": "InformationTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testOneClassInformation() {\n assertEquals(0.0, Information.entropy(new int[] {1}));\n }", "class_method_signature": "InformationTest.testOneClassInformation()", "constructor": false, "full_signature": "@Test public void testOneClassInformation()", "identifier": "testOneCla...
{ "fields": [], "file": "rdf-common/src/main/java/com/cloudera/oryx/rdf/common/information/Information.java", "identifier": "Information", "interfaces": "", "methods": [ { "class_method_signature": "Information.Information()", "constructor": true, "full_signature": "private Information(...
{ "body": "public static double entropy(int[] counts) {\n // Entropy is really, over all counts:\n // sum (-p_i * ln p_i)\n // where p_i = count_i / total\n // terms where count is 0 or 1 are 0, so can go away\n // Here we actually compute total as we go and account for it later, which avoids\n // ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_52
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/math/VectorsTest.java", "identifier": "VectorsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testSparse() {\n RealVector sparse = Vectors.sparse(Integer.MAX_VALUE);\n assertEquals(Integer.MAX_VALUE, sparse.getDimension());\n assertEquals(0.0, sparse.getEntry(0));\n }", "class_method_signature": "VectorsTest.testSparse()", "constructor": false, "full_signature":...
{ "fields": [], "file": "common/src/main/java/com/cloudera/oryx/common/math/Vectors.java", "identifier": "Vectors", "interfaces": "", "methods": [ { "class_method_signature": "Vectors.of(double... values)", "constructor": false, "full_signature": "public static RealVector of(double... va...
{ "body": "public static SparseRealVector sparse(int dimension) {\n return new OpenMapRealVector(dimension);\n }", "class_method_signature": "Vectors.sparse(int dimension)", "constructor": false, "full_signature": "public static SparseRealVector sparse(int dimension)", "identifier": "sparse", "invocatio...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_59
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/settings/APISettingsTest.java", "identifier": "APISettingsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test(expected = ConfigException.Null.class)\n public void testDefaultConfig() {\n Config generic = ConfigUtils.getDefaultConfig().getConfig(\"generic-api\");\n APISettings.create(generic);\n }", "class_method_signature": "APISettingsTest.testDefaultConfig()", "constructor": false, "full_sign...
{ "fields": [ { "declarator": "API_PATH = \"api\"", "modifier": "private static final", "original_string": "private static final String API_PATH = \"api\";", "type": "String", "var_name": "API_PATH" }, { "declarator": "HOST_STR_PARAM = \"host\"", "modifier": "priv...
{ "body": "public static APISettings create(Config config) {\n if (config.hasPath(API_PATH)) {\n config = config.getConfig(API_PATH);\n }\n int port = checkPort(config.getInt(PORT_INT_PARAM));\n int securePort = checkPort(config.getInt(SECURE_PORT_INT_PARAM));\n String host = checkHost(config.getS...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_108
{ "fields": [], "file": "rdf-common/src/test/java/com/cloudera/oryx/rdf/common/eval/WeightedPredictionTest.java", "identifier": "WeightedPredictionTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testCategoricalVote() {\n List<CategoricalPrediction> predictions = Lists.newArrayList(\n new CategoricalPrediction(new int[] {0, 1, 2}),\n new CategoricalPrediction(new int[] {6, 2, 0}),\n new CategoricalPrediction(new int[] {0, 2, 0})\n );\n double[] wei...
{ "fields": [], "file": "rdf-common/src/main/java/com/cloudera/oryx/rdf/common/eval/WeightedPrediction.java", "identifier": "WeightedPrediction", "interfaces": "", "methods": [ { "class_method_signature": "WeightedPrediction.WeightedPrediction()", "constructor": true, "full_signature": "...
{ "body": "public static <T extends Prediction> Prediction voteOnFeature(List<T> predictions, double[] weights) {\n switch (predictions.iterator().next().getFeatureType()) {\n case NUMERIC:\n @SuppressWarnings(\"unchecked\")\n List<NumericPrediction> numericVotes = (List<NumericPrediction>) pred...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_4
{ "fields": [], "file": "common-servcomp/src/test/java/com/cloudera/oryx/common/servcomp/NamespacesTest.java", "identifier": "NamespacesTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test(expected = IllegalArgumentException.class)\n public void testNegativeGenerationID() throws Exception {\n Namespaces.getInstanceGenerationPrefix(ConfigUtils.getDefaultConfig().getString(\"model.instance-dir\"), -1L);\n }", "class_method_signature": "NamespacesTest.testNegativeGenerationID()", ...
{ "fields": [ { "declarator": "instance = new Namespaces()", "modifier": "private static final", "original_string": "private static final Namespaces instance = new Namespaces();", "type": "Namespaces", "var_name": "instance" }, { "declarator": "prefix", "modifier"...
{ "body": "public static String getInstanceGenerationPrefix(String instanceDir, long generationID) {\n Preconditions.checkArgument(generationID >= 0L, \"Bad generation %s\", generationID);\n return getInstancePrefix(instanceDir) + getPaddedGenerationID(generationID) + '/';\n }", "class_method_signature": "Na...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_18
{ "fields": [], "file": "als-common/src/test/java/com/cloudera/oryx/als/common/StringLongMappingTest.java", "identifier": "StringLongMappingTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testToLong() {\n assertEquals(-7363431537935844490L, StringLongMapping.toLong(\"foo\"));\n }", "class_method_signature": "StringLongMappingTest.testToLong()", "constructor": false, "full_signature": "@Test public void testToLong()", "identifier": "testToLong", "invocation...
{ "fields": [ { "declarator": "MOST_LONGS_PATTERN = Pattern.compile(\"^-?\\\\d{1,18}$\")", "modifier": "private static final", "original_string": "private static final Pattern MOST_LONGS_PATTERN = Pattern.compile(\"^-?\\\\d{1,18}$\");", "type": "Pattern", "var_name": "MOST_LONGS_PATT...
{ "body": "public static long toLong(String id) {\n return MOST_LONGS_PATTERN.matcher(id).matches() ? Long.parseLong(id) : RandomUtils.hash(id);\n }", "class_method_signature": "StringLongMapping.toLong(String id)", "constructor": false, "full_signature": "public static long toLong(String id)", "identifie...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_34
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/io/DelimitedDataUtilsTest.java", "identifier": "DelimitedDataUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testVsIterable() {\n assertEquals(DelimitedDataUtils.encode(\"foo\", \"bar\"), DelimitedDataUtils.encode(Arrays.asList(\"foo\", \"bar\")));\n }", "class_method_signature": "DelimitedDataUtilsTest.testVsIterable()", "constructor": false, "full_signature": "@Test public void te...
{ "fields": [ { "declarator": "DELIMITER = ConfigUtils.getDefaultConfig().getString(\"inbound.delim\").charAt(0)", "modifier": "public static final", "original_string": "public static final char DELIMITER = ConfigUtils.getDefaultConfig().getString(\"inbound.delim\").charAt(0);", "type": "c...
{ "body": "public static String encode(Object... columns) {\n return encode(columns, DELIMITER);\n }", "class_method_signature": "DelimitedDataUtils.encode(Object... columns)", "constructor": false, "full_signature": "public static String encode(Object... columns)", "identifier": "encode", "invocations"...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_63
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/ClassUtilsTest.java", "identifier": "ClassUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testInstantiateWithArgs() {\n Number n = ClassUtils.loadInstanceOf(Integer.class.getName(),\n Number.class,\n new Class<?>[]{int.class},\n new Object[]{3});\n assertEquals(3, n.intValue());\n }", "class_method_signature": "ClassUtilsTest.testInstantiateWit...
{ "fields": [ { "declarator": "NO_TYPES = new Class<?>[0]", "modifier": "private static final", "original_string": "private static final Class<?>[] NO_TYPES = new Class<?>[0];", "type": "Class<?>[]", "var_name": "NO_TYPES" }, { "declarator": "NO_ARGS = new Object[0]", ...
{ "body": "public static <T> T loadInstanceOf(Class<T> clazz) {\n return loadInstanceOf(clazz.getName(), clazz);\n }", "class_method_signature": "ClassUtils.loadInstanceOf(Class<T> clazz)", "constructor": false, "full_signature": "public static T loadInstanceOf(Class<T> clazz)", "identifier": "loadInstanc...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_75
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/collection/LongObjectMapTest.java", "identifier": "LongObjectMapTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testClear() {\n LongObjectMap<Long> map = new LongObjectMap<Long>();\n map.put(500000L, 2L);\n map.clear();\n assertEquals(0, map.size());\n assertTrue(map.isEmpty());\n assertNull(map.get(500000L));\n }", "class_method_signature": "LongObjectMapTest.testClear()", ...
{ "fields": [ { "declarator": "LOAD_FACTOR = 1.25", "modifier": "private static final", "original_string": "private static final double LOAD_FACTOR = 1.25;", "type": "double", "var_name": "LOAD_FACTOR" }, { "declarator": "MAX_SIZE = (int) (RandomUtils.MAX_INT_SMALLER_TW...
{ "body": "public void clear() {\n numEntries = 0;\n numSlotsUsed = 0;\n Arrays.fill(keys, NULL);\n Arrays.fill(values, null);\n }", "class_method_signature": "LongObjectMap.clear()", "constructor": false, "full_signature": "public void clear()", "identifier": "clear", "invocations": [ "fil...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_22
{ "fields": [], "file": "kmeans-common/src/test/java/com/cloudera/oryx/kmeans/common/WeightedTest.java", "identifier": "WeightedTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testBasic() throws Exception {\n Collection<Weighted<Integer>> things = Lists.newArrayList();\n RandomGenerator rand = RandomManager.getRandom();\n for (int i = 0; i < 50; i++) {\n things.add(new Weighted<Integer>(i, rand.nextDouble()));\n }\n List<Weighted<Integer>...
{ "fields": [ { "declarator": "thing", "modifier": "private final", "original_string": "private final T thing;", "type": "T", "var_name": "thing" }, { "declarator": "weight", "modifier": "private final", "original_string": "private final double weight;", ...
{ "body": "public static <T extends Weighted<?>> List<T> sample(Iterable<T> things, int size, RandomGenerator random) {\n if (random == null) {\n random = RandomManager.getRandom();\n }\n SortedMap<Double, T> sampled = Maps.newTreeMap();\n for (T thing : things) {\n if (thing.weight() > 0) {\n ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_55
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/settings/APISettingsTest.java", "identifier": "APISettingsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testHost() {\n String validHost = \"example.com\";\n assertEquals(validHost, APISettings.checkHost(validHost));\n }", "class_method_signature": "APISettingsTest.testHost()", "constructor": false, "full_signature": "@Test public void testHost()", "identifier": "testHost",...
{ "fields": [ { "declarator": "API_PATH = \"api\"", "modifier": "private static final", "original_string": "private static final String API_PATH = \"api\";", "type": "String", "var_name": "API_PATH" }, { "declarator": "HOST_STR_PARAM = \"host\"", "modifier": "priv...
{ "body": "static String checkHost(String host) {\n Preconditions.checkArgument(host == null || (!host.startsWith(\"http://\") && !host.startsWith(\"https://\")),\n \"host should not include a URI scheme: %s\", host);\n return host;\n }", "class_method_signature": "APISettings.checkHost(String host)",...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_104
{ "fields": [], "file": "rdf-common/src/test/java/com/cloudera/oryx/rdf/common/information/InformationTest.java", "identifier": "InformationTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testTwoEqualClassInformation() {\n assertEquals(Math.log(2.0), Information.entropy(new int[] {1, 1}));\n }", "class_method_signature": "InformationTest.testTwoEqualClassInformation()", "constructor": false, "full_signature": "@Test public void testTwoEqualClassInformation()",...
{ "fields": [], "file": "rdf-common/src/main/java/com/cloudera/oryx/rdf/common/information/Information.java", "identifier": "Information", "interfaces": "", "methods": [ { "class_method_signature": "Information.Information()", "constructor": true, "full_signature": "private Information(...
{ "body": "public static double entropy(int[] counts) {\n // Entropy is really, over all counts:\n // sum (-p_i * ln p_i)\n // where p_i = count_i / total\n // terms where count is 0 or 1 are 0, so can go away\n // Here we actually compute total as we go and account for it later, which avoids\n // ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_14
{ "fields": [], "file": "als-common/src/test/java/com/cloudera/oryx/als/common/TopNTest.java", "identifier": "TopNTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testTopOfMany() {\n List<NumericIDValue> candidates = makeNCandidates(20);\n List<NumericIDValue> top3 = TopN.selectTopN(candidates.iterator(), 3);\n assertNotNull(top3);\n assertEquals(3, top3.size());\n assertEquals(20L, top3.get(0).getID());\n assertEquals(20.0f, t...
{ "fields": [], "file": "als-common/src/main/java/com/cloudera/oryx/als/common/TopN.java", "identifier": "TopN", "interfaces": "", "methods": [ { "class_method_signature": "TopN.TopN()", "constructor": true, "full_signature": "private TopN()", "identifier": "TopN", "modifier...
{ "body": "public static List<NumericIDValue> selectTopN(Iterator<NumericIDValue> values, int n) {\n Queue<NumericIDValue> topN = initialQueue(n);\n selectTopNIntoQueue(topN, values, n);\n return selectTopNFromQueue(topN, n);\n }", "class_method_signature": "TopN.selectTopN(Iterator<NumericIDValue> values...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_8
{ "fields": [], "file": "als-serving/src/test/java/com/cloudera/oryx/als/serving/MultiRescorerProviderTest.java", "identifier": "MultiRescorerProviderTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testMultiMostSimilarItemsRescorer() {\n RescorerProvider multi = \n new MultiRescorerProvider(new SimpleModRescorerProvider(2), new SimpleModRescorerProvider(3));\n PairRescorer provider = multi.getMostSimilarItemsRescorer(null);\n assertNotNull(provider);\n assertTr...
{ "fields": [ { "declarator": "providers", "modifier": "private final", "original_string": "private final RescorerProvider[] providers;", "type": "RescorerProvider[]", "var_name": "providers" } ], "file": "als-serving/src/main/java/com/cloudera/oryx/als/serving/MultiRescorerP...
{ "body": "@Override\n public PairRescorer getMostSimilarItemsRescorer(OryxRecommender recommender, String... args) {\n List<PairRescorer> rescorers = Lists.newArrayListWithCapacity(providers.length);\n for (RescorerProvider provider : providers) {\n PairRescorer rescorer = provider.getMostSimilarItemsRes...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_112
{ "fields": [], "file": "rdf-common/src/test/java/com/cloudera/oryx/rdf/common/rule/CategoricalPredictionTest.java", "identifier": "CategoricalPredictionTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testUpdate() {\n int[] counts = { 0, 1, 3, 0, 4, 0};\n CategoricalPrediction prediction = new CategoricalPrediction(counts);\n Example example = new Example(CategoricalFeature.forValue(2));\n prediction.update(example);\n prediction.update(example);\n assertEquals(2, ...
{ "fields": [ { "declarator": "categoryCounts", "modifier": "private final", "original_string": "private final int[] categoryCounts;", "type": "int[]", "var_name": "categoryCounts" }, { "declarator": "categoryProbabilities", "modifier": "private final", "ori...
{ "body": "@Override\n public synchronized void update(Example train) {\n CategoricalFeature target = (CategoricalFeature) train.getTarget();\n int valueID = target.getValueID();\n categoryCounts[valueID]++;\n setCount(getCount() + 1);\n recompute();\n }", "class_method_signature": "CategoricalPred...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_43
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/math/MatrixUtilsTest.java", "identifier": "MatrixUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testRemove() {\n LongObjectMap<LongFloatMap> byRow = new LongObjectMap<LongFloatMap>();\n LongObjectMap<LongFloatMap> byCol = new LongObjectMap<LongFloatMap>();\n MatrixUtils.addTo(0L, 0L, -1.0f, byRow, byCol);\n MatrixUtils.addTo(4L, 1L, 2.0f, byRow, byCol);\n MatrixUti...
{ "fields": [ { "declarator": "MATRIX_DATA_FIELD = ClassUtils.loadField(Array2DRowRealMatrix.class, \"data\")", "modifier": "private static final", "original_string": "private static final Field MATRIX_DATA_FIELD = ClassUtils.loadField(Array2DRowRealMatrix.class, \"data\");", "type": "Fiel...
{ "body": "public static void remove(long row,\n long column,\n LongObjectMap<LongFloatMap> RbyRow,\n LongObjectMap<LongFloatMap> RbyColumn) {\n removeByRow(row, column, RbyRow);\n removeByRow(column, row, RbyColumn);\n }", "cla...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_38
{ "fields": [ { "declarator": "SOME_BYTES = { 0x01, 0x02, 0x03 }", "modifier": "private static final", "original_string": "private static final byte[] SOME_BYTES = { 0x01, 0x02, 0x03 };", "type": "byte[]", "var_name": "SOME_BYTES" } ], "file": "common/src/test/java/com/cloude...
{ "body": "@Test\n public void testCopyStream() throws IOException {\n File tempDir = Files.createTempDir();\n tempDir.deleteOnExit();\n File subFile1 = new File(tempDir, \"subFile1\");\n Files.write(SOME_BYTES, subFile1);\n File subFile2 = new File(tempDir, \"subFile2\");\n IOUtils.copyURLToFile(s...
{ "fields": [ { "declarator": "CSV_COMPRESSED_FILTER = new PatternFilenameFilter(\".+\\\\.(csv|zip|gz)$\")", "modifier": "public static final", "original_string": "public static final FilenameFilter CSV_COMPRESSED_FILTER = new PatternFilenameFilter(\".+\\\\.(csv|zip|gz)$\");", "type": "Fil...
{ "body": "public static void copyURLToFile(URL url, File file) throws IOException {\n InputStream in = url.openStream();\n try {\n copyStreamToFile(in, file);\n } finally {\n in.close();\n }\n }", "class_method_signature": "IOUtils.copyURLToFile(URL url, File file)", "constructor": false, ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_80
{ "fields": [ { "declarator": "NUM_BITS = 100", "modifier": "private static final", "original_string": "private static final int NUM_BITS = 100;", "type": "int", "var_name": "NUM_BITS" } ], "file": "common/src/test/java/com/cloudera/oryx/common/collection/BitSetTest.java", ...
{ "body": "@Test\n public void testCardinality() {\n BitSet bitSet = new BitSet(NUM_BITS);\n assertEquals(0, bitSet.cardinality());\n bitSet.set(0);\n assertEquals(1, bitSet.cardinality());\n bitSet.set(0);\n assertEquals(1, bitSet.cardinality());\n bitSet.set(1);\n assertEquals(2, bitSet.car...
{ "fields": [ { "declarator": "bits", "modifier": "private final", "original_string": "private final long[] bits;", "type": "long[]", "var_name": "bits" } ], "file": "common/src/main/java/com/cloudera/oryx/common/collection/BitSet.java", "identifier": "BitSet", "interface...
{ "body": "public int cardinality() {\n int sum = 0;\n for (long l : bits) {\n sum += Long.bitCount(l);\n }\n return sum;\n }", "class_method_signature": "BitSet.cardinality()", "constructor": false, "full_signature": "public int cardinality()", "identifier": "cardinality", "invocations": ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_96
{ "fields": [], "file": "computation-common/src/test/java/com/cloudera/oryx/computation/common/DependenciesSchedulerTest.java", "identifier": "DependenciesSchedulerTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testSequence() {\n DependenciesScheduler<String> scheduler = new DependenciesScheduler<String>();\n List<Collection<String>> schedule = scheduler.schedule(Collections.singleton(new DependsOn<String>(\"foo\", \"bar\")));\n assertEquals(2, schedule.size());\n assertEquals(Set...
{ "fields": [ { "declarator": "log = LoggerFactory.getLogger(DependenciesScheduler.class)", "modifier": "private static final", "original_string": "private static final Logger log = LoggerFactory.getLogger(DependenciesScheduler.class);", "type": "Logger", "var_name": "log" } ],...
{ "body": "List<Collection<T>> schedule(Collection<DependsOn<T>> dependencies) {\n\n log.info(\"Scheduling: {}\", dependencies);\n\n // This will map steps to a collection of all steps that must come before\n Map<T,Collection<T>> prerequisites = Maps.newHashMapWithExpectedSize(dependencies.size());\n\n fo...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_79
{ "fields": [ { "declarator": "NUM_BITS = 100", "modifier": "private static final", "original_string": "private static final int NUM_BITS = 100;", "type": "int", "var_name": "NUM_BITS" } ], "file": "common/src/test/java/com/cloudera/oryx/common/collection/BitSetTest.java", ...
{ "body": "@Test\n public void testClear() {\n BitSet bitSet = new BitSet(NUM_BITS);\n for (int i = 0; i < NUM_BITS; i++) {\n bitSet.set(i);\n }\n for (int i = 0; i < NUM_BITS; i++) {\n assertTrue(bitSet.get(i));\n }\n bitSet.clear();\n for (int i = 0; i < NUM_BITS; i++) {\n asser...
{ "fields": [ { "declarator": "bits", "modifier": "private final", "original_string": "private final long[] bits;", "type": "long[]", "var_name": "bits" } ], "file": "common/src/main/java/com/cloudera/oryx/common/collection/BitSet.java", "identifier": "BitSet", "interface...
{ "body": "public void clear(int index) {\n // skipping range check for speed\n bits[index >>> 6] &= ~(1L << (index & 0x3F));\n }", "class_method_signature": "BitSet.clear(int index)", "constructor": false, "full_signature": "public void clear(int index)", "identifier": "clear", "invocations": [], ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_97
{ "fields": [], "file": "computation-common/src/test/java/com/cloudera/oryx/computation/common/DependenciesSchedulerTest.java", "identifier": "DependenciesSchedulerTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testParallel() {\n Collection<DependsOn<String>> dependencies = Lists.newArrayListWithCapacity(2);\n dependencies.add(new DependsOn<String>(\"foo\"));\n dependencies.add(new DependsOn<String>(\"bar\"));\n DependenciesScheduler<String> scheduler = new DependenciesScheduler<S...
{ "fields": [ { "declarator": "log = LoggerFactory.getLogger(DependenciesScheduler.class)", "modifier": "private static final", "original_string": "private static final Logger log = LoggerFactory.getLogger(DependenciesScheduler.class);", "type": "Logger", "var_name": "log" } ],...
{ "body": "List<Collection<T>> schedule(Collection<DependsOn<T>> dependencies) {\n\n log.info(\"Scheduling: {}\", dependencies);\n\n // This will map steps to a collection of all steps that must come before\n Map<T,Collection<T>> prerequisites = Maps.newHashMapWithExpectedSize(dependencies.size());\n\n fo...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_78
{ "fields": [ { "declarator": "NUM_BITS = 100", "modifier": "private static final", "original_string": "private static final int NUM_BITS = 100;", "type": "int", "var_name": "NUM_BITS" } ], "file": "common/src/test/java/com/cloudera/oryx/common/collection/BitSetTest.java", ...
{ "body": "@Test(expected = ArrayIndexOutOfBoundsException.class)\n public void testBounds2() {\n BitSet bitSet = new BitSet(NUM_BITS);\n bitSet.set(-1);\n }", "class_method_signature": "BitSetTest.testBounds2()", "constructor": false, "full_signature": "@Test(expected = ArrayIndexOutOfBoundsException.c...
{ "fields": [ { "declarator": "bits", "modifier": "private final", "original_string": "private final long[] bits;", "type": "long[]", "var_name": "bits" } ], "file": "common/src/main/java/com/cloudera/oryx/common/collection/BitSet.java", "identifier": "BitSet", "interface...
{ "body": "public void set(int index) {\n // skipping range check for speed\n bits[index >>> 6] |= 1L << (index & 0x3F);\n }", "class_method_signature": "BitSet.set(int index)", "constructor": false, "full_signature": "public void set(int index)", "identifier": "set", "invocations": [], "modifiers"...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_81
{ "fields": [ { "declarator": "NUM_BITS = 100", "modifier": "private static final", "original_string": "private static final int NUM_BITS = 100;", "type": "int", "var_name": "NUM_BITS" } ], "file": "common/src/test/java/com/cloudera/oryx/common/collection/BitSetTest.java", ...
{ "body": "@Test\n public void testNextSetBit() {\n BitSet bitSet = new BitSet(NUM_BITS);\n assertEquals(-1, bitSet.nextSetBit(0));\n\n bitSet.set(3);\n assertEquals(3, bitSet.nextSetBit(0));\n assertEquals(3, bitSet.nextSetBit(2));\n assertEquals(3, bitSet.nextSetBit(3));\n assertEquals(-1, bit...
{ "fields": [ { "declarator": "bits", "modifier": "private final", "original_string": "private final long[] bits;", "type": "long[]", "var_name": "bits" } ], "file": "common/src/main/java/com/cloudera/oryx/common/collection/BitSet.java", "identifier": "BitSet", "interface...
{ "body": "public int nextSetBit(int index) {\n int offset = index >>> 6;\n int offsetInLong = index & 0x3F;\n long mask = ~((1L << offsetInLong) - 1);\n while (offset < bits.length && (bits[offset] & mask) == 0) {\n offset++;\n mask = -1L;\n }\n if (offset == bits.length) {\n return ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_39
{ "fields": [ { "declarator": "SOME_BYTES = { 0x01, 0x02, 0x03 }", "modifier": "private static final", "original_string": "private static final byte[] SOME_BYTES = { 0x01, 0x02, 0x03 };", "type": "byte[]", "var_name": "SOME_BYTES" } ], "file": "common/src/test/java/com/cloude...
{ "body": "@Test\n public void testDeleteRecursively() throws IOException {\n File tempDir = Files.createTempDir();\n tempDir.deleteOnExit();\n assertTrue(tempDir.exists());\n File subFile1 = new File(tempDir, \"subFile1\");\n Files.write(SOME_BYTES, subFile1);\n assertTrue(subFile1.exists());\n ...
{ "fields": [ { "declarator": "CSV_COMPRESSED_FILTER = new PatternFilenameFilter(\".+\\\\.(csv|zip|gz)$\")", "modifier": "public static final", "original_string": "public static final FilenameFilter CSV_COMPRESSED_FILTER = new PatternFilenameFilter(\".+\\\\.(csv|zip|gz)$\");", "type": "Fil...
{ "body": "public static void deleteRecursively(File dir) throws IOException {\n if (dir == null || !dir.exists()) {\n return;\n }\n Deque<File> stack = new ArrayDeque<File>();\n stack.push(dir);\n while (!stack.isEmpty()) {\n File topElement = stack.peek();\n if (topElement.isDirectory(...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_42
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/math/MatrixUtilsTest.java", "identifier": "MatrixUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testAddTo() {\n LongObjectMap<LongFloatMap> byRow = new LongObjectMap<LongFloatMap>();\n assertNull(byRow.get(0L));\n assertNull(byRow.get(1L));\n assertNull(byRow.get(4L));\n LongObjectMap<LongFloatMap> byCol = new LongObjectMap<LongFloatMap>();\n MatrixUtils.addTo(0...
{ "fields": [ { "declarator": "MATRIX_DATA_FIELD = ClassUtils.loadField(Array2DRowRealMatrix.class, \"data\")", "modifier": "private static final", "original_string": "private static final Field MATRIX_DATA_FIELD = ClassUtils.loadField(Array2DRowRealMatrix.class, \"data\");", "type": "Fiel...
{ "body": "public static void addTo(long row,\n long column,\n float value,\n LongObjectMap<LongFloatMap> RbyRow,\n LongObjectMap<LongFloatMap> RbyColumn) {\n addToByRow(row, column, value, RbyRow);\n addToBy...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_15
{ "fields": [], "file": "als-common/src/test/java/com/cloudera/oryx/als/common/TopNTest.java", "identifier": "TopNTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testTopOfManyIntoQueueMultithreaded() {\n BlockingQueue<NumericIDValue> top3 = Queues.newLinkedBlockingQueue();\n float[] queueLeastValue = { Float.NEGATIVE_INFINITY };\n List<NumericIDValue> candidates = makeNCandidates(20);\n TopN.selectTopNIntoQueueMultithreaded(top3, qu...
{ "fields": [], "file": "als-common/src/main/java/com/cloudera/oryx/als/common/TopN.java", "identifier": "TopN", "interfaces": "", "methods": [ { "class_method_signature": "TopN.TopN()", "constructor": true, "full_signature": "private TopN()", "identifier": "TopN", "modifier...
{ "body": "public static void selectTopNIntoQueueMultithreaded(Queue<NumericIDValue> topN,\n float[] queueLeastValue,\n Iterator<NumericIDValue> values,\n int ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_9
{ "fields": [], "file": "als-common/src/test/java/com/cloudera/oryx/als/common/DataUtilsTest.java", "identifier": "DataUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testParse() {\n assertArrayEquals(new float[] {2.0f,3.0f}, DataUtils.readFeatureVector(\"2,3\"));\n assertArrayEquals(new float[] {2.0f,-3.0f}, DataUtils.readFeatureVector(\"2, -3\"));\n assertArrayEquals(new float[] {0.4f}, DataUtils.readFeatureVector(\"0.4\"));\n assertAr...
{ "fields": [ { "declarator": "COMMA = Pattern.compile(\",\")", "modifier": "private static final", "original_string": "private static final Pattern COMMA = Pattern.compile(\",\");", "type": "Pattern", "var_name": "COMMA" } ], "file": "als-common/src/main/java/com/cloudera/or...
{ "body": "public static float[] readFeatureVector(CharSequence featureVectorString) {\n String[] elementTokens = COMMA.split(featureVectorString);\n int features = elementTokens.length;\n float[] elements = new float[features];\n for (int i = 0; i < features; i++) {\n elements[i] = LangUtils.parseFl...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_113
{ "fields": [], "file": "rdf-common/src/test/java/com/cloudera/oryx/rdf/common/rule/NumericPredictionTest.java", "identifier": "NumericPredictionTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testUpdate() {\n NumericPrediction prediction = new NumericPrediction(1.5f, 1);\n Example example = new Example(NumericFeature.forValue(2.5f));\n prediction.update(example);\n assertEquals(2.0f, prediction.getPrediction());\n }", "class_method_signature": "NumericPredict...
{ "fields": [ { "declarator": "prediction", "modifier": "private", "original_string": "private float prediction;", "type": "float", "var_name": "prediction" } ], "file": "rdf-common/src/main/java/com/cloudera/oryx/rdf/common/rule/NumericPrediction.java", "identifier": "Nume...
{ "body": "@Override\n public synchronized void update(Example train) {\n NumericFeature target = (NumericFeature) train.getTarget();\n int oldCount = getCount();\n int newCount = oldCount + 1;\n setCount(newCount);\n prediction =\n (float) ((oldCount / (double) newCount) * prediction +\n ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_105
{ "fields": [], "file": "rdf-common/src/test/java/com/cloudera/oryx/rdf/common/information/InformationTest.java", "identifier": "InformationTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testTwoUnequalClassInformation() {\n assertEquals(0.5623351446188083, Information.entropy(new int[] {2, 6}));\n }", "class_method_signature": "InformationTest.testTwoUnequalClassInformation()", "constructor": false, "full_signature": "@Test public void testTwoUnequalClassInfo...
{ "fields": [], "file": "rdf-common/src/main/java/com/cloudera/oryx/rdf/common/information/Information.java", "identifier": "Information", "interfaces": "", "methods": [ { "class_method_signature": "Information.Information()", "constructor": true, "full_signature": "private Information(...
{ "body": "public static double entropy(int[] counts) {\n // Entropy is really, over all counts:\n // sum (-p_i * ln p_i)\n // where p_i = count_i / total\n // terms where count is 0 or 1 are 0, so can go away\n // Here we actually compute total as we go and account for it later, which avoids\n // ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_54
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/settings/ConfigUtilsTest.java", "identifier": "ConfigUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testDefaultConfig() throws Exception {\n Config oc = ConfigUtils.getDefaultConfig();\n assertEquals(\"/tmp/Oryx\", oc.getString(\"serving-layer.local-input-dir\"));\n }", "class_method_signature": "ConfigUtilsTest.testDefaultConfig()", "constructor": false, "full_signature...
{ "fields": [ { "declarator": "DEFAULT_CONFIG = null", "modifier": "private static", "original_string": "private static Config DEFAULT_CONFIG = null;", "type": "Config", "var_name": "DEFAULT_CONFIG" } ], "file": "common/src/main/java/com/cloudera/oryx/common/settings/ConfigUt...
{ "body": "public static synchronized Config getDefaultConfig() {\n if (DEFAULT_CONFIG == null) {\n DEFAULT_CONFIG = ConfigFactory.load();\n }\n return DEFAULT_CONFIG;\n }", "class_method_signature": "ConfigUtils.getDefaultConfig()", "constructor": false, "full_signature": "public static synchron...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_23
{ "fields": [], "file": "kmeans-common/src/test/java/com/cloudera/oryx/kmeans/common/WeightedTest.java", "identifier": "WeightedTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testEmpty() throws Exception {\n RandomGenerator rand = RandomManager.getRandom();\n assertEquals(0, Weighted.sample(ImmutableList.<Weighted<Long>>of(), 10, rand).size());\n }", "class_method_signature": "WeightedTest.testEmpty()", "constructor": false, "full_signature": "...
{ "fields": [ { "declarator": "thing", "modifier": "private final", "original_string": "private final T thing;", "type": "T", "var_name": "thing" }, { "declarator": "weight", "modifier": "private final", "original_string": "private final double weight;", ...
{ "body": "public static <T extends Weighted<?>> List<T> sample(Iterable<T> things, int size, RandomGenerator random) {\n if (random == null) {\n random = RandomManager.getRandom();\n }\n SortedMap<Double, T> sampled = Maps.newTreeMap();\n for (T thing : things) {\n if (thing.weight() > 0) {\n ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_74
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/collection/LongObjectMapTest.java", "identifier": "LongObjectMapTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testRemove() {\n LongObjectMap<Long> map = new LongObjectMap<Long>();\n map.put(500000L, 2L);\n map.remove(500000L);\n assertEquals(0, map.size());\n assertTrue(map.isEmpty());\n assertNull(map.get(500000L));\n }", "class_method_signature": "LongObjectMapTest.testR...
{ "fields": [ { "declarator": "LOAD_FACTOR = 1.25", "modifier": "private static final", "original_string": "private static final double LOAD_FACTOR = 1.25;", "type": "double", "var_name": "LOAD_FACTOR" }, { "declarator": "MAX_SIZE = (int) (RandomUtils.MAX_INT_SMALLER_TW...
{ "body": "public V remove(long key) {\n if (key == NULL || key == REMOVED) {\n return null;\n }\n int index = find(key);\n if (keys[index] == NULL) {\n return null;\n } else {\n keys[index] = REMOVED;\n numEntries--;\n V oldValue = values[index];\n values[index] = null;\n...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_62
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/ClassUtilsTest.java", "identifier": "ClassUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testInstantiate() {\n Set<?> set = ClassUtils.loadInstanceOf(HashSet.class.getName(), Set.class);\n assertTrue(set instanceof HashSet);\n }", "class_method_signature": "ClassUtilsTest.testInstantiate()", "constructor": false, "full_signature": "@Test public void testInstan...
{ "fields": [ { "declarator": "NO_TYPES = new Class<?>[0]", "modifier": "private static final", "original_string": "private static final Class<?>[] NO_TYPES = new Class<?>[0];", "type": "Class<?>[]", "var_name": "NO_TYPES" }, { "declarator": "NO_ARGS = new Object[0]", ...
{ "body": "public static <T> T loadInstanceOf(Class<T> clazz) {\n return loadInstanceOf(clazz.getName(), clazz);\n }", "class_method_signature": "ClassUtils.loadInstanceOf(Class<T> clazz)", "constructor": false, "full_signature": "public static T loadInstanceOf(Class<T> clazz)", "identifier": "loadInstanc...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_35
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/io/DelimitedDataUtilsTest.java", "identifier": "DelimitedDataUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testVsObject() {\n assertEquals(DelimitedDataUtils.encode(\"3.0\", \"-2.0\"), DelimitedDataUtils.encode(Arrays.asList(3.0, -2.0)));\n }", "class_method_signature": "DelimitedDataUtilsTest.testVsObject()", "constructor": false, "full_signature": "@Test public void testVsObject...
{ "fields": [ { "declarator": "DELIMITER = ConfigUtils.getDefaultConfig().getString(\"inbound.delim\").charAt(0)", "modifier": "public static final", "original_string": "public static final char DELIMITER = ConfigUtils.getDefaultConfig().getString(\"inbound.delim\").charAt(0);", "type": "c...
{ "body": "public static String encode(Object... columns) {\n return encode(columns, DELIMITER);\n }", "class_method_signature": "DelimitedDataUtils.encode(Object... columns)", "constructor": false, "full_signature": "public static String encode(Object... columns)", "identifier": "encode", "invocations"...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_5
{ "fields": [], "file": "als-serving/src/test/java/com/cloudera/oryx/als/serving/MultiRescorerProviderTest.java", "identifier": "MultiRescorerProviderTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testMultiRecommendRescorer() {\n RescorerProvider multi = \n new MultiRescorerProvider(new SimpleModRescorerProvider(2), new SimpleModRescorerProvider(3));\n \n Rescorer provider = multi.getRecommendRescorer(new String[]{\"ABCDE\"}, null);\n assertNull(provider);\n ...
{ "fields": [ { "declarator": "providers", "modifier": "private final", "original_string": "private final RescorerProvider[] providers;", "type": "RescorerProvider[]", "var_name": "providers" } ], "file": "als-serving/src/main/java/com/cloudera/oryx/als/serving/MultiRescorerP...
{ "body": "@Override\n public Rescorer getRecommendRescorer(String[] userIDs, OryxRecommender recommender, String... args) {\n List<Rescorer> rescorers = Lists.newArrayListWithCapacity(providers.length);\n for (RescorerProvider provider : providers) {\n Rescorer rescorer = provider.getRecommendRescorer(us...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_19
{ "fields": [], "file": "als-common/src/test/java/com/cloudera/oryx/als/common/StringLongMappingTest.java", "identifier": "StringLongMappingTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testNumeric() {\n assertEquals(0, StringLongMapping.toLong(\"0\"));\n }", "class_method_signature": "StringLongMappingTest.testNumeric()", "constructor": false, "full_signature": "@Test public void testNumeric()", "identifier": "testNumeric", "invocations": [ "assertE...
{ "fields": [ { "declarator": "MOST_LONGS_PATTERN = Pattern.compile(\"^-?\\\\d{1,18}$\")", "modifier": "private static final", "original_string": "private static final Pattern MOST_LONGS_PATTERN = Pattern.compile(\"^-?\\\\d{1,18}$\");", "type": "Pattern", "var_name": "MOST_LONGS_PATT...
{ "body": "public static long toLong(String id) {\n return MOST_LONGS_PATTERN.matcher(id).matches() ? Long.parseLong(id) : RandomUtils.hash(id);\n }", "class_method_signature": "StringLongMapping.toLong(String id)", "constructor": false, "full_signature": "public static long toLong(String id)", "identifie...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_109
{ "fields": [], "file": "rdf-common/src/test/java/com/cloudera/oryx/rdf/common/eval/WeightedPredictionTest.java", "identifier": "WeightedPredictionTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testCategoricalVoteWeighted() {\n List<CategoricalPrediction> predictions = Lists.newArrayList(\n new CategoricalPrediction(new int[] {0, 1, 2}),\n new CategoricalPrediction(new int[] {6, 2, 0}),\n new CategoricalPrediction(new int[] {0, 2, 0})\n );\n doub...
{ "fields": [], "file": "rdf-common/src/main/java/com/cloudera/oryx/rdf/common/eval/WeightedPrediction.java", "identifier": "WeightedPrediction", "interfaces": "", "methods": [ { "class_method_signature": "WeightedPrediction.WeightedPrediction()", "constructor": true, "full_signature": "...
{ "body": "public static <T extends Prediction> Prediction voteOnFeature(List<T> predictions, double[] weights) {\n switch (predictions.iterator().next().getFeatureType()) {\n case NUMERIC:\n @SuppressWarnings(\"unchecked\")\n List<NumericPrediction> numericVotes = (List<NumericPrediction>) pred...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_58
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/settings/APISettingsTest.java", "identifier": "APISettingsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test(expected = IllegalArgumentException.class)\n public void testInvalidPort() {\n APISettings.checkPort(0);\n }", "class_method_signature": "APISettingsTest.testInvalidPort()", "constructor": false, "full_signature": "@Test(expected = IllegalArgumentException.class) public void testInvalidPor...
{ "fields": [ { "declarator": "API_PATH = \"api\"", "modifier": "private static final", "original_string": "private static final String API_PATH = \"api\";", "type": "String", "var_name": "API_PATH" }, { "declarator": "HOST_STR_PARAM = \"host\"", "modifier": "priv...
{ "body": "static int checkPort(int port) {\n Preconditions.checkArgument(port > 0, \"port must be positive: %s\", port);\n return port;\n }", "class_method_signature": "APISettings.checkPort(int port)", "constructor": false, "full_signature": "static int checkPort(int port)", "identifier": "checkPort"...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_20
{ "fields": [], "file": "als-common/src/test/java/com/cloudera/oryx/als/common/StringLongMappingTest.java", "identifier": "StringLongMappingTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testToString() {\n StringLongMapping mapping = new StringLongMapping();\n long hash = mapping.add(\"foo\");\n assertEquals(\"foo\", mapping.toString(hash));\n }", "class_method_signature": "StringLongMappingTest.testToString()", "constructor": false, "full_signature": "...
{ "fields": [ { "declarator": "MOST_LONGS_PATTERN = Pattern.compile(\"^-?\\\\d{1,18}$\")", "modifier": "private static final", "original_string": "private static final Pattern MOST_LONGS_PATTERN = Pattern.compile(\"^-?\\\\d{1,18}$\");", "type": "Pattern", "var_name": "MOST_LONGS_PATT...
{ "body": "public String toString(long numericID) {\n String id = null;\n Lock readLock = lock.readLock();\n readLock.lock();\n try {\n id = reverseMapping.get(numericID);\n } finally {\n readLock.unlock();\n }\n return id == null ? Long.toString(numericID) : id;\n }", "class_method_...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_77
{ "fields": [ { "declarator": "NUM_BITS = 100", "modifier": "private static final", "original_string": "private static final int NUM_BITS = 100;", "type": "int", "var_name": "NUM_BITS" } ], "file": "common/src/test/java/com/cloudera/oryx/common/collection/BitSetTest.java", ...
{ "body": "@Test(expected = ArrayIndexOutOfBoundsException.class)\n public void testBounds1() {\n BitSet bitSet = new BitSet(NUM_BITS);\n bitSet.set(1000);\n }", "class_method_signature": "BitSetTest.testBounds1()", "constructor": false, "full_signature": "@Test(expected = ArrayIndexOutOfBoundsException...
{ "fields": [ { "declarator": "bits", "modifier": "private final", "original_string": "private final long[] bits;", "type": "long[]", "var_name": "bits" } ], "file": "common/src/main/java/com/cloudera/oryx/common/collection/BitSet.java", "identifier": "BitSet", "interface...
{ "body": "public void set(int index) {\n // skipping range check for speed\n bits[index >>> 6] |= 1L << (index & 0x3F);\n }", "class_method_signature": "BitSet.set(int index)", "constructor": false, "full_signature": "public void set(int index)", "identifier": "set", "invocations": [], "modifiers"...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_98
{ "fields": [], "file": "computation-common/src/test/java/com/cloudera/oryx/computation/common/DependenciesSchedulerTest.java", "identifier": "DependenciesSchedulerTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testComplex() {\n Collection<DependsOn<String>> dependencies = Lists.newArrayListWithCapacity(4);\n dependencies.add(new DependsOn<String>(\"foo\", \"bar\"));\n dependencies.add(new DependsOn<String>(\"foo\", \"buzz\"));\n dependencies.add(new DependsOn<String>(\"bing\", \"...
{ "fields": [ { "declarator": "log = LoggerFactory.getLogger(DependenciesScheduler.class)", "modifier": "private static final", "original_string": "private static final Logger log = LoggerFactory.getLogger(DependenciesScheduler.class);", "type": "Logger", "var_name": "log" } ],...
{ "body": "List<Collection<T>> schedule(Collection<DependsOn<T>> dependencies) {\n\n log.info(\"Scheduling: {}\", dependencies);\n\n // This will map steps to a collection of all steps that must come before\n Map<T,Collection<T>> prerequisites = Maps.newHashMapWithExpectedSize(dependencies.size());\n\n fo...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_61
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/settings/APISettingsTest.java", "identifier": "APISettingsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testComputationLayerDefaults() {\n assertNotNull(APISettings.create(\n ConfigUtils.getDefaultConfig().getConfig(\"computation-layer.api\")));\n }", "class_method_signature": "APISettingsTest.testComputationLayerDefaults()", "constructor": false, "full_signature": "@Tes...
{ "fields": [ { "declarator": "API_PATH = \"api\"", "modifier": "private static final", "original_string": "private static final String API_PATH = \"api\";", "type": "String", "var_name": "API_PATH" }, { "declarator": "HOST_STR_PARAM = \"host\"", "modifier": "priv...
{ "body": "public static APISettings create(Config config) {\n if (config.hasPath(API_PATH)) {\n config = config.getConfig(API_PATH);\n }\n int port = checkPort(config.getInt(PORT_INT_PARAM));\n int securePort = checkPort(config.getInt(SECURE_PORT_INT_PARAM));\n String host = checkHost(config.getS...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_36
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/io/VarintTest.java", "identifier": "VarintTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testUnsignedSize() throws Exception {\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\n DataOutput out = new DataOutputStream(baos);\n int expectedSize = 0;\n for (int exponent = 0; exponent <= 62; exponent++) {\n Varint.writeUnsignedVarLong(1L << exponent,...
{ "fields": [], "file": "common/src/main/java/com/cloudera/oryx/common/io/Varint.java", "identifier": "Varint", "interfaces": "", "methods": [ { "class_method_signature": "Varint.Varint()", "constructor": true, "full_signature": "private Varint()", "identifier": "Varint", "m...
{ "body": "public static void writeUnsignedVarLong(long value, DataOutput out) throws IOException {\n while ((value & 0xFFFFFFFFFFFFFF80L) != 0L) {\n out.writeByte(((int) value & 0x7F) | 0x80);\n value >>>= 7;\n }\n out.writeByte((int) value & 0x7F);\n }", "class_method_signature": "Varint.write...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_6
{ "fields": [], "file": "als-serving/src/test/java/com/cloudera/oryx/als/serving/MultiRescorerProviderTest.java", "identifier": "MultiRescorerProviderTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testMultiRecommendToAnonymousRescorer() {\n RescorerProvider multi = \n new MultiRescorerProvider(new SimpleModRescorerProvider(2), new SimpleModRescorerProvider(3));\n \n Rescorer provider = multi.getRecommendToAnonymousRescorer(new String[]{\"ABCDE\"}, null);\n ass...
{ "fields": [ { "declarator": "providers", "modifier": "private final", "original_string": "private final RescorerProvider[] providers;", "type": "RescorerProvider[]", "var_name": "providers" } ], "file": "als-serving/src/main/java/com/cloudera/oryx/als/serving/MultiRescorerP...
{ "body": "@Override\n public Rescorer getRecommendToAnonymousRescorer(String[] itemIDs, OryxRecommender recommender, String... args) {\n List<Rescorer> rescorers = Lists.newArrayListWithCapacity(providers.length);\n for (RescorerProvider provider : providers) {\n Rescorer rescorer = provider.getRecommend...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_94
{ "fields": [], "file": "computation-common/src/test/java/com/cloudera/oryx/computation/common/DependenciesSchedulerTest.java", "identifier": "DependenciesSchedulerTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testEmpty() {\n DependenciesScheduler<String> scheduler = new DependenciesScheduler<String>();\n Collection<Collection<String>> schedule = scheduler.schedule(Collections.<DependsOn<String>>emptySet());\n assertTrue(schedule.isEmpty());\n }", "class_method_signature": "Depen...
{ "fields": [ { "declarator": "log = LoggerFactory.getLogger(DependenciesScheduler.class)", "modifier": "private static final", "original_string": "private static final Logger log = LoggerFactory.getLogger(DependenciesScheduler.class);", "type": "Logger", "var_name": "log" } ],...
{ "body": "List<Collection<T>> schedule(Collection<DependsOn<T>> dependencies) {\n\n log.info(\"Scheduling: {}\", dependencies);\n\n // This will map steps to a collection of all steps that must come before\n Map<T,Collection<T>> prerequisites = Maps.newHashMapWithExpectedSize(dependencies.size());\n\n fo...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_82
{ "fields": [ { "declarator": "NUM_BITS = 100", "modifier": "private static final", "original_string": "private static final int NUM_BITS = 100;", "type": "int", "var_name": "NUM_BITS" } ], "file": "common/src/test/java/com/cloudera/oryx/common/collection/BitSetTest.java", ...
{ "body": "@Test\n public void testClone() {\n BitSet bitSet = new BitSet(NUM_BITS);\n bitSet.set(NUM_BITS-1);\n bitSet = bitSet.clone();\n assertTrue(bitSet.get(NUM_BITS-1));\n }", "class_method_signature": "BitSetTest.testClone()", "constructor": false, "full_signature": "@Test public void testC...
{ "fields": [ { "declarator": "bits", "modifier": "private final", "original_string": "private final long[] bits;", "type": "long[]", "var_name": "bits" } ], "file": "common/src/main/java/com/cloudera/oryx/common/collection/BitSet.java", "identifier": "BitSet", "interface...
{ "body": "@Override\n public BitSet clone() {\n return new BitSet(bits.clone());\n }", "class_method_signature": "BitSet.clone()", "constructor": false, "full_signature": "@Override public BitSet clone()", "identifier": "clone", "invocations": [ "clone" ], "modifiers": "@Override public", "p...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_41
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/math/CommonsMathLinearSystemSolverTest.java", "identifier": "CommonsMathLinearSystemSolverTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testSolveDToF() {\n double[][] data = { new double[] {1.0,2.0}, new double[] {3.0,5.0}};\n RealMatrix M = new Array2DRowRealMatrix(data, false);\n LinearSystemSolver cmLinearSystemSolver = new CommonsMathLinearSystemSolver();\n Solver solver = cmLinearSystemSolver.getSolver...
{ "fields": [ { "declarator": "log = LoggerFactory.getLogger(CommonsMathLinearSystemSolver.class)", "modifier": "private static final", "original_string": "private static final Logger log = LoggerFactory.getLogger(CommonsMathLinearSystemSolver.class);", "type": "Logger", "var_name": ...
{ "body": "@Override\n public Solver getSolver(RealMatrix M) {\n if (M == null) {\n return null;\n }\n RRQRDecomposition decomposition = new RRQRDecomposition(M, SINGULARITY_THRESHOLD);\n DecompositionSolver solver = decomposition.getSolver();\n if (solver.isNonSingular()) {\n return new Com...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_110
{ "fields": [], "file": "rdf-common/src/test/java/com/cloudera/oryx/rdf/common/rule/CategoricalDecisionTest.java", "identifier": "CategoricalDecisionTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testDecision() {\n BitSet activeCategories = new BitSet(10);\n activeCategories.set(2);\n activeCategories.set(5);\n Decision decision = new CategoricalDecision(0, activeCategories, true);\n for (int i = 0; i < 10; i++) {\n assertEquals(activeCategories.get(i), deci...
{ "fields": [ { "declarator": "activeCategories", "modifier": "private final", "original_string": "private final BitSet activeCategories;", "type": "BitSet", "var_name": "activeCategories" }, { "declarator": "defaultDecision", "modifier": "private final", "o...
{ "body": "@Override\n public boolean isPositive(Example example) {\n CategoricalFeature feature = (CategoricalFeature) example.getFeature(getFeatureNumber());\n return feature == null ? defaultDecision : activeCategories.get(feature.getValueID());\n }", "class_method_signature": "CategoricalDecision.isPosi...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_16
{ "fields": [], "file": "als-common/src/test/java/com/cloudera/oryx/als/common/ByValueAscComparatorTest.java", "identifier": "ByValueAscComparatorTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testCompare() {\n NumericIDValue a = new NumericIDValue(1L, 2.0f);\n NumericIDValue b = new NumericIDValue(5L, 1.0f);\n assertTrue(ByValueAscComparator.INSTANCE.compare(a, b) > 0);\n assertTrue(ByValueAscComparator.INSTANCE.compare(b, a) < 0);\n assertEquals(0, ByValueAs...
{ "fields": [ { "declarator": "INSTANCE = new ByValueAscComparator()", "modifier": "static final", "original_string": "static final Comparator<NumericIDValue> INSTANCE = new ByValueAscComparator();", "type": "Comparator<NumericIDValue>", "var_name": "INSTANCE" } ], "file": "a...
{ "body": "@Override\n public int compare(NumericIDValue a, NumericIDValue b) {\n float aValue = a.getValue();\n float bValue = b.getValue();\n if (aValue < bValue) {\n return -1;\n }\n if (aValue > bValue) {\n return 1;\n }\n // Break ties by item ID, *de*scending. It's rare but at le...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_106
{ "fields": [], "file": "rdf-common/src/test/java/com/cloudera/oryx/rdf/common/eval/WeightedPredictionTest.java", "identifier": "WeightedPredictionTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testNumericVote() {\n List<NumericPrediction> predictions = Lists.newArrayList(\n new NumericPrediction(1.0f, 1),\n new NumericPrediction(3.0f, 2),\n new NumericPrediction(6.0f, 3)\n );\n double[] weights = {1.0, 1.0, 1.0};\n NumericPrediction vote = (N...
{ "fields": [], "file": "rdf-common/src/main/java/com/cloudera/oryx/rdf/common/eval/WeightedPrediction.java", "identifier": "WeightedPrediction", "interfaces": "", "methods": [ { "class_method_signature": "WeightedPrediction.WeightedPrediction()", "constructor": true, "full_signature": "...
{ "body": "public static <T extends Prediction> Prediction voteOnFeature(List<T> predictions, double[] weights) {\n switch (predictions.iterator().next().getFeatureType()) {\n case NUMERIC:\n @SuppressWarnings(\"unchecked\")\n List<NumericPrediction> numericVotes = (List<NumericPrediction>) pred...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_57
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/settings/APISettingsTest.java", "identifier": "APISettingsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testPort() {\n int port = 1729;\n assertEquals(port, APISettings.checkPort(port));\n }", "class_method_signature": "APISettingsTest.testPort()", "constructor": false, "full_signature": "@Test public void testPort()", "identifier": "testPort", "invocations": [ "asse...
{ "fields": [ { "declarator": "API_PATH = \"api\"", "modifier": "private static final", "original_string": "private static final String API_PATH = \"api\";", "type": "String", "var_name": "API_PATH" }, { "declarator": "HOST_STR_PARAM = \"host\"", "modifier": "priv...
{ "body": "static int checkPort(int port) {\n Preconditions.checkArgument(port > 0, \"port must be positive: %s\", port);\n return port;\n }", "class_method_signature": "APISettings.checkPort(int port)", "constructor": false, "full_signature": "static int checkPort(int port)", "identifier": "checkPort"...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_56
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/settings/APISettingsTest.java", "identifier": "APISettingsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test(expected = IllegalArgumentException.class)\n public void testUriHost() {\n APISettings.checkHost(\"http://www.example.com\");\n }", "class_method_signature": "APISettingsTest.testUriHost()", "constructor": false, "full_signature": "@Test(expected = IllegalArgumentException.class) public vo...
{ "fields": [ { "declarator": "API_PATH = \"api\"", "modifier": "private static final", "original_string": "private static final String API_PATH = \"api\";", "type": "String", "var_name": "API_PATH" }, { "declarator": "HOST_STR_PARAM = \"host\"", "modifier": "priv...
{ "body": "static String checkHost(String host) {\n Preconditions.checkArgument(host == null || (!host.startsWith(\"http://\") && !host.startsWith(\"https://\")),\n \"host should not include a URI scheme: %s\", host);\n return host;\n }", "class_method_signature": "APISettings.checkHost(String host)",...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_107
{ "fields": [], "file": "rdf-common/src/test/java/com/cloudera/oryx/rdf/common/eval/WeightedPredictionTest.java", "identifier": "WeightedPredictionTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testNumericVoteWeighted() {\n List<NumericPrediction> predictions = Lists.newArrayList(\n new NumericPrediction(1.0f, 1),\n new NumericPrediction(3.0f, 2),\n new NumericPrediction(6.0f, 3)\n );\n double[] weights = {3.0, 2.0, 1.0};\n NumericPrediction v...
{ "fields": [], "file": "rdf-common/src/main/java/com/cloudera/oryx/rdf/common/eval/WeightedPrediction.java", "identifier": "WeightedPrediction", "interfaces": "", "methods": [ { "class_method_signature": "WeightedPrediction.WeightedPrediction()", "constructor": true, "full_signature": "...
{ "body": "public static <T extends Prediction> Prediction voteOnFeature(List<T> predictions, double[] weights) {\n switch (predictions.iterator().next().getFeatureType()) {\n case NUMERIC:\n @SuppressWarnings(\"unchecked\")\n List<NumericPrediction> numericVotes = (List<NumericPrediction>) pred...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_111
{ "fields": [], "file": "rdf-common/src/test/java/com/cloudera/oryx/rdf/common/rule/NumericDecisionTest.java", "identifier": "NumericDecisionTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testDecision() {\n Decision decision = new NumericDecision(0, -3.1f, true);\n assertFalse(decision.isPositive(new Example(null, NumericFeature.forValue(-3.5f))));\n assertTrue(decision.isPositive(new Example(null, NumericFeature.forValue(-3.1f))));\n assertTrue(decision.isP...
{ "fields": [ { "declarator": "threshold", "modifier": "private final", "original_string": "private final float threshold;", "type": "float", "var_name": "threshold" }, { "declarator": "defaultDecision", "modifier": "private final", "original_string": "priva...
{ "body": "@Override\n public boolean isPositive(Example example) {\n NumericFeature feature = (NumericFeature) example.getFeature(getFeatureNumber());\n return feature == null ? defaultDecision : feature.getValue() >= threshold;\n }", "class_method_signature": "NumericDecision.isPositive(Example example)",...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_17
{ "fields": [], "file": "als-common/src/test/java/com/cloudera/oryx/als/common/ByValueAscComparatorTest.java", "identifier": "ByValueAscComparatorTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testSameValue() {\n NumericIDValue a = new NumericIDValue(1L, 2.0f);\n NumericIDValue b = new NumericIDValue(5L, 2.0f);\n assertTrue(ByValueAscComparator.INSTANCE.compare(a, b) > 0);\n assertTrue(ByValueAscComparator.INSTANCE.compare(b, a) < 0);\n assertEquals(0, ByValue...
{ "fields": [ { "declarator": "INSTANCE = new ByValueAscComparator()", "modifier": "static final", "original_string": "static final Comparator<NumericIDValue> INSTANCE = new ByValueAscComparator();", "type": "Comparator<NumericIDValue>", "var_name": "INSTANCE" } ], "file": "a...
{ "body": "@Override\n public int compare(NumericIDValue a, NumericIDValue b) {\n float aValue = a.getValue();\n float bValue = b.getValue();\n if (aValue < bValue) {\n return -1;\n }\n if (aValue > bValue) {\n return 1;\n }\n // Break ties by item ID, *de*scending. It's rare but at le...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_40
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/math/CommonsMathLinearSystemSolverTest.java", "identifier": "CommonsMathLinearSystemSolverTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testSolveFToD() {\n double[][] data = { new double[] {1.0,2.0}, new double[] {3.0,5.0}};\n RealMatrix M = new Array2DRowRealMatrix(data, false);\n LinearSystemSolver cmLinearSystemSolver = new CommonsMathLinearSystemSolver();\n Solver solver = cmLinearSystemSolver.getSolver...
{ "fields": [ { "declarator": "log = LoggerFactory.getLogger(CommonsMathLinearSystemSolver.class)", "modifier": "private static final", "original_string": "private static final Logger log = LoggerFactory.getLogger(CommonsMathLinearSystemSolver.class);", "type": "Logger", "var_name": ...
{ "body": "@Override\n public Solver getSolver(RealMatrix M) {\n if (M == null) {\n return null;\n }\n RRQRDecomposition decomposition = new RRQRDecomposition(M, SINGULARITY_THRESHOLD);\n DecompositionSolver solver = decomposition.getSolver();\n if (solver.isNonSingular()) {\n return new Com...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_83
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/collection/LongFloatMapTest.java", "identifier": "LongFloatMapTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testRemove() {\n LongFloatMap map = new LongFloatMap();\n map.put(500000L, 2.0f);\n map.remove(500000L);\n assertEquals(0, map.size());\n assertTrue(map.isEmpty());\n assertNaN(map.get(500000L));\n }", "class_method_signature": "LongFloatMapTest.testRemove()", "c...
{ "fields": [ { "declarator": "LOAD_FACTOR = 1.25", "modifier": "private static final", "original_string": "private static final double LOAD_FACTOR = 1.25;", "type": "double", "var_name": "LOAD_FACTOR" }, { "declarator": "MAX_SIZE = (int) (RandomUtils.MAX_INT_SMALLER_TW...
{ "body": "public void remove(long key) {\n if (key == KEY_NULL || key == REMOVED) {\n return;\n }\n int index = find(key);\n if (keys[index] != KEY_NULL) {\n keys[index] = REMOVED;\n numEntries--;\n values[index] = VALUE_NULL;\n }\n }", "class_method_signature": "LongFloatMap.re...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_95
{ "fields": [], "file": "computation-common/src/test/java/com/cloudera/oryx/computation/common/DependenciesSchedulerTest.java", "identifier": "DependenciesSchedulerTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testOne() {\n DependenciesScheduler<String> scheduler = new DependenciesScheduler<String>();\n List<Collection<String>> schedule = scheduler.schedule(Collections.singleton(new DependsOn<String>(\"foo\")));\n assertEquals(1, schedule.size());\n assertEquals(Sets.newHashSet(C...
{ "fields": [ { "declarator": "log = LoggerFactory.getLogger(DependenciesScheduler.class)", "modifier": "private static final", "original_string": "private static final Logger log = LoggerFactory.getLogger(DependenciesScheduler.class);", "type": "Logger", "var_name": "log" } ],...
{ "body": "List<Collection<T>> schedule(Collection<DependsOn<T>> dependencies) {\n\n log.info(\"Scheduling: {}\", dependencies);\n\n // This will map steps to a collection of all steps that must come before\n Map<T,Collection<T>> prerequisites = Maps.newHashMapWithExpectedSize(dependencies.size());\n\n fo...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_7
{ "fields": [], "file": "als-serving/src/test/java/com/cloudera/oryx/als/serving/MultiRescorerProviderTest.java", "identifier": "MultiRescorerProviderTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testMultiMostPopularItemsRescorer() {\n RescorerProvider multi =\n new MultiRescorerProvider(new SimpleModRescorerProvider(2), new SimpleModRescorerProvider(3));\n Rescorer provider = multi.getMostPopularItemsRescorer(null);\n assertNotNull(provider);\n assertTrue(pr...
{ "fields": [ { "declarator": "providers", "modifier": "private final", "original_string": "private final RescorerProvider[] providers;", "type": "RescorerProvider[]", "var_name": "providers" } ], "file": "als-serving/src/main/java/com/cloudera/oryx/als/serving/MultiRescorerP...
{ "body": "@Override\n public Rescorer getMostPopularItemsRescorer(OryxRecommender recommender, String... args) {\n List<Rescorer> rescorers = Lists.newArrayListWithCapacity(providers.length);\n for (RescorerProvider provider : providers) {\n Rescorer rescorer = provider.getMostPopularItemsRescorer(recomm...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_37
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/io/VarintTest.java", "identifier": "VarintTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testSignedSize() throws Exception {\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\n DataOutput out = new DataOutputStream(baos);\n int expectedSize = 0;\n for (int exponent = 0; exponent <= 61; exponent++) {\n Varint.writeSignedVarLong(1L << exponent, out...
{ "fields": [], "file": "common/src/main/java/com/cloudera/oryx/common/io/Varint.java", "identifier": "Varint", "interfaces": "", "methods": [ { "class_method_signature": "Varint.Varint()", "constructor": true, "full_signature": "private Varint()", "identifier": "Varint", "m...
{ "body": "public static void writeSignedVarLong(long value, DataOutput out) throws IOException {\n // Great trick from http://code.google.com/apis/protocolbuffers/docs/encoding.html#types\n writeUnsignedVarLong((value << 1) ^ (value >> 63), out);\n }", "class_method_signature": "Varint.writeSignedVarLong(lo...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_60
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/settings/APISettingsTest.java", "identifier": "APISettingsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testServingLayerDefaults() {\n assertNotNull(APISettings.create(\n ConfigUtils.getDefaultConfig().getConfig(\"serving-layer.api\")));\n }", "class_method_signature": "APISettingsTest.testServingLayerDefaults()", "constructor": false, "full_signature": "@Test public voi...
{ "fields": [ { "declarator": "API_PATH = \"api\"", "modifier": "private static final", "original_string": "private static final String API_PATH = \"api\";", "type": "String", "var_name": "API_PATH" }, { "declarator": "HOST_STR_PARAM = \"host\"", "modifier": "priv...
{ "body": "public static APISettings create(Config config) {\n if (config.hasPath(API_PATH)) {\n config = config.getConfig(API_PATH);\n }\n int port = checkPort(config.getInt(PORT_INT_PARAM));\n int securePort = checkPort(config.getInt(SECURE_PORT_INT_PARAM));\n String host = checkHost(config.getS...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_76
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/collection/LongObjectMapTest.java", "identifier": "LongObjectMapTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testRehash() {\n LongObjectMap<String> map = buildTestFastMap();\n map.remove(500000L);\n map.rehash();\n assertNull(map.get(500000L));\n assertEquals(\"bang\", map.get(47L));\n }", "class_method_signature": "LongObjectMapTest.testRehash()", "constructor": false, ...
{ "fields": [ { "declarator": "LOAD_FACTOR = 1.25", "modifier": "private static final", "original_string": "private static final double LOAD_FACTOR = 1.25;", "type": "double", "var_name": "LOAD_FACTOR" }, { "declarator": "MAX_SIZE = (int) (RandomUtils.MAX_INT_SMALLER_TW...
{ "body": "public void rehash() {\n rehash(RandomUtils.nextTwinPrime((int) (LOAD_FACTOR * numEntries) + 1));\n }", "class_method_signature": "LongObjectMap.rehash()", "constructor": false, "full_signature": "public void rehash()", "identifier": "rehash", "invocations": [ "rehash", "nextTwinPrime...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_99
{ "fields": [], "file": "rdf-common/src/test/java/com/cloudera/oryx/rdf/common/information/CategoricalInformationTest.java", "identifier": "CategoricalInformationTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testInformationCategoricalFeature() {\n ExampleSet exampleSet = examplesForCategoryCounts(new int[][] {\n {2, 6},\n {1, 1},\n {0, 1},\n });\n List<Decision> decisions = Decision.decisionsFromExamples(exampleSet, 0, 100);\n assertEquals(2, decisions.size...
{ "fields": [], "file": "rdf-common/src/main/java/com/cloudera/oryx/rdf/common/information/CategoricalInformation.java", "identifier": "CategoricalInformation", "interfaces": "", "methods": [ { "class_method_signature": "CategoricalInformation.CategoricalInformation()", "constructor": true, ...
{ "body": "static Pair<Decision,Double> bestGain(Iterable<Decision> decisions, ExampleSet examples) {\n int numCategories = examples.getTargetCategoryCount();\n int[] countsNegative = new int[numCategories];\n // Start with everything considered a negative example:\n List<Example> exampleList = examples.g...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_21
{ "fields": [ { "declarator": "a = wpoint(1.0, 1.0)", "modifier": "private final", "original_string": "private final Weighted<RealVector> a = wpoint(1.0, 1.0);", "type": "Weighted<RealVector>", "var_name": "a" }, { "declarator": "b = wpoint(5.0, 4.0)", "modifier":...
{ "body": "@Test\n public void testKmeansCompute() throws Exception {\n RandomGenerator rg = RandomManager.getRandom();\n KMeans kmeans = new KMeans(KMeansInitStrategy.PLUS_PLUS, new LloydsUpdateStrategy(100));\n Centers centers = kmeans.compute(points, 2, rg);\n assertEquals(new Centers(Vectors.of(1.5, ...
{ "fields": [ { "declarator": "LOG = LoggerFactory.getLogger(KMeans.class)", "modifier": "private static final", "original_string": "private static final Logger LOG = LoggerFactory.getLogger(KMeans.class);", "type": "Logger", "var_name": "LOG" }, { "declarator": "initSt...
{ "body": "public <W extends Weighted<RealVector>> Centers compute(List<W> points, int numClusters,\n RandomGenerator randomGenerator) {\n Preconditions.checkArgument(numClusters > 0);\n Centers initial = initStrategy.apply(points, numClusters, randomGenerator);\n ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_92
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/stats/IntegerWeightedMeanTest.java", "identifier": "IntegerWeightedMeanTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testDecrement() {\n IntegerWeightedMean mean = new IntegerWeightedMean();\n for (int i = 1; i <= 5; i++) {\n mean.increment(1.0 / (i + 1), i);\n }\n mean.decrement(1.0 / 6.0, 5);\n mean.decrement(1.0 / 5.0, 4);\n assertEquals(3, mean.getN());\n assertEquals((1...
{ "fields": [ { "declarator": "count", "modifier": "private", "original_string": "private long count;", "type": "long", "var_name": "count" }, { "declarator": "totalWeight", "modifier": "private", "original_string": "private long totalWeight;", "type":...
{ "body": "public void decrement(double datum, long weight) {\n Preconditions.checkArgument(weight >= 0);\n Preconditions.checkState(count > 0);\n totalWeight -= weight;\n count--;\n mean -= ((double) weight / totalWeight) * (datum - mean);\n }", "class_method_signature": "IntegerWeightedMean.decrem...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_84
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/collection/LongFloatMapTest.java", "identifier": "LongFloatMapTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testClear() {\n LongFloatMap map = new LongFloatMap();\n map.put(500000L, 2.0f);\n map.clear();\n assertEquals(0, map.size());\n assertTrue(map.isEmpty());\n assertNaN(map.get(500000L));\n }", "class_method_signature": "LongFloatMapTest.testClear()", "constructor...
{ "fields": [ { "declarator": "LOAD_FACTOR = 1.25", "modifier": "private static final", "original_string": "private static final double LOAD_FACTOR = 1.25;", "type": "double", "var_name": "LOAD_FACTOR" }, { "declarator": "MAX_SIZE = (int) (RandomUtils.MAX_INT_SMALLER_TW...
{ "body": "public void clear() {\n numEntries = 0;\n numSlotsUsed = 0;\n Arrays.fill(keys, KEY_NULL);\n Arrays.fill(values, VALUE_NULL);\n }", "class_method_signature": "LongFloatMap.clear()", "constructor": false, "full_signature": "public void clear()", "identifier": "clear", "invocations": [...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_47
{ "fields": [ { "declarator": "VEC1 = {-1.0f, 2.5f, 3.0f}", "modifier": "private static final", "original_string": "private static final float[] VEC1 = {-1.0f, 2.5f, 3.0f};", "type": "float[]", "var_name": "VEC1" }, { "declarator": "VEC2 = {1.5f, -1.5f, 0.0f}", "m...
{ "body": "@Test\n public void testNorm() {\n assertEquals(4.03112887414928, SimpleVectorMath.norm(VEC1));\n assertEquals(2.12132034355964, SimpleVectorMath.norm(VEC2));\n }", "class_method_signature": "SimpleVectorMathTest.testNorm()", "constructor": false, "full_signature": "@Test public void testNorm...
{ "fields": [], "file": "common/src/main/java/com/cloudera/oryx/common/math/SimpleVectorMath.java", "identifier": "SimpleVectorMath", "interfaces": "", "methods": [ { "class_method_signature": "SimpleVectorMath.SimpleVectorMath()", "constructor": true, "full_signature": "private SimpleV...
{ "body": "public static double norm(float[] x) {\n double total = 0.0;\n for (float f : x) {\n total += f * f;\n }\n return FastMath.sqrt(total);\n }", "class_method_signature": "SimpleVectorMath.norm(float[] x)", "constructor": false, "full_signature": "public static double norm(float[] x)",...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_10
{ "fields": [], "file": "als-common/src/test/java/com/cloudera/oryx/als/common/DataUtilsTest.java", "identifier": "DataUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test(expected = IllegalArgumentException.class)\n public void testBad() {\n DataUtils.readFeatureVector(\"NaN\");\n }", "class_method_signature": "DataUtilsTest.testBad()", "constructor": false, "full_signature": "@Test(expected = IllegalArgumentException.class) public void testBad()", "ident...
{ "fields": [ { "declarator": "COMMA = Pattern.compile(\",\")", "modifier": "private static final", "original_string": "private static final Pattern COMMA = Pattern.compile(\",\");", "type": "Pattern", "var_name": "COMMA" } ], "file": "als-common/src/main/java/com/cloudera/or...
{ "body": "public static float[] readFeatureVector(CharSequence featureVectorString) {\n String[] elementTokens = COMMA.split(featureVectorString);\n int features = elementTokens.length;\n float[] elements = new float[features];\n for (int i = 0; i < features; i++) {\n elements[i] = LangUtils.parseFl...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_100
{ "fields": [], "file": "rdf-common/src/test/java/com/cloudera/oryx/rdf/common/information/CategoricalInformationTest.java", "identifier": "CategoricalInformationTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testInformationNumericFeature() {\n ExampleSet exampleSet = examplesForNumericValues(new float[][]{\n new float[]{1.0f, 2.0f},\n new float[]{0.0f, 3.0f},\n });\n List<Decision> decisions = Decision.decisionsFromExamples(exampleSet, 0, 100);\n assertEquals(3, d...
{ "fields": [], "file": "rdf-common/src/main/java/com/cloudera/oryx/rdf/common/information/CategoricalInformation.java", "identifier": "CategoricalInformation", "interfaces": "", "methods": [ { "class_method_signature": "CategoricalInformation.CategoricalInformation()", "constructor": true, ...
{ "body": "static Pair<Decision,Double> bestGain(Iterable<Decision> decisions, ExampleSet examples) {\n int numCategories = examples.getTargetCategoryCount();\n int[] countsNegative = new int[numCategories];\n // Start with everything considered a negative example:\n List<Example> exampleList = examples.g...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_51
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/math/VectorsTest.java", "identifier": "VectorsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testLike() {\n RealVector of = Vectors.of(1.0, -2.0, 7.0);\n RealVector like = Vectors.like(of);\n assertEquals(of.getDimension(), like.getDimension());\n assertEquals(0.0, like.getEntry(0));\n assertSame(of.getClass(), like.getClass());\n }", "class_method_signature"...
{ "fields": [], "file": "common/src/main/java/com/cloudera/oryx/common/math/Vectors.java", "identifier": "Vectors", "interfaces": "", "methods": [ { "class_method_signature": "Vectors.of(double... values)", "constructor": false, "full_signature": "public static RealVector of(double... va...
{ "body": "public static RealVector like(RealVector vector) {\n int dimension = vector.getDimension();\n return vector instanceof SparseRealVector ? sparse(dimension) : dense(dimension);\n }", "class_method_signature": "Vectors.like(RealVector vector)", "constructor": false, "full_signature": "public sta...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_26
{ "fields": [ { "declarator": "THRESH = 0.001", "modifier": "private static final", "original_string": "private static final double THRESH = 0.001;", "type": "double", "var_name": "THRESH" }, { "declarator": "a = Vectors.of(17.0, 29.0)", "modifier": "private final...
{ "body": "@Test\n public void testTwo() throws Exception {\n Centers centers = new Centers(a, b);\n assertEquals(0.0, centers.getDistance(a).getSquaredDistance(), THRESH);\n assertEquals(0.0, centers.getDistance(b).getSquaredDistance(), THRESH);\n assertEquals(8.0, centers.getDistance(c).getSquaredDista...
{ "fields": [ { "declarator": "centers", "modifier": "private final", "original_string": "private final List<RealVector> centers;", "type": "List<RealVector>", "var_name": "centers" } ], "file": "kmeans-common/src/main/java/com/cloudera/oryx/kmeans/common/Centers.java", "id...
{ "body": "public Distance getDistance(RealVector point) {\n double min = Double.POSITIVE_INFINITY;\n int index = -1;\n for (int i = 0; i < centers.size(); i++) {\n RealVector c = centers.get(i);\n double distance = c.getDistance(point);\n double distanceSquared = distance * distance;\n i...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_71
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/LangUtilsTest.java", "identifier": "LangUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testDouble() {\n assertEquals(3.1, LangUtils.parseDouble(\"3.1\"));\n }", "class_method_signature": "LangUtilsTest.testDouble()", "constructor": false, "full_signature": "@Test public void testDouble()", "identifier": "testDouble", "invocations": [ "assertEquals", ...
{ "fields": [], "file": "common/src/main/java/com/cloudera/oryx/common/LangUtils.java", "identifier": "LangUtils", "interfaces": "", "methods": [ { "class_method_signature": "LangUtils.LangUtils()", "constructor": true, "full_signature": "private LangUtils()", "identifier": "LangU...
{ "body": "public static double parseDouble(String s) {\n double value = Double.parseDouble(s);\n Preconditions.checkArgument(Doubles.isFinite(value), \"Bad value: %s\", value);\n return value;\n }", "class_method_signature": "LangUtils.parseDouble(String s)", "constructor": false, "full_signature": "...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_67
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/LangUtilsTest.java", "identifier": "LangUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test(expected = IllegalArgumentException.class)\n public void testDoubleNaN() {\n LangUtils.parseDouble(\"NaN\");\n }", "class_method_signature": "LangUtilsTest.testDoubleNaN()", "constructor": false, "full_signature": "@Test(expected = IllegalArgumentException.class) public void testDoubleNaN(...
{ "fields": [], "file": "common/src/main/java/com/cloudera/oryx/common/LangUtils.java", "identifier": "LangUtils", "interfaces": "", "methods": [ { "class_method_signature": "LangUtils.LangUtils()", "constructor": true, "full_signature": "private LangUtils()", "identifier": "LangU...
{ "body": "public static double parseDouble(String s) {\n double value = Double.parseDouble(s);\n Preconditions.checkArgument(Doubles.isFinite(value), \"Bad value: %s\", value);\n return value;\n }", "class_method_signature": "LangUtils.parseDouble(String s)", "constructor": false, "full_signature": "...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_88
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/collection/LongSetTest.java", "identifier": "LongSetTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testClear() {\n LongSet set = new LongSet();\n set.add(1);\n set.clear();\n assertEquals(0, set.size());\n assertTrue(set.isEmpty());\n assertFalse(set.contains(1));\n }", "class_method_signature": "LongSetTest.testClear()", "constructor": false, "full_signatur...
{ "fields": [ { "declarator": "LOAD_FACTOR = 1.25", "modifier": "private static final", "original_string": "private static final double LOAD_FACTOR = 1.25;", "type": "double", "var_name": "LOAD_FACTOR" }, { "declarator": "MAX_SIZE = (int) (RandomUtils.MAX_INT_SMALLER_TW...
{ "body": "public void clear() {\n numEntries = 0;\n numSlotsUsed = 0;\n Arrays.fill(keys, NULL);\n }", "class_method_signature": "LongSet.clear()", "constructor": false, "full_signature": "public void clear()", "identifier": "clear", "invocations": [ "fill" ], "modifiers": "public", "pa...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_30
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/io/DelimitedDataUtilsTest.java", "identifier": "DelimitedDataUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testDecode() {\n assertArrayEquals(new String[0], DelimitedDataUtils.decode(\"\"));\n assertArrayEquals(new String[] {\"foo\"}, DelimitedDataUtils.decode(\"foo\"));\n assertArrayEquals(new String[] {\"foo\",\"bar\"}, DelimitedDataUtils.decode(\"foo,bar\"));\n }", "class_met...
{ "fields": [ { "declarator": "DELIMITER = ConfigUtils.getDefaultConfig().getString(\"inbound.delim\").charAt(0)", "modifier": "public static final", "original_string": "public static final char DELIMITER = ConfigUtils.getDefaultConfig().getString(\"inbound.delim\").charAt(0);", "type": "c...
{ "body": "public static String[] decode(CharSequence line) {\n return decode(line, DELIMITER);\n }", "class_method_signature": "DelimitedDataUtils.decode(CharSequence line)", "constructor": false, "full_signature": "public static String[] decode(CharSequence line)", "identifier": "decode", "invocations...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_0
{ "fields": [], "file": "kmeans-computation/src/test/java/com/cloudera/oryx/kmeans/computation/covariance/CoMomentTest.java", "identifier": "CoMomentTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testMerge() throws Exception {\n CoMoment a = new CoMoment();\n CoMoment b = new CoMoment();\n CoMoment c = new CoMoment();\n RandomGenerator r = RandomManager.getRandom();\n for (int i = 0; i < 100; i++) {\n double r1 = r.nextDouble();\n double r2 = r.nextDoub...
{ "fields": [ { "declarator": "mx", "modifier": "private", "original_string": "private double mx;", "type": "double", "var_name": "mx" }, { "declarator": "my", "modifier": "private", "original_string": "private double my;", "type": "double", "var...
{ "body": "public CoMoment merge(CoMoment cm) {\n long n = this.n + cm.n;\n double C = this.C + cm.C + (this.mx - cm.mx) * (this.my - cm.my) * this.n * cm.n / n;\n double mx = (this.n * this.mx + cm.n * cm.mx) / n;\n double my = (this.n * this.my + cm.n * cm.my) / n;\n return new CoMoment(mx, my, n, C)...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_1
{ "fields": [], "file": "kmeans-computation/src/test/java/com/cloudera/oryx/kmeans/computation/covariance/IndexTest.java", "identifier": "IndexTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testEquality() {\n Index a = new Index(0, 12);\n Index b = new Index(0, 12);\n assertEquals(a.hashCode(), b.hashCode());\n assertEquals(a, b);\n }", "class_method_signature": "IndexTest.testEquality()", "constructor": false, "full_signature": "@Test public void testE...
{ "fields": [ { "declarator": "row", "modifier": "private", "original_string": "private int row;", "type": "int", "var_name": "row" }, { "declarator": "column", "modifier": "private", "original_string": "private int column;", "type": "int", "var_...
{ "body": "@Override\n public int hashCode() {\n return 17 * row + 37 * column;\n }", "class_method_signature": "Index.hashCode()", "constructor": false, "full_signature": "@Override public int hashCode()", "identifier": "hashCode", "invocations": [], "modifiers": "@Override public", "parameters": ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_31
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/io/DelimitedDataUtilsTest.java", "identifier": "DelimitedDataUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testDecodeEmpty() {\n assertArrayEquals(new String[0], DelimitedDataUtils.decode(\"\"));\n assertArrayEquals(new String[] {\"foo\", \"bar\", \"\"}, DelimitedDataUtils.decode(\"foo,bar,\"));\n assertArrayEquals(new String[] {\"\", \"foo\", \"bar\"}, DelimitedDataUtils.decode(\"...
{ "fields": [ { "declarator": "DELIMITER = ConfigUtils.getDefaultConfig().getString(\"inbound.delim\").charAt(0)", "modifier": "public static final", "original_string": "public static final char DELIMITER = ConfigUtils.getDefaultConfig().getString(\"inbound.delim\").charAt(0);", "type": "c...
{ "body": "public static String[] decode(CharSequence line) {\n return decode(line, DELIMITER);\n }", "class_method_signature": "DelimitedDataUtils.decode(CharSequence line)", "constructor": false, "full_signature": "public static String[] decode(CharSequence line)", "identifier": "decode", "invocations...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_66
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/parallel/ExecutorUtilsTest.java", "identifier": "ExecutorUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test(expected = IllegalStateException.class)\n public void testCheckExceptions() throws Throwable {\n ExecutorService executor = Executors.newSingleThreadExecutor();\n Future<Object> future = executor.submit(new Callable<Object>() {\n @Override\n public Void call() throws IOException {\n ...
{ "fields": [ { "declarator": "log = LoggerFactory.getLogger(ExecutorUtils.class)", "modifier": "private static final", "original_string": "private static final Logger log = LoggerFactory.getLogger(ExecutorUtils.class);", "type": "Logger", "var_name": "log" } ], "file": "comm...
{ "body": "public static <T> void checkExceptions(Iterable<Future<T>> futures) {\n for (Future<?> future : futures) {\n try {\n future.get();\n } catch (InterruptedException e) {\n throw new IllegalStateException(e);\n } catch (ExecutionException e) {\n throw new IllegalStateExc...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_89
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/collection/LongSetTest.java", "identifier": "LongSetTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testContains() {\n LongSet set = buildTestFastSet();\n assertTrue(set.contains(1));\n assertTrue(set.contains(2));\n assertTrue(set.contains(3));\n assertFalse(set.contains(4));\n }", "class_method_signature": "LongSetTest.testContains()", "constructor": false, "f...
{ "fields": [ { "declarator": "LOAD_FACTOR = 1.25", "modifier": "private static final", "original_string": "private static final double LOAD_FACTOR = 1.25;", "type": "double", "var_name": "LOAD_FACTOR" }, { "declarator": "MAX_SIZE = (int) (RandomUtils.MAX_INT_SMALLER_TW...
{ "body": "public boolean contains(long key) {\n return key != NULL && key != REMOVED && keys[find(key)] != NULL;\n }", "class_method_signature": "LongSet.contains(long key)", "constructor": false, "full_signature": "public boolean contains(long key)", "identifier": "contains", "invocations": [ "fin...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_70
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/LangUtilsTest.java", "identifier": "LangUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test(expected = IllegalArgumentException.class)\n public void testFloatInf() {\n LangUtils.parseFloat(\"Infinity\");\n }", "class_method_signature": "LangUtilsTest.testFloatInf()", "constructor": false, "full_signature": "@Test(expected = IllegalArgumentException.class) public void testFloatInf...
{ "fields": [], "file": "common/src/main/java/com/cloudera/oryx/common/LangUtils.java", "identifier": "LangUtils", "interfaces": "", "methods": [ { "class_method_signature": "LangUtils.LangUtils()", "constructor": true, "full_signature": "private LangUtils()", "identifier": "LangU...
{ "body": "public static float parseFloat(String s) {\n float value = Float.parseFloat(s);\n Preconditions.checkArgument(Floats.isFinite(value), \"Bad value: %s\", value);\n return value;\n }", "class_method_signature": "LangUtils.parseFloat(String s)", "constructor": false, "full_signature": "public ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_27
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/io/DelimitedDataUtilsTest.java", "identifier": "DelimitedDataUtilsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testEncode() {\n assertEquals(\"\", DelimitedDataUtils.encode());\n assertEquals(\"foo\", DelimitedDataUtils.encode(\"foo\"));\n assertEquals(\"foo,bar\", DelimitedDataUtils.encode(\"foo\", \"bar\"));\n }", "class_method_signature": "DelimitedDataUtilsTest.testEncode()", ...
{ "fields": [ { "declarator": "DELIMITER = ConfigUtils.getDefaultConfig().getString(\"inbound.delim\").charAt(0)", "modifier": "public static final", "original_string": "public static final char DELIMITER = ConfigUtils.getDefaultConfig().getString(\"inbound.delim\").charAt(0);", "type": "c...
{ "body": "public static String encode(Object... columns) {\n return encode(columns, DELIMITER);\n }", "class_method_signature": "DelimitedDataUtils.encode(Object... columns)", "constructor": false, "full_signature": "public static String encode(Object... columns)", "identifier": "encode", "invocations"...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_50
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/math/VectorsTest.java", "identifier": "VectorsTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testOf() {\n RealVector of = Vectors.of(1.0, -2.0, 7.0);\n assertEquals(3, of.getDimension());\n assertEquals(1.0, of.getEntry(0));\n assertEquals(-2.0, of.getEntry(1));\n assertEquals(7.0, of.getEntry(2));\n }", "class_method_signature": "VectorsTest.testOf()", "co...
{ "fields": [], "file": "common/src/main/java/com/cloudera/oryx/common/math/Vectors.java", "identifier": "Vectors", "interfaces": "", "methods": [ { "class_method_signature": "Vectors.of(double... values)", "constructor": false, "full_signature": "public static RealVector of(double... va...
{ "body": "public static RealVector of(double... values) {\n return new ArrayRealVector(values, false);\n }", "class_method_signature": "Vectors.of(double... values)", "constructor": false, "full_signature": "public static RealVector of(double... values)", "identifier": "of", "invocations": [], "modif...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_101
{ "fields": [], "file": "rdf-common/src/test/java/com/cloudera/oryx/rdf/common/information/InformationTest.java", "identifier": "InformationTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testEmptyInformation() {\n assertNaN(Information.entropy(new int[] {}));\n }", "class_method_signature": "InformationTest.testEmptyInformation()", "constructor": false, "full_signature": "@Test public void testEmptyInformation()", "identifier": "testEmptyInformation", "in...
{ "fields": [], "file": "rdf-common/src/main/java/com/cloudera/oryx/rdf/common/information/Information.java", "identifier": "Information", "interfaces": "", "methods": [ { "class_method_signature": "Information.Information()", "constructor": true, "full_signature": "private Information(...
{ "body": "public static double entropy(int[] counts) {\n // Entropy is really, over all counts:\n // sum (-p_i * ln p_i)\n // where p_i = count_i / total\n // terms where count is 0 or 1 are 0, so can go away\n // Here we actually compute total as we go and account for it later, which avoids\n // ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_11
{ "fields": [], "file": "als-common/src/test/java/com/cloudera/oryx/als/common/TopNTest.java", "identifier": "TopNTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testEmpty() {\n Collection<NumericIDValue> top2 = TopN.selectTopN(Collections.<NumericIDValue>emptyList().iterator(), 2);\n assertNotNull(top2);\n assertEquals(0, top2.size());\n }", "class_method_signature": "TopNTest.testEmpty()", "constructor": false, "full_signature...
{ "fields": [], "file": "als-common/src/main/java/com/cloudera/oryx/als/common/TopN.java", "identifier": "TopN", "interfaces": "", "methods": [ { "class_method_signature": "TopN.TopN()", "constructor": true, "full_signature": "private TopN()", "identifier": "TopN", "modifier...
{ "body": "public static List<NumericIDValue> selectTopN(Iterator<NumericIDValue> values, int n) {\n Queue<NumericIDValue> topN = initialQueue(n);\n selectTopNIntoQueue(topN, values, n);\n return selectTopNFromQueue(topN, n);\n }", "class_method_signature": "TopN.selectTopN(Iterator<NumericIDValue> values...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_46
{ "fields": [ { "declarator": "VEC1 = {-1.0f, 2.5f, 3.0f}", "modifier": "private static final", "original_string": "private static final float[] VEC1 = {-1.0f, 2.5f, 3.0f};", "type": "float[]", "var_name": "VEC1" }, { "declarator": "VEC2 = {1.5f, -1.5f, 0.0f}", "m...
{ "body": "@Test\n public void testDot() {\n assertEquals(-5.25, SimpleVectorMath.dot(VEC1, VEC2));\n }", "class_method_signature": "SimpleVectorMathTest.testDot()", "constructor": false, "full_signature": "@Test public void testDot()", "identifier": "testDot", "invocations": [ "assertEquals", ...
{ "fields": [], "file": "common/src/main/java/com/cloudera/oryx/common/math/SimpleVectorMath.java", "identifier": "SimpleVectorMath", "interfaces": "", "methods": [ { "class_method_signature": "SimpleVectorMath.SimpleVectorMath()", "constructor": true, "full_signature": "private SimpleV...
{ "body": "public static double dot(float[] x, float[] y) {\n int length = x.length;\n double dot = 0.0;\n for (int i = 0; i < length; i++) {\n dot += x[i] * y[i];\n }\n return dot;\n }", "class_method_signature": "SimpleVectorMath.dot(float[] x, float[] y)", "constructor": false, "full_sig...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_85
{ "fields": [], "file": "common/src/test/java/com/cloudera/oryx/common/collection/LongFloatMapTest.java", "identifier": "LongFloatMapTest", "interfaces": "", "superclass": "extends OryxTest" }
{ "body": "@Test\n public void testContains() {\n LongFloatMap map = buildTestFastMap();\n assertTrue(map.containsKey(500000L));\n assertTrue(map.containsKey(47L));\n assertTrue(map.containsKey(2L));\n assertFalse(map.containsKey(999));\n }", "class_method_signature": "LongFloatMapTest.testContains...
{ "fields": [ { "declarator": "LOAD_FACTOR = 1.25", "modifier": "private static final", "original_string": "private static final double LOAD_FACTOR = 1.25;", "type": "double", "var_name": "LOAD_FACTOR" }, { "declarator": "MAX_SIZE = (int) (RandomUtils.MAX_INT_SMALLER_TW...
{ "body": "public boolean containsKey(long key) {\n return key != KEY_NULL && key != REMOVED && keys[find(key)] != KEY_NULL;\n }", "class_method_signature": "LongFloatMap.containsKey(long key)", "constructor": false, "full_signature": "public boolean containsKey(long key)", "identifier": "containsKey", ...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
14333932_93
{ "fields": [ { "declarator": "VALUES = MemPipeline.typedCollectionOf(\n Writables.pairs(Writables.strings(), Writables.doubles()),\n ImmutableList.of(\n Pair.of(\"foo\", 200.0),\n Pair.of(\"bar\", 400.0),\n Pair.of(\"baz\", 100.0),\n Pair.of(\"biz\", 100.0)))", "...
{ "body": "@Test\n public void testWRS() throws Exception {\n Map<String, Integer> histogram = Maps.newHashMap();\n\n RandomGenerator r = RandomManager.getRandom();\n for (int i = 0; i < 100; i++) {\n PCollection<String> sample = ReservoirSampling.weightedSample(VALUES, 2, r);\n for (String s : sa...
{ "fields": [], "file": "computation-common/src/main/java/com/cloudera/oryx/computation/common/sample/ReservoirSampling.java", "identifier": "ReservoirSampling", "interfaces": "", "methods": [ { "class_method_signature": "ReservoirSampling.ReservoirSampling()", "constructor": true, "full...
{ "body": "public static <T, N extends Number> PCollection<T> weightedSample(\n PCollection<Pair<T, N>> input,\n int sampleSize) {\n return weightedSample(input, sampleSize, null);\n }", "class_method_signature": "ReservoirSampling.weightedSample(\n PCollection<Pair<T, N>> input,\n int sampl...
{ "created": null, "fork": null, "fork_count": 382, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 14333932, "size": 64, "stargazer_count": 7, "stars": null, "updates": null, "url": "https://github.com/apsaltis/oryx" }
215950115_179
{ "fields": [], "file": "mq-client/mq-client-core/src/test/java/com/ppdai/infrastructure/mq/client/config/ConsumerGroupVoTest.java", "identifier": "ConsumerGroupVoTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n\tpublic void addTopicTest() {\n\t\tConsumerGroupVo consumerGroupVo = new ConsumerGroupVo(\"tttt\");\n\t\tboolean rs = false;\n\t\ttry {\n\t\t\tconsumerGroupVo.addTopic(null);\n\t\t} catch (Exception e) {\n\t\t\trs = true;\n\t\t}\n\t\tassertEquals(\"addTopicTest error\", true, rs);\n\n\t\trs = false...
{ "fields": [ { "declarator": "meta", "modifier": "private", "original_string": "private ConsumerGroupMetaVo meta;", "type": "ConsumerGroupMetaVo", "var_name": "meta" }, { "declarator": "topics", "modifier": "private", "original_string": "private Map<String,...
{ "body": "public boolean addTopic(ConsumerGroupTopicVo topicVo) {\n\t\tif (topics == null) {\n\t\t\ttopics = new ConcurrentHashMap<>();\n\t\t}\n\t\tif (topicVo == null || Util.isEmpty(topicVo.getName())) {\n\t\t\tthrow new IllegalArgumentException(\"参数不对,consumerGroupName,topicName不能为空!\");\n\t\t}\n\t\tif (topics.co...
{ "created": null, "fork": null, "fork_count": 90, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 215950115, "size": 3696, "stargazer_count": 223, "stars": null, "updates": null, "url": "https://github.com/ppdaicorp/pmq" }
215950115_0
{ "fields": [ { "declarator": "consumerGroupCheckServiceImpl", "modifier": "private", "original_string": "private ConsumerGroupCheckServiceImpl consumerGroupCheckServiceImpl;", "type": "ConsumerGroupCheckServiceImpl", "var_name": "consumerGroupCheckServiceImpl" }, { "de...
{ "body": "@Test\n\tpublic void checkItemTest() {\n\t\tassertEquals(true, consumerGroupCheckServiceImpl.checkItem()!=null);\n\t}", "class_method_signature": "ConsumerGroupCheckServiceImplTest.checkItemTest()", "constructor": false, "full_signature": "@Test public void checkItemTest()", "identifier": "checkIte...
{ "fields": [ { "declarator": "consumerGroupService", "modifier": "@Autowired\n private", "original_string": "@Autowired\n private ConsumerGroupService consumerGroupService;", "type": "ConsumerGroupService", "var_name": "consumerGroupService" }, { "declarator": "c...
{ "body": "@Override\n public String checkItem() {\n String field = \"ConsumerGroup下校验:\" + ConsumerGroupEntity.FdName + \",\" + ConsumerGroupEntity.FdOriginName + \",\" +\n ConsumerGroupEntity.FdIpWhiteList + \",\" + ConsumerGroupEntity.FdIpBlackList + \",\" + ConsumerGroupEntity.FdTopicName...
{ "created": null, "fork": null, "fork_count": 90, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 215950115, "size": 3696, "stargazer_count": 223, "stars": null, "updates": null, "url": "https://github.com/ppdaicorp/pmq" }
215950115_180
{ "fields": [ { "declarator": "consumerError = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" ?>\\r\\n\" + \"<messageQueue>\\r\\n\"\n\t\t\t+ \" <consumer1 groupName=\\\"testSub\\\">\\r\\n\" + \" <topics>\\r\\n\"\n\t\t\t+ \" <topic name=\\\"test\\\" receiverType=\\\"com.ppdai.infra...
{ "body": "@Test\n\tpublic void getConfigTest() {\n\t\tClientConfigHelper clientConfigHelper = new ClientConfigHelper(new MqContext());\n\t\tMap<String, ConsumerGroupVo> maps = clientConfigHelper.getConfig();\n\t\tassertEquals(\"messageQueue.xml 解析数量不对!\", 1, maps.size());\n\t\tassertEquals(\"topic 解析数量不对!\", 1, maps...
{ "fields": [ { "declarator": "log = LoggerFactory.getLogger(ClientConfigHelper.class)", "modifier": "private static", "original_string": "private static Logger log = LoggerFactory.getLogger(ClientConfigHelper.class);", "type": "Logger", "var_name": "log" }, { "declarat...
{ "body": "public Map<String, ConsumerGroupVo> getConfig() {\n\t\ttry {\n\t\t\tInputStream inputStream = getConfigFileStream();\n\t\t\treturn getConfig(inputStream);\n\t\t} catch (Exception ex) {\n\t\t\tlog.error(\"加载配置文件异常,异常信息:\" + ex.getMessage(), ex);\n\t\t\tthrow new RuntimeException(ex);\n\t\t}\n\n\t}", "clas...
{ "created": null, "fork": null, "fork_count": 90, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 215950115, "size": 3696, "stargazer_count": 223, "stars": null, "updates": null, "url": "https://github.com/ppdaicorp/pmq" }
215950115_138
{ "fields": [], "file": "mq-client/mq-core/src/test/java/com/ppdai/infrastructure/mq/biz/common/util/HttpClientTest.java", "identifier": "HttpClientTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n\tpublic void getTest() throws IOException {\n\t\tClientAndServer mockClient = new ClientAndServer(5000);\n\t\ttry {\n\t\t\tmockClient.when(HttpRequest.request().withMethod(\"GET\"))\n\t\t\t\t\t.respond(HttpResponse.response().withStatusCode(200).withBody(\"1\"));\n\t\t\tHttpClient httpClient = new ...
{ "fields": [ { "declarator": "JSONTYPE = MediaType.parse(\"application/json; charset=utf-8\")", "modifier": "private static final", "original_string": "private static final MediaType JSONTYPE = MediaType.parse(\"application/json; charset=utf-8\");", "type": "MediaType", "var_name": ...
{ "body": "public <T> T get(String url, Class<T> class1) throws IOException {\n\t\tString rs = get(url);\n\t\tif (rs == null || rs.length() == 0 || rs.trim().length() == 0) {\n\t\t\treturn null;\n\t\t} else {\n\t\t\treturn JsonUtil.parseJson(rs, class1);\n\t\t}\n\t}", "class_method_signature": "HttpClient.get(Strin...
{ "created": null, "fork": null, "fork_count": 90, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 215950115, "size": 3696, "stargazer_count": 223, "stars": null, "updates": null, "url": "https://github.com/ppdaicorp/pmq" }