id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
127,900 | deeplearning4j/deeplearning4j | arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/optimize/generator/genetic/selection/GeneticSelectionOperator.java | GeneticSelectionOperator.initializeInstance | @Override
public void initializeInstance(PopulationModel populationModel, ChromosomeFactory chromosomeFactory) {
super.initializeInstance(populationModel, chromosomeFactory);
crossoverOperator.initializeInstance(populationModel);
} | java | @Override
public void initializeInstance(PopulationModel populationModel, ChromosomeFactory chromosomeFactory) {
super.initializeInstance(populationModel, chromosomeFactory);
crossoverOperator.initializeInstance(populationModel);
} | [
"@",
"Override",
"public",
"void",
"initializeInstance",
"(",
"PopulationModel",
"populationModel",
",",
"ChromosomeFactory",
"chromosomeFactory",
")",
"{",
"super",
".",
"initializeInstance",
"(",
"populationModel",
",",
"chromosomeFactory",
")",
";",
"crossoverOperator"... | Called by GeneticSearchCandidateGenerator | [
"Called",
"by",
"GeneticSearchCandidateGenerator"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/optimize/generator/genetic/selection/GeneticSelectionOperator.java#L111-L115 |
127,901 | deeplearning4j/deeplearning4j | datavec/datavec-local/src/main/java/org/datavec/local/transforms/AnalyzeLocal.java | AnalyzeLocal.getUniqueSequence | public static Map<String,Set<Writable>> getUniqueSequence(List<String> columnNames, Schema schema,
SequenceRecordReader sequenceData) {
Map<String,Set<Writable>> m = new HashMap<>();
for(String s : columnNames){
m.put(s, new Hash... | java | public static Map<String,Set<Writable>> getUniqueSequence(List<String> columnNames, Schema schema,
SequenceRecordReader sequenceData) {
Map<String,Set<Writable>> m = new HashMap<>();
for(String s : columnNames){
m.put(s, new Hash... | [
"public",
"static",
"Map",
"<",
"String",
",",
"Set",
"<",
"Writable",
">",
">",
"getUniqueSequence",
"(",
"List",
"<",
"String",
">",
"columnNames",
",",
"Schema",
"schema",
",",
"SequenceRecordReader",
"sequenceData",
")",
"{",
"Map",
"<",
"String",
",",
... | Get a list of unique values from the specified columns of a sequence
@param columnNames Name of the columns to get unique values from
@param schema Data schema
@param sequenceData Sequence data to get unique values from
@return | [
"Get",
"a",
"list",
"of",
"unique",
"values",
"from",
"the",
"specified",
"columns",
"of",
"a",
"sequence"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-local/src/main/java/org/datavec/local/transforms/AnalyzeLocal.java#L208-L224 |
127,902 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.setOrder | @Override
public void setOrder(char order) {
Preconditions.checkArgument(order == 'c' || order == 'f', "Order specified must be either c or f: got %s", String.valueOf(order));
this.order = order;
} | java | @Override
public void setOrder(char order) {
Preconditions.checkArgument(order == 'c' || order == 'f', "Order specified must be either c or f: got %s", String.valueOf(order));
this.order = order;
} | [
"@",
"Override",
"public",
"void",
"setOrder",
"(",
"char",
"order",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"order",
"==",
"'",
"'",
"||",
"order",
"==",
"'",
"'",
",",
"\"Order specified must be either c or f: got %s\"",
",",
"String",
".",
"va... | Sets the order. Primarily for testing purposes
@param order | [
"Sets",
"the",
"order",
".",
"Primarily",
"for",
"testing",
"purposes"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L125-L129 |
127,903 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.setDType | @Override
public void setDType(DataType dtype) {
assert dtype == DataType.DOUBLE || dtype == DataType.FLOAT
|| dtype == DataType.INT : "Invalid opType passed, must be float or double";
// this.dtype = dtype;
} | java | @Override
public void setDType(DataType dtype) {
assert dtype == DataType.DOUBLE || dtype == DataType.FLOAT
|| dtype == DataType.INT : "Invalid opType passed, must be float or double";
// this.dtype = dtype;
} | [
"@",
"Override",
"public",
"void",
"setDType",
"(",
"DataType",
"dtype",
")",
"{",
"assert",
"dtype",
"==",
"DataType",
".",
"DOUBLE",
"||",
"dtype",
"==",
"DataType",
".",
"FLOAT",
"||",
"dtype",
"==",
"DataType",
".",
"INT",
":",
"\"Invalid opType passed, ... | Sets the data opType
@param dtype | [
"Sets",
"the",
"data",
"opType"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L154-L159 |
127,904 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.eye | @Override
public INDArray eye(long n) {
INDArray ret = Nd4j.create(n, n);
for (int i = 0; i < n; i++) {
ret.put(i, i, 1.0);
}
return ret.reshape(n, n);
} | java | @Override
public INDArray eye(long n) {
INDArray ret = Nd4j.create(n, n);
for (int i = 0; i < n; i++) {
ret.put(i, i, 1.0);
}
return ret.reshape(n, n);
} | [
"@",
"Override",
"public",
"INDArray",
"eye",
"(",
"long",
"n",
")",
"{",
"INDArray",
"ret",
"=",
"Nd4j",
".",
"create",
"(",
"n",
",",
"n",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"ret",
".... | Create the identity ndarray
@param n the number for the identity
@return | [
"Create",
"the",
"identity",
"ndarray"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L275-L284 |
127,905 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.rot90 | @Override
public void rot90(INDArray toRotate) {
if (!toRotate.isMatrix())
throw new IllegalArgumentException("Only rotating matrices");
INDArray start = toRotate.transpose();
for (int i = 0; i < start.rows(); i++)
start.putRow(i, reverse(start.getRow(i)));
} | java | @Override
public void rot90(INDArray toRotate) {
if (!toRotate.isMatrix())
throw new IllegalArgumentException("Only rotating matrices");
INDArray start = toRotate.transpose();
for (int i = 0; i < start.rows(); i++)
start.putRow(i, reverse(start.getRow(i)));
} | [
"@",
"Override",
"public",
"void",
"rot90",
"(",
"INDArray",
"toRotate",
")",
"{",
"if",
"(",
"!",
"toRotate",
".",
"isMatrix",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Only rotating matrices\"",
")",
";",
"INDArray",
"start",
"=",
... | Rotate a matrix 90 degrees
@param toRotate the matrix to rotate
@return the rotated matrix | [
"Rotate",
"a",
"matrix",
"90",
"degrees"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L292-L301 |
127,906 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.arange | @Override
public INDArray arange(double begin, double end, double step) {
return Nd4j.create(ArrayUtil.toDoubles(ArrayUtil.range((int) begin, (int) end, (int)step)));
} | java | @Override
public INDArray arange(double begin, double end, double step) {
return Nd4j.create(ArrayUtil.toDoubles(ArrayUtil.range((int) begin, (int) end, (int)step)));
} | [
"@",
"Override",
"public",
"INDArray",
"arange",
"(",
"double",
"begin",
",",
"double",
"end",
",",
"double",
"step",
")",
"{",
"return",
"Nd4j",
".",
"create",
"(",
"ArrayUtil",
".",
"toDoubles",
"(",
"ArrayUtil",
".",
"range",
"(",
"(",
"int",
")",
"... | Array of evenly spaced values.
@param begin the begin of the range
@param end the end of the range
@return the range vector | [
"Array",
"of",
"evenly",
"spaced",
"values",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L350-L353 |
127,907 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.rand | @Override
public INDArray rand(long rows, long columns) {
return rand(new long[] {rows, columns}, System.currentTimeMillis());
} | java | @Override
public INDArray rand(long rows, long columns) {
return rand(new long[] {rows, columns}, System.currentTimeMillis());
} | [
"@",
"Override",
"public",
"INDArray",
"rand",
"(",
"long",
"rows",
",",
"long",
"columns",
")",
"{",
"return",
"rand",
"(",
"new",
"long",
"[",
"]",
"{",
"rows",
",",
"columns",
"}",
",",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"}"
] | Create a random ndarray with the given shape using
the current time as the seed
@param rows the number of rows in the matrix
@param columns the number of columns in the matrix
@return the random ndarray with the specified shape | [
"Create",
"a",
"random",
"ndarray",
"with",
"the",
"given",
"shape",
"using",
"the",
"current",
"time",
"as",
"the",
"seed"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L473-L476 |
127,908 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.randn | @Override
public INDArray randn(long rows, long columns) {
return randn(new long[] {rows, columns}, System.currentTimeMillis());
} | java | @Override
public INDArray randn(long rows, long columns) {
return randn(new long[] {rows, columns}, System.currentTimeMillis());
} | [
"@",
"Override",
"public",
"INDArray",
"randn",
"(",
"long",
"rows",
",",
"long",
"columns",
")",
"{",
"return",
"randn",
"(",
"new",
"long",
"[",
"]",
"{",
"rows",
",",
"columns",
"}",
",",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"}"... | Random normal using the current time stamp
as the seed
@param rows the number of rows in the matrix
@param columns the number of columns in the matrix
@return | [
"Random",
"normal",
"using",
"the",
"current",
"time",
"stamp",
"as",
"the",
"seed"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L511-L514 |
127,909 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.valueArrayOf | @Override
public INDArray valueArrayOf(int[] shape, double value) {
INDArray ret = Nd4j.createUninitialized(shape, Nd4j.order());
ret.assign(value);
return ret;
} | java | @Override
public INDArray valueArrayOf(int[] shape, double value) {
INDArray ret = Nd4j.createUninitialized(shape, Nd4j.order());
ret.assign(value);
return ret;
} | [
"@",
"Override",
"public",
"INDArray",
"valueArrayOf",
"(",
"int",
"[",
"]",
"shape",
",",
"double",
"value",
")",
"{",
"INDArray",
"ret",
"=",
"Nd4j",
".",
"createUninitialized",
"(",
"shape",
",",
"Nd4j",
".",
"order",
"(",
")",
")",
";",
"ret",
".",... | Creates an ndarray with the specified value
as the only value in the ndarray
@param shape the shape of the ndarray
@param value the value to assign
@return the created ndarray | [
"Creates",
"an",
"ndarray",
"with",
"the",
"specified",
"value",
"as",
"the",
"only",
"value",
"in",
"the",
"ndarray"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L796-L801 |
127,910 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.valueArrayOf | @Override
public INDArray valueArrayOf(long rows, long columns, double value) {
INDArray create = createUninitialized(new long[] {rows, columns}, Nd4j.order());
create.assign(value);
return create;
} | java | @Override
public INDArray valueArrayOf(long rows, long columns, double value) {
INDArray create = createUninitialized(new long[] {rows, columns}, Nd4j.order());
create.assign(value);
return create;
} | [
"@",
"Override",
"public",
"INDArray",
"valueArrayOf",
"(",
"long",
"rows",
",",
"long",
"columns",
",",
"double",
"value",
")",
"{",
"INDArray",
"create",
"=",
"createUninitialized",
"(",
"new",
"long",
"[",
"]",
"{",
"rows",
",",
"columns",
"}",
",",
"... | Creates a row vector with the specified number of columns
@param rows the number of rows in the matrix
@param columns the columns of the ndarray
@param value the value to assign
@return the created ndarray | [
"Creates",
"a",
"row",
"vector",
"with",
"the",
"specified",
"number",
"of",
"columns"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L828-L833 |
127,911 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.ones | @Override
public INDArray ones(int[] shape) {
INDArray ret = createUninitialized(shape, Nd4j.order());
ret.assign(1);
return ret;
} | java | @Override
public INDArray ones(int[] shape) {
INDArray ret = createUninitialized(shape, Nd4j.order());
ret.assign(1);
return ret;
} | [
"@",
"Override",
"public",
"INDArray",
"ones",
"(",
"int",
"[",
"]",
"shape",
")",
"{",
"INDArray",
"ret",
"=",
"createUninitialized",
"(",
"shape",
",",
"Nd4j",
".",
"order",
"(",
")",
")",
";",
"ret",
".",
"assign",
"(",
"1",
")",
";",
"return",
... | Create an ndarray of ones
@param shape the shape of the ndarray
@return an ndarray with ones filled in | [
"Create",
"an",
"ndarray",
"of",
"ones"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L1009-L1014 |
127,912 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.scalar | @Override
public INDArray scalar(Number value, long offset) {
if (Nd4j.dataType() == DataType.DOUBLE)
return scalar(value.doubleValue(), offset);
if (Nd4j.dataType() == DataType.FLOAT || Nd4j.dataType() == DataType.HALF)
return scalar(value.floatValue(), offset);
if (... | java | @Override
public INDArray scalar(Number value, long offset) {
if (Nd4j.dataType() == DataType.DOUBLE)
return scalar(value.doubleValue(), offset);
if (Nd4j.dataType() == DataType.FLOAT || Nd4j.dataType() == DataType.HALF)
return scalar(value.floatValue(), offset);
if (... | [
"@",
"Override",
"public",
"INDArray",
"scalar",
"(",
"Number",
"value",
",",
"long",
"offset",
")",
"{",
"if",
"(",
"Nd4j",
".",
"dataType",
"(",
")",
"==",
"DataType",
".",
"DOUBLE",
")",
"return",
"scalar",
"(",
"value",
".",
"doubleValue",
"(",
")"... | Create a scalar ndarray with the specified offset
@param value the value to initialize the scalar with
@param offset the offset of the ndarray
@return the created ndarray | [
"Create",
"a",
"scalar",
"ndarray",
"with",
"the",
"specified",
"offset"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L1251-L1260 |
127,913 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/util/DictionaryEntryLineParser.java | DictionaryEntryLineParser.unescape | public static String unescape(String text) {
StringBuilder builder = new StringBuilder();
boolean foundQuote = false;
for (int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
if (i == 0 && c == QUOTE || i == text.length() - 1 && c == QUOTE) {
c... | java | public static String unescape(String text) {
StringBuilder builder = new StringBuilder();
boolean foundQuote = false;
for (int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
if (i == 0 && c == QUOTE || i == text.length() - 1 && c == QUOTE) {
c... | [
"public",
"static",
"String",
"unescape",
"(",
"String",
"text",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"foundQuote",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"text",
".",... | Unescape input for CSV
@param text text to be unescaped
@return unescaped value, not null | [
"Unescape",
"input",
"for",
"CSV"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/util/DictionaryEntryLineParser.java#L76-L101 |
127,914 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/util/DictionaryEntryLineParser.java | DictionaryEntryLineParser.escape | public static String escape(String text) {
boolean hasQuote = text.indexOf(QUOTE) >= 0;
boolean hasComma = text.indexOf(COMMA) >= 0;
if (!(hasQuote || hasComma)) {
return text;
}
StringBuilder builder = new StringBuilder();
if (hasQuote) {
for (... | java | public static String escape(String text) {
boolean hasQuote = text.indexOf(QUOTE) >= 0;
boolean hasComma = text.indexOf(COMMA) >= 0;
if (!(hasQuote || hasComma)) {
return text;
}
StringBuilder builder = new StringBuilder();
if (hasQuote) {
for (... | [
"public",
"static",
"String",
"escape",
"(",
"String",
"text",
")",
"{",
"boolean",
"hasQuote",
"=",
"text",
".",
"indexOf",
"(",
"QUOTE",
")",
">=",
"0",
";",
"boolean",
"hasComma",
"=",
"text",
".",
"indexOf",
"(",
"COMMA",
")",
">=",
"0",
";",
"if... | Escape input for CSV
@param text text to be escaped
@return escaped value, not null | [
"Escape",
"input",
"for",
"CSV"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/util/DictionaryEntryLineParser.java#L109-L138 |
127,915 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/accumulation/EncodedGradientsAccumulator.java | EncodedGradientsAccumulator.getOptimalBufferSize | public static long getOptimalBufferSize(long paramsLength, int numWorkers, int queueSize) {
// we add 64kb just for future proof volatility
val bufferSize = ((paramsLength / 16) + 65536) * numWorkers * queueSize * 4;
return bufferSize;
} | java | public static long getOptimalBufferSize(long paramsLength, int numWorkers, int queueSize) {
// we add 64kb just for future proof volatility
val bufferSize = ((paramsLength / 16) + 65536) * numWorkers * queueSize * 4;
return bufferSize;
} | [
"public",
"static",
"long",
"getOptimalBufferSize",
"(",
"long",
"paramsLength",
",",
"int",
"numWorkers",
",",
"int",
"queueSize",
")",
"{",
"// we add 64kb just for future proof volatility",
"val",
"bufferSize",
"=",
"(",
"(",
"paramsLength",
"/",
"16",
")",
"+",
... | This method returns optimal bufferSize for a given model
We know, that updates are guaranteed to have MAX size of params / 16. So, here we go.
I.e. for model with 100m params, that's 400m of floats (or 800m of doubles)
The worst case for us is bitmap encoding, that takes 2 bits to encode each gradient value
so, for f... | [
"This",
"method",
"returns",
"optimal",
"bufferSize",
"for",
"a",
"given",
"model"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/accumulation/EncodedGradientsAccumulator.java#L170-L174 |
127,916 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/accumulation/EncodedGradientsAccumulator.java | EncodedGradientsAccumulator.touch | @Override
public void touch() {
if (index.get() == null) {
// set index
int numDevces = Nd4j.getAffinityManager().getNumberOfDevices();
/*
if we have > 1 computational device, we assign workers to workspaces "as is", as provided via AffinityManager
... | java | @Override
public void touch() {
if (index.get() == null) {
// set index
int numDevces = Nd4j.getAffinityManager().getNumberOfDevices();
/*
if we have > 1 computational device, we assign workers to workspaces "as is", as provided via AffinityManager
... | [
"@",
"Override",
"public",
"void",
"touch",
"(",
")",
"{",
"if",
"(",
"index",
".",
"get",
"(",
")",
"==",
"null",
")",
"{",
"// set index",
"int",
"numDevces",
"=",
"Nd4j",
".",
"getAffinityManager",
"(",
")",
".",
"getNumberOfDevices",
"(",
")",
";",... | This method does initialization of given worker wrt Thread-Device Affinity | [
"This",
"method",
"does",
"initialization",
"of",
"given",
"worker",
"wrt",
"Thread",
"-",
"Device",
"Affinity"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/accumulation/EncodedGradientsAccumulator.java#L415-L433 |
127,917 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/node/ParameterServerNode.java | ParameterServerNode.subscriberLaunched | public boolean subscriberLaunched() {
boolean launched = true;
for (int i = 0; i < numWorkers; i++) {
launched = launched && subscriber[i].subscriberLaunched();
}
return launched;
} | java | public boolean subscriberLaunched() {
boolean launched = true;
for (int i = 0; i < numWorkers; i++) {
launched = launched && subscriber[i].subscriberLaunched();
}
return launched;
} | [
"public",
"boolean",
"subscriberLaunched",
"(",
")",
"{",
"boolean",
"launched",
"=",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numWorkers",
";",
"i",
"++",
")",
"{",
"launched",
"=",
"launched",
"&&",
"subscriber",
"[",
"i",
"]"... | Returns true if all susbcribers in the
subscriber pool have been launched
@return | [
"Returns",
"true",
"if",
"all",
"susbcribers",
"in",
"the",
"subscriber",
"pool",
"have",
"been",
"launched"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/node/ParameterServerNode.java#L153-L160 |
127,918 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ROCMultiClass.java | ROCMultiClass.merge | @Override
public void merge(ROCMultiClass other) {
if (this.underlying == null) {
this.underlying = other.underlying;
return;
} else if (other.underlying == null) {
return;
}
//Both have data
if (underlying.length != other.underlying.lengt... | java | @Override
public void merge(ROCMultiClass other) {
if (this.underlying == null) {
this.underlying = other.underlying;
return;
} else if (other.underlying == null) {
return;
}
//Both have data
if (underlying.length != other.underlying.lengt... | [
"@",
"Override",
"public",
"void",
"merge",
"(",
"ROCMultiClass",
"other",
")",
"{",
"if",
"(",
"this",
".",
"underlying",
"==",
"null",
")",
"{",
"this",
".",
"underlying",
"=",
"other",
".",
"underlying",
";",
"return",
";",
"}",
"else",
"if",
"(",
... | Merge this ROCMultiClass instance with another.
This ROCMultiClass instance is modified, by adding the stats from the other instance.
@param other ROCMultiClass instance to combine with this one | [
"Merge",
"this",
"ROCMultiClass",
"instance",
"with",
"another",
".",
"This",
"ROCMultiClass",
"instance",
"is",
"modified",
"by",
"adding",
"the",
"stats",
"from",
"the",
"other",
"instance",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ROCMultiClass.java#L307-L324 |
127,919 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/learning/impl/sequence/DM.java | DM.inferSequence | @Override
public INDArray inferSequence(Sequence<T> sequence, long nr, double learningRate, double minLearningRate,
int iterations) {
AtomicLong nextRandom = new AtomicLong(nr);
// we probably don't want subsampling here
// Sequence<T> seq = cbow.applySubsampling(sequenc... | java | @Override
public INDArray inferSequence(Sequence<T> sequence, long nr, double learningRate, double minLearningRate,
int iterations) {
AtomicLong nextRandom = new AtomicLong(nr);
// we probably don't want subsampling here
// Sequence<T> seq = cbow.applySubsampling(sequenc... | [
"@",
"Override",
"public",
"INDArray",
"inferSequence",
"(",
"Sequence",
"<",
"T",
">",
"sequence",
",",
"long",
"nr",
",",
"double",
"learningRate",
",",
"double",
"minLearningRate",
",",
"int",
"iterations",
")",
"{",
"AtomicLong",
"nextRandom",
"=",
"new",
... | This method does training on previously unseen paragraph, and returns inferred vector
@param sequence
@param nr
@param learningRate
@return | [
"This",
"method",
"does",
"training",
"on",
"previously",
"unseen",
"paragraph",
"and",
"returns",
"inferred",
"vector"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/learning/impl/sequence/DM.java#L186-L216 |
127,920 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/VoidParameterServer.java | VoidParameterServer.shutdown | public void shutdown() {
/**
* Probably we don't need this method in practice
*/
if (initLocker.get() && shutdownLocker.compareAndSet(false, true)) {
// do shutdown
log.info("Shutting down transport...");
// we just sending out ShutdownRequestMessag... | java | public void shutdown() {
/**
* Probably we don't need this method in practice
*/
if (initLocker.get() && shutdownLocker.compareAndSet(false, true)) {
// do shutdown
log.info("Shutting down transport...");
// we just sending out ShutdownRequestMessag... | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"/**\n * Probably we don't need this method in practice\n */",
"if",
"(",
"initLocker",
".",
"get",
"(",
")",
"&&",
"shutdownLocker",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"// do ... | This method initiates shutdown sequence for this instance.
PLEASE NOTE: This method is blocking for first caller only | [
"This",
"method",
"initiates",
"shutdown",
"sequence",
"for",
"this",
"instance",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/VoidParameterServer.java#L381-L398 |
127,921 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/VoidParameterServer.java | VoidParameterServer.getLocalAddresses | public static Set<String> getLocalAddresses() {
try {
List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
Set<String> result = new HashSet<>();
for (NetworkInterface networkInterface : interfaces) {
if (networkInter... | java | public static Set<String> getLocalAddresses() {
try {
List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
Set<String> result = new HashSet<>();
for (NetworkInterface networkInterface : interfaces) {
if (networkInter... | [
"public",
"static",
"Set",
"<",
"String",
">",
"getLocalAddresses",
"(",
")",
"{",
"try",
"{",
"List",
"<",
"NetworkInterface",
">",
"interfaces",
"=",
"Collections",
".",
"list",
"(",
"NetworkInterface",
".",
"getNetworkInterfaces",
"(",
")",
")",
";",
"Set... | This method returns set of local IP addresses available in system.
PLEASE NOTE: loopback, disabled interfaces, IPv6 addresses are ignored here.
@return | [
"This",
"method",
"returns",
"set",
"of",
"local",
"IP",
"addresses",
"available",
"in",
"system",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/VoidParameterServer.java#L407-L431 |
127,922 | deeplearning4j/deeplearning4j | arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/optimize/generator/genetic/crossover/parentselection/RandomTwoParentSelection.java | RandomTwoParentSelection.selectParents | @Override
public double[][] selectParents() {
double[][] parents = new double[2][];
int parent1Idx = rng.nextInt(population.size());
int parent2Idx;
do {
parent2Idx = rng.nextInt(population.size());
} while (parent1Idx == parent2Idx);
parents[0] = popula... | java | @Override
public double[][] selectParents() {
double[][] parents = new double[2][];
int parent1Idx = rng.nextInt(population.size());
int parent2Idx;
do {
parent2Idx = rng.nextInt(population.size());
} while (parent1Idx == parent2Idx);
parents[0] = popula... | [
"@",
"Override",
"public",
"double",
"[",
"]",
"[",
"]",
"selectParents",
"(",
")",
"{",
"double",
"[",
"]",
"[",
"]",
"parents",
"=",
"new",
"double",
"[",
"2",
"]",
"[",
"",
"]",
";",
"int",
"parent1Idx",
"=",
"rng",
".",
"nextInt",
"(",
"popul... | Selects two random parents
@return An array of parents genes. The outer array are the parents, and the inner array are the genes. | [
"Selects",
"two",
"random",
"parents"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/optimize/generator/genetic/crossover/parentselection/RandomTwoParentSelection.java#L47-L61 |
127,923 | deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java | Normalization.minMaxColumns | public static List<Row> minMaxColumns(DataRowsFacade data, List<String> columns) {
String[] arr = new String[columns.size()];
for (int i = 0; i < arr.length; i++)
arr[i] = columns.get(i);
return minMaxColumns(data, arr);
} | java | public static List<Row> minMaxColumns(DataRowsFacade data, List<String> columns) {
String[] arr = new String[columns.size()];
for (int i = 0; i < arr.length; i++)
arr[i] = columns.get(i);
return minMaxColumns(data, arr);
} | [
"public",
"static",
"List",
"<",
"Row",
">",
"minMaxColumns",
"(",
"DataRowsFacade",
"data",
",",
"List",
"<",
"String",
">",
"columns",
")",
"{",
"String",
"[",
"]",
"arr",
"=",
"new",
"String",
"[",
"columns",
".",
"size",
"(",
")",
"]",
";",
"for"... | Returns the min and max of the given columns
@param data the data to get the max for
@param columns the columns to get the
@return | [
"Returns",
"the",
"min",
"and",
"max",
"of",
"the",
"given",
"columns"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java#L199-L204 |
127,924 | deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java | Normalization.minMaxColumns | public static List<Row> minMaxColumns(DataRowsFacade data, String... columns) {
return aggregate(data, columns, new String[] {"min", "max"});
} | java | public static List<Row> minMaxColumns(DataRowsFacade data, String... columns) {
return aggregate(data, columns, new String[] {"min", "max"});
} | [
"public",
"static",
"List",
"<",
"Row",
">",
"minMaxColumns",
"(",
"DataRowsFacade",
"data",
",",
"String",
"...",
"columns",
")",
"{",
"return",
"aggregate",
"(",
"data",
",",
"columns",
",",
"new",
"String",
"[",
"]",
"{",
"\"min\"",
",",
"\"max\"",
"}... | Returns the min and max of the given columns.
The list returned is a list of size 2 where each row
@param data the data to get the max for
@param columns the columns to get the
@return | [
"Returns",
"the",
"min",
"and",
"max",
"of",
"the",
"given",
"columns",
".",
"The",
"list",
"returned",
"is",
"a",
"list",
"of",
"size",
"2",
"where",
"each",
"row"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java#L213-L215 |
127,925 | deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java | Normalization.stdDevMeanColumns | public static List<Row> stdDevMeanColumns(DataRowsFacade data, String... columns) {
return aggregate(data, columns, new String[] {"stddev", "mean"});
} | java | public static List<Row> stdDevMeanColumns(DataRowsFacade data, String... columns) {
return aggregate(data, columns, new String[] {"stddev", "mean"});
} | [
"public",
"static",
"List",
"<",
"Row",
">",
"stdDevMeanColumns",
"(",
"DataRowsFacade",
"data",
",",
"String",
"...",
"columns",
")",
"{",
"return",
"aggregate",
"(",
"data",
",",
"columns",
",",
"new",
"String",
"[",
"]",
"{",
"\"stddev\"",
",",
"\"mean\... | Returns the standard deviation
and mean of the given columns
The list returned is a list of size 2 where each row
represents the standard deviation of each column and the mean of each column
@param data the data to get the standard deviation and mean for
@param columns the columns to get the
@return | [
"Returns",
"the",
"standard",
"deviation",
"and",
"mean",
"of",
"the",
"given",
"columns",
"The",
"list",
"returned",
"is",
"a",
"list",
"of",
"size",
"2",
"where",
"each",
"row",
"represents",
"the",
"standard",
"deviation",
"of",
"each",
"column",
"and",
... | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java#L240-L242 |
127,926 | deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java | Normalization.aggregate | public static List<Row> aggregate(DataRowsFacade data, String[] columns, String[] functions) {
String[] rest = new String[columns.length - 1];
System.arraycopy(columns, 1, rest, 0, rest.length);
List<Row> rows = new ArrayList<>();
for (String op : functions) {
Map<String, Str... | java | public static List<Row> aggregate(DataRowsFacade data, String[] columns, String[] functions) {
String[] rest = new String[columns.length - 1];
System.arraycopy(columns, 1, rest, 0, rest.length);
List<Row> rows = new ArrayList<>();
for (String op : functions) {
Map<String, Str... | [
"public",
"static",
"List",
"<",
"Row",
">",
"aggregate",
"(",
"DataRowsFacade",
"data",
",",
"String",
"[",
"]",
"columns",
",",
"String",
"[",
"]",
"functions",
")",
"{",
"String",
"[",
"]",
"rest",
"=",
"new",
"String",
"[",
"columns",
".",
"length"... | Aggregate based on an arbitrary list
of aggregation and grouping functions
@param data the dataframe to aggregate
@param columns the columns to aggregate
@param functions the functions to use
@return the list of rows with the aggregated statistics.
Each row will be a function with the desired columnar output
in the ord... | [
"Aggregate",
"based",
"on",
"an",
"arbitrary",
"list",
"of",
"aggregation",
"and",
"grouping",
"functions"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java#L254-L299 |
127,927 | deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java | Normalization.normalize | public static JavaRDD<List<Writable>> normalize(Schema schema, JavaRDD<List<Writable>> data,
List<String> skipColumns) {
return normalize(schema, data, 0, 1, skipColumns);
} | java | public static JavaRDD<List<Writable>> normalize(Schema schema, JavaRDD<List<Writable>> data,
List<String> skipColumns) {
return normalize(schema, data, 0, 1, skipColumns);
} | [
"public",
"static",
"JavaRDD",
"<",
"List",
"<",
"Writable",
">",
">",
"normalize",
"(",
"Schema",
"schema",
",",
"JavaRDD",
"<",
"List",
"<",
"Writable",
">",
">",
"data",
",",
"List",
"<",
"String",
">",
"skipColumns",
")",
"{",
"return",
"normalize",
... | Scale all data 0 to 1
@param schema the schema of the data to scale
@param data the data to scale
@return the normalized ata | [
"Scale",
"all",
"data",
"0",
"to",
"1"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java#L412-L415 |
127,928 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.discretize | public static int discretize(double value, double min, double max, int binCount) {
int discreteValue = (int) (binCount * normalize(value, min, max));
return clamp(discreteValue, 0, binCount - 1);
} | java | public static int discretize(double value, double min, double max, int binCount) {
int discreteValue = (int) (binCount * normalize(value, min, max));
return clamp(discreteValue, 0, binCount - 1);
} | [
"public",
"static",
"int",
"discretize",
"(",
"double",
"value",
",",
"double",
"min",
",",
"double",
"max",
",",
"int",
"binCount",
")",
"{",
"int",
"discreteValue",
"=",
"(",
"int",
")",
"(",
"binCount",
"*",
"normalize",
"(",
"value",
",",
"min",
",... | Discretize the given value
@param value the value to discretize
@param min the min of the distribution
@param max the max of the distribution
@param binCount the number of bins
@return the discretized value | [
"Discretize",
"the",
"given",
"value"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L82-L85 |
127,929 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.binomial | public static int binomial(RandomGenerator rng, int n, double p) {
if ((p < 0) || (p > 1)) {
return 0;
}
int c = 0;
for (int i = 0; i < n; i++) {
if (rng.nextDouble() < p) {
c++;
}
}
return c;
} | java | public static int binomial(RandomGenerator rng, int n, double p) {
if ((p < 0) || (p > 1)) {
return 0;
}
int c = 0;
for (int i = 0; i < n; i++) {
if (rng.nextDouble() < p) {
c++;
}
}
return c;
} | [
"public",
"static",
"int",
"binomial",
"(",
"RandomGenerator",
"rng",
",",
"int",
"n",
",",
"double",
"p",
")",
"{",
"if",
"(",
"(",
"p",
"<",
"0",
")",
"||",
"(",
"p",
">",
"1",
")",
")",
"{",
"return",
"0",
";",
"}",
"int",
"c",
"=",
"0",
... | Generates a binomial distributed number using
the given rng
@param rng
@param n
@param p
@return | [
"Generates",
"a",
"binomial",
"distributed",
"number",
"using",
"the",
"given",
"rng"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L115-L126 |
127,930 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.uniform | public static double uniform(Random rng, double min, double max) {
return rng.nextDouble() * (max - min) + min;
} | java | public static double uniform(Random rng, double min, double max) {
return rng.nextDouble() * (max - min) + min;
} | [
"public",
"static",
"double",
"uniform",
"(",
"Random",
"rng",
",",
"double",
"min",
",",
"double",
"max",
")",
"{",
"return",
"rng",
".",
"nextDouble",
"(",
")",
"*",
"(",
"max",
"-",
"min",
")",
"+",
"min",
";",
"}"
] | Generate a uniform random number from the given rng
@param rng the rng to use
@param min the min num
@param max the max num
@return a number uniformly distributed between min and max | [
"Generate",
"a",
"uniform",
"random",
"number",
"from",
"the",
"given",
"rng"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L135-L137 |
127,931 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.ssReg | public static double ssReg(double[] residuals, double[] targetAttribute) {
double mean = sum(targetAttribute) / targetAttribute.length;
double ret = 0;
for (int i = 0; i < residuals.length; i++) {
ret += Math.pow(residuals[i] - mean, 2);
}
return ret;
} | java | public static double ssReg(double[] residuals, double[] targetAttribute) {
double mean = sum(targetAttribute) / targetAttribute.length;
double ret = 0;
for (int i = 0; i < residuals.length; i++) {
ret += Math.pow(residuals[i] - mean, 2);
}
return ret;
} | [
"public",
"static",
"double",
"ssReg",
"(",
"double",
"[",
"]",
"residuals",
",",
"double",
"[",
"]",
"targetAttribute",
")",
"{",
"double",
"mean",
"=",
"sum",
"(",
"targetAttribute",
")",
"/",
"targetAttribute",
".",
"length",
";",
"double",
"ret",
"=",
... | How much of the variance is explained by the regression
@param residuals error
@param targetAttribute data for target attribute
@return the sum squares of regression | [
"How",
"much",
"of",
"the",
"variance",
"is",
"explained",
"by",
"the",
"regression"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L173-L180 |
127,932 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.ssError | public static double ssError(double[] predictedValues, double[] targetAttribute) {
double ret = 0;
for (int i = 0; i < predictedValues.length; i++) {
ret += Math.pow(targetAttribute[i] - predictedValues[i], 2);
}
return ret;
} | java | public static double ssError(double[] predictedValues, double[] targetAttribute) {
double ret = 0;
for (int i = 0; i < predictedValues.length; i++) {
ret += Math.pow(targetAttribute[i] - predictedValues[i], 2);
}
return ret;
} | [
"public",
"static",
"double",
"ssError",
"(",
"double",
"[",
"]",
"predictedValues",
",",
"double",
"[",
"]",
"targetAttribute",
")",
"{",
"double",
"ret",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"predictedValues",
".",
"length"... | How much of the variance is NOT explained by the regression
@param predictedValues predicted values
@param targetAttribute data for target attribute
@return the sum squares of regression | [
"How",
"much",
"of",
"the",
"variance",
"is",
"NOT",
"explained",
"by",
"the",
"regression"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L188-L195 |
127,933 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.stringSimilarity | public static double stringSimilarity(String... strings) {
if (strings == null)
return 0;
Counter<String> counter = new Counter<>();
Counter<String> counter2 = new Counter<>();
for (int i = 0; i < strings[0].length(); i++)
counter.incrementCount(String.valueOf(st... | java | public static double stringSimilarity(String... strings) {
if (strings == null)
return 0;
Counter<String> counter = new Counter<>();
Counter<String> counter2 = new Counter<>();
for (int i = 0; i < strings[0].length(); i++)
counter.incrementCount(String.valueOf(st... | [
"public",
"static",
"double",
"stringSimilarity",
"(",
"String",
"...",
"strings",
")",
"{",
"if",
"(",
"strings",
"==",
"null",
")",
"return",
"0",
";",
"Counter",
"<",
"String",
">",
"counter",
"=",
"new",
"Counter",
"<>",
"(",
")",
";",
"Counter",
"... | Calculate string similarity with tfidf weights relative to each character
frequency and how many times a character appears in a given string
@param strings the strings to calculate similarity for
@return the cosine similarity between the strings | [
"Calculate",
"string",
"similarity",
"with",
"tfidf",
"weights",
"relative",
"to",
"each",
"character",
"frequency",
"and",
"how",
"many",
"times",
"a",
"character",
"appears",
"in",
"a",
"given",
"string"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L204-L229 |
127,934 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.mergeCoords | public static double[] mergeCoords(double[] x, double[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(
"Sample sizes must be the same for each data applyTransformToDestination.");
double[] ret = new double[x.length + y.length];
for (in... | java | public static double[] mergeCoords(double[] x, double[] y) {
if (x.length != y.length)
throw new IllegalArgumentException(
"Sample sizes must be the same for each data applyTransformToDestination.");
double[] ret = new double[x.length + y.length];
for (in... | [
"public",
"static",
"double",
"[",
"]",
"mergeCoords",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
")",
"{",
"if",
"(",
"x",
".",
"length",
"!=",
"y",
".",
"length",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Sample sizes ... | This will merge the coordinates of the given coordinate system.
@param x the x coordinates
@param y the y coordinates
@return a vector such that each (x,y) pair is at ret[i],ret[i+1] | [
"This",
"will",
"merge",
"the",
"coordinates",
"of",
"the",
"given",
"coordinate",
"system",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L328-L339 |
127,935 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.times | public static double times(double[] nums) {
if (nums == null || nums.length == 0)
return 0;
double ret = 1;
for (int i = 0; i < nums.length; i++)
ret *= nums[i];
return ret;
} | java | public static double times(double[] nums) {
if (nums == null || nums.length == 0)
return 0;
double ret = 1;
for (int i = 0; i < nums.length; i++)
ret *= nums[i];
return ret;
} | [
"public",
"static",
"double",
"times",
"(",
"double",
"[",
"]",
"nums",
")",
"{",
"if",
"(",
"nums",
"==",
"null",
"||",
"nums",
".",
"length",
"==",
"0",
")",
"return",
"0",
";",
"double",
"ret",
"=",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0"... | This returns the product of all numbers in the given array.
@param nums the numbers to multiply over
@return the product of all numbers in the array, or 0
if the length is or nums i null | [
"This",
"returns",
"the",
"product",
"of",
"all",
"numbers",
"in",
"the",
"given",
"array",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L512-L519 |
127,936 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.sumOfProducts | public static double sumOfProducts(double[]... nums) {
if (nums == null || nums.length < 1)
return 0;
double sum = 0;
for (int i = 0; i < nums.length; i++) {
/* The ith column for all of the rows */
double[] column = column(i, nums);
sum += times(... | java | public static double sumOfProducts(double[]... nums) {
if (nums == null || nums.length < 1)
return 0;
double sum = 0;
for (int i = 0; i < nums.length; i++) {
/* The ith column for all of the rows */
double[] column = column(i, nums);
sum += times(... | [
"public",
"static",
"double",
"sumOfProducts",
"(",
"double",
"[",
"]",
"...",
"nums",
")",
"{",
"if",
"(",
"nums",
"==",
"null",
"||",
"nums",
".",
"length",
"<",
"1",
")",
"return",
"0",
";",
"double",
"sum",
"=",
"0",
";",
"for",
"(",
"int",
"... | This returns the sum of products for the given
numbers.
@param nums the sum of products for the give numbers
@return the sum of products for the given numbers | [
"This",
"returns",
"the",
"sum",
"of",
"products",
"for",
"the",
"given",
"numbers",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L528-L540 |
127,937 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.column | private static double[] column(int column, double[]... nums) throws IllegalArgumentException {
double[] ret = new double[nums.length];
for (int i = 0; i < nums.length; i++) {
double[] curr = nums[i];
ret[i] = curr[column];
}
return ret;
} | java | private static double[] column(int column, double[]... nums) throws IllegalArgumentException {
double[] ret = new double[nums.length];
for (int i = 0; i < nums.length; i++) {
double[] curr = nums[i];
ret[i] = curr[column];
}
return ret;
} | [
"private",
"static",
"double",
"[",
"]",
"column",
"(",
"int",
"column",
",",
"double",
"[",
"]",
"...",
"nums",
")",
"throws",
"IllegalArgumentException",
"{",
"double",
"[",
"]",
"ret",
"=",
"new",
"double",
"[",
"nums",
".",
"length",
"]",
";",
"for... | This returns the given column over an n arrays
@param column the column to getFromOrigin values for
@param nums the arrays to extract values from
@return a double array containing all of the numbers in that column
for all of the arrays.
@throws IllegalArgumentException if the index is < 0 | [
"This",
"returns",
"the",
"given",
"column",
"over",
"an",
"n",
"arrays"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L551-L560 |
127,938 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.xVals | public static double[] xVals(double[] vector) {
if (vector == null)
return null;
double[] x = new double[vector.length / 2];
int count = 0;
for (int i = 0; i < vector.length; i++) {
if (i % 2 != 0)
x[count++] = vector[i];
}
return... | java | public static double[] xVals(double[] vector) {
if (vector == null)
return null;
double[] x = new double[vector.length / 2];
int count = 0;
for (int i = 0; i < vector.length; i++) {
if (i % 2 != 0)
x[count++] = vector[i];
}
return... | [
"public",
"static",
"double",
"[",
"]",
"xVals",
"(",
"double",
"[",
"]",
"vector",
")",
"{",
"if",
"(",
"vector",
"==",
"null",
")",
"return",
"null",
";",
"double",
"[",
"]",
"x",
"=",
"new",
"double",
"[",
"vector",
".",
"length",
"/",
"2",
"]... | This returns the x values of the given vector.
These are assumed to be the even values of the vector.
@param vector the vector to getFromOrigin the values for
@return the x values of the given vector | [
"This",
"returns",
"the",
"x",
"values",
"of",
"the",
"given",
"vector",
".",
"These",
"are",
"assumed",
"to",
"be",
"the",
"even",
"values",
"of",
"the",
"vector",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L642-L654 |
127,939 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.yVals | public static double[] yVals(double[] vector) {
double[] y = new double[vector.length / 2];
int count = 0;
for (int i = 0; i < vector.length; i++) {
if (i % 2 == 0)
y[count++] = vector[i];
}
return y;
} | java | public static double[] yVals(double[] vector) {
double[] y = new double[vector.length / 2];
int count = 0;
for (int i = 0; i < vector.length; i++) {
if (i % 2 == 0)
y[count++] = vector[i];
}
return y;
} | [
"public",
"static",
"double",
"[",
"]",
"yVals",
"(",
"double",
"[",
"]",
"vector",
")",
"{",
"double",
"[",
"]",
"y",
"=",
"new",
"double",
"[",
"vector",
".",
"length",
"/",
"2",
"]",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i"... | This returns the odd indexed values for the given vector
@param vector the odd indexed values of rht egiven vector
@return the y values of the given vector | [
"This",
"returns",
"the",
"odd",
"indexed",
"values",
"for",
"the",
"given",
"vector"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L661-L669 |
127,940 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.rootMeansSquaredError | public static double rootMeansSquaredError(double[] real, double[] predicted) {
double ret = 0.0;
for (int i = 0; i < real.length; i++) {
ret += Math.pow((real[i] - predicted[i]), 2);
}
return Math.sqrt(ret / real.length);
} | java | public static double rootMeansSquaredError(double[] real, double[] predicted) {
double ret = 0.0;
for (int i = 0; i < real.length; i++) {
ret += Math.pow((real[i] - predicted[i]), 2);
}
return Math.sqrt(ret / real.length);
} | [
"public",
"static",
"double",
"rootMeansSquaredError",
"(",
"double",
"[",
"]",
"real",
",",
"double",
"[",
"]",
"predicted",
")",
"{",
"double",
"ret",
"=",
"0.0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"real",
".",
"length",
";",
"... | This returns the root mean squared error of two data sets
@param real the real values
@param predicted the predicted values
@return the root means squared error for two data sets | [
"This",
"returns",
"the",
"root",
"mean",
"squared",
"error",
"of",
"two",
"data",
"sets"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L728-L734 |
127,941 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPTree.java | RPTree.buildTree | public void buildTree(INDArray x) {
this.X = x;
for(int i = 0; i < x.rows(); i++) {
root.getIndices().add(i);
}
RPUtils.buildTree(this,root,rpHyperPlanes,
x,maxSize,0,similarityFunction);
} | java | public void buildTree(INDArray x) {
this.X = x;
for(int i = 0; i < x.rows(); i++) {
root.getIndices().add(i);
}
RPUtils.buildTree(this,root,rpHyperPlanes,
x,maxSize,0,similarityFunction);
} | [
"public",
"void",
"buildTree",
"(",
"INDArray",
"x",
")",
"{",
"this",
".",
"X",
"=",
"x",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"x",
".",
"rows",
"(",
")",
";",
"i",
"++",
")",
"{",
"root",
".",
"getIndices",
"(",
")",
".",... | Build the tree with the given input data
@param x | [
"Build",
"the",
"tree",
"with",
"the",
"given",
"input",
"data"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPTree.java#L83-L93 |
127,942 | deeplearning4j/deeplearning4j | arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/optimize/generator/genetic/culling/RatioCullOperator.java | RatioCullOperator.initializeInstance | public void initializeInstance(PopulationModel populationModel) {
this.population = populationModel.getPopulation();
culledSize = (int) (populationModel.getPopulationSize() * (1.0 - cullRatio) + 0.5);
} | java | public void initializeInstance(PopulationModel populationModel) {
this.population = populationModel.getPopulation();
culledSize = (int) (populationModel.getPopulationSize() * (1.0 - cullRatio) + 0.5);
} | [
"public",
"void",
"initializeInstance",
"(",
"PopulationModel",
"populationModel",
")",
"{",
"this",
".",
"population",
"=",
"populationModel",
".",
"getPopulation",
"(",
")",
";",
"culledSize",
"=",
"(",
"int",
")",
"(",
"populationModel",
".",
"getPopulationSize... | Will be called by the population model once created. | [
"Will",
"be",
"called",
"by",
"the",
"population",
"model",
"once",
"created",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/optimize/generator/genetic/culling/RatioCullOperator.java#L54-L57 |
127,943 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel2.java | SparseCpuLevel2.scoomv | public void scoomv(char transA, int M, DataBuffer values, DataBuffer rowInd, DataBuffer colInd, int nnz, INDArray x, INDArray y){
mkl_cspblas_scoogemv(
Character.toString(transA),
(IntPointer) Nd4j.createBuffer(new int[]{M}).addressPointer(),
(FloatPointer) values... | java | public void scoomv(char transA, int M, DataBuffer values, DataBuffer rowInd, DataBuffer colInd, int nnz, INDArray x, INDArray y){
mkl_cspblas_scoogemv(
Character.toString(transA),
(IntPointer) Nd4j.createBuffer(new int[]{M}).addressPointer(),
(FloatPointer) values... | [
"public",
"void",
"scoomv",
"(",
"char",
"transA",
",",
"int",
"M",
",",
"DataBuffer",
"values",
",",
"DataBuffer",
"rowInd",
",",
"DataBuffer",
"colInd",
",",
"int",
"nnz",
",",
"INDArray",
"x",
",",
"INDArray",
"y",
")",
"{",
"mkl_cspblas_scoogemv",
"(",... | Mapping with Sparse Blas calls | [
"Mapping",
"with",
"Sparse",
"Blas",
"calls"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel2.java#L37-L47 |
127,944 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/records/reader/impl/misc/SVMLightRecordReader.java | SVMLightRecordReader.setConf | @Override
public void setConf(Configuration conf) {
super.setConf(conf);
numFeatures = conf.getInt(NUM_FEATURES, -1);
if (numFeatures < 0)
numFeatures = conf.getInt(NUM_ATTRIBUTES, -1);
if (numFeatures < 0)
throw new UnsupportedOperationException("numFeatures ... | java | @Override
public void setConf(Configuration conf) {
super.setConf(conf);
numFeatures = conf.getInt(NUM_FEATURES, -1);
if (numFeatures < 0)
numFeatures = conf.getInt(NUM_ATTRIBUTES, -1);
if (numFeatures < 0)
throw new UnsupportedOperationException("numFeatures ... | [
"@",
"Override",
"public",
"void",
"setConf",
"(",
"Configuration",
"conf",
")",
"{",
"super",
".",
"setConf",
"(",
"conf",
")",
";",
"numFeatures",
"=",
"conf",
".",
"getInt",
"(",
"NUM_FEATURES",
",",
"-",
"1",
")",
";",
"if",
"(",
"numFeatures",
"<"... | Set configuration.
@param conf DataVec configuration
@throws IOException
@throws InterruptedException | [
"Set",
"configuration",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/records/reader/impl/misc/SVMLightRecordReader.java#L128-L143 |
127,945 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/records/reader/impl/misc/SVMLightRecordReader.java | SVMLightRecordReader.getNextRecord | protected Writable getNextRecord() {
Writable w = null;
if (recordLookahead != null) {
w = recordLookahead;
recordLookahead = null;
}
while (w == null && super.hasNext()) {
w = super.next().iterator().next();
if (!w.toString().startsWith(CO... | java | protected Writable getNextRecord() {
Writable w = null;
if (recordLookahead != null) {
w = recordLookahead;
recordLookahead = null;
}
while (w == null && super.hasNext()) {
w = super.next().iterator().next();
if (!w.toString().startsWith(CO... | [
"protected",
"Writable",
"getNextRecord",
"(",
")",
"{",
"Writable",
"w",
"=",
"null",
";",
"if",
"(",
"recordLookahead",
"!=",
"null",
")",
"{",
"w",
"=",
"recordLookahead",
";",
"recordLookahead",
"=",
"null",
";",
"}",
"while",
"(",
"w",
"==",
"null",... | Helper function to help detect lines that are
commented out. May read ahead and cache a line.
@return | [
"Helper",
"function",
"to",
"help",
"detect",
"lines",
"that",
"are",
"commented",
"out",
".",
"May",
"read",
"ahead",
"and",
"cache",
"a",
"line",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/records/reader/impl/misc/SVMLightRecordReader.java#L151-L164 |
127,946 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/records/reader/impl/misc/SVMLightRecordReader.java | SVMLightRecordReader.nextRecord | @Override
public Record nextRecord() {
List<Writable> next = next();
URI uri = (locations == null || locations.length < 1 ? null : locations[splitIndex]);
RecordMetaData meta = new RecordMetaDataLine(this.lineIndex - 1, uri, SVMLightRecordReader.class); //-1 as line number has been increment... | java | @Override
public Record nextRecord() {
List<Writable> next = next();
URI uri = (locations == null || locations.length < 1 ? null : locations[splitIndex]);
RecordMetaData meta = new RecordMetaDataLine(this.lineIndex - 1, uri, SVMLightRecordReader.class); //-1 as line number has been increment... | [
"@",
"Override",
"public",
"Record",
"nextRecord",
"(",
")",
"{",
"List",
"<",
"Writable",
">",
"next",
"=",
"next",
"(",
")",
";",
"URI",
"uri",
"=",
"(",
"locations",
"==",
"null",
"||",
"locations",
".",
"length",
"<",
"1",
"?",
"null",
":",
"lo... | Return next Record.
@return | [
"Return",
"next",
"Record",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/records/reader/impl/misc/SVMLightRecordReader.java#L294-L300 |
127,947 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/RandomFactory.java | RandomFactory.getRandom | public Random getRandom() {
try {
if (threadRandom.get() == null) {
Random t = (Random) randomClass.newInstance();
if (t.getStatePointer() != null) {
// TODO: attach this thing to deallocator
// if it's stateless random - we jus... | java | public Random getRandom() {
try {
if (threadRandom.get() == null) {
Random t = (Random) randomClass.newInstance();
if (t.getStatePointer() != null) {
// TODO: attach this thing to deallocator
// if it's stateless random - we jus... | [
"public",
"Random",
"getRandom",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"threadRandom",
".",
"get",
"(",
")",
"==",
"null",
")",
"{",
"Random",
"t",
"=",
"(",
"Random",
")",
"randomClass",
".",
"newInstance",
"(",
")",
";",
"if",
"(",
"t",
".",
"g... | This method returns Random implementation instance associated with calling thread
@return object implementing Random interface | [
"This",
"method",
"returns",
"Random",
"implementation",
"instance",
"associated",
"with",
"calling",
"thread"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/RandomFactory.java#L41-L58 |
127,948 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/RandomFactory.java | RandomFactory.getNewRandomInstance | public Random getNewRandomInstance(long seed) {
try {
Random t = (Random) randomClass.newInstance();
if (t.getStatePointer() != null) {
// TODO: attach this thing to deallocator
// if it's stateless random - we just don't care then
}
... | java | public Random getNewRandomInstance(long seed) {
try {
Random t = (Random) randomClass.newInstance();
if (t.getStatePointer() != null) {
// TODO: attach this thing to deallocator
// if it's stateless random - we just don't care then
}
... | [
"public",
"Random",
"getNewRandomInstance",
"(",
"long",
"seed",
")",
"{",
"try",
"{",
"Random",
"t",
"=",
"(",
"Random",
")",
"randomClass",
".",
"newInstance",
"(",
")",
";",
"if",
"(",
"t",
".",
"getStatePointer",
"(",
")",
"!=",
"null",
")",
"{",
... | This method returns new onject implementing Random interface, initialized with seed value
@param seed seed for this rng object
@return object implementing Random interface | [
"This",
"method",
"returns",
"new",
"onject",
"implementing",
"Random",
"interface",
"initialized",
"with",
"seed",
"value"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/RandomFactory.java#L76-L88 |
127,949 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/RandomFactory.java | RandomFactory.getNewRandomInstance | public Random getNewRandomInstance(long seed, long size) {
try {
Class<?> c = randomClass;
Constructor<?> constructor = c.getConstructor(long.class, long.class);
Random t = (Random) constructor.newInstance(seed, size);
return t;
} catch (Exception e) {
... | java | public Random getNewRandomInstance(long seed, long size) {
try {
Class<?> c = randomClass;
Constructor<?> constructor = c.getConstructor(long.class, long.class);
Random t = (Random) constructor.newInstance(seed, size);
return t;
} catch (Exception e) {
... | [
"public",
"Random",
"getNewRandomInstance",
"(",
"long",
"seed",
",",
"long",
"size",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"c",
"=",
"randomClass",
";",
"Constructor",
"<",
"?",
">",
"constructor",
"=",
"c",
".",
"getConstructor",
"(",
"long",
... | This method returns new onject implementing Random interface, initialized with seed value, with size of elements in buffer
@param seed rng seed
@param size size of underlying buffer
@return object implementing Random interface | [
"This",
"method",
"returns",
"new",
"onject",
"implementing",
"Random",
"interface",
"initialized",
"with",
"seed",
"value",
"with",
"size",
"of",
"elements",
"in",
"buffer"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/RandomFactory.java#L97-L106 |
127,950 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/iterator/CnnSentenceDataSetIterator.java | CnnSentenceDataSetIterator.loadSingleSentence | public INDArray loadSingleSentence(String sentence) {
List<String> tokens = tokenizeSentence(sentence);
if(format == Format.CNN1D || format == Format.RNN){
int[] featuresShape = new int[] {1, wordVectorSize, Math.min(maxSentenceLength, tokens.size())};
INDArray features = Nd4j.cr... | java | public INDArray loadSingleSentence(String sentence) {
List<String> tokens = tokenizeSentence(sentence);
if(format == Format.CNN1D || format == Format.RNN){
int[] featuresShape = new int[] {1, wordVectorSize, Math.min(maxSentenceLength, tokens.size())};
INDArray features = Nd4j.cr... | [
"public",
"INDArray",
"loadSingleSentence",
"(",
"String",
"sentence",
")",
"{",
"List",
"<",
"String",
">",
"tokens",
"=",
"tokenizeSentence",
"(",
"sentence",
")",
";",
"if",
"(",
"format",
"==",
"Format",
".",
"CNN1D",
"||",
"format",
"==",
"Format",
".... | Generally used post training time to load a single sentence for predictions | [
"Generally",
"used",
"post",
"training",
"time",
"to",
"load",
"a",
"single",
"sentence",
"for",
"predictions"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/iterator/CnnSentenceDataSetIterator.java#L137-L182 |
127,951 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java | NormalizerSerializer.getDefault | public static NormalizerSerializer getDefault() {
if (defaultSerializer == null) {
defaultSerializer = new NormalizerSerializer().addStrategy(new StandardizeSerializerStrategy())
.addStrategy(new MinMaxSerializerStrategy())
.addStrategy(new MultiStandardizeSer... | java | public static NormalizerSerializer getDefault() {
if (defaultSerializer == null) {
defaultSerializer = new NormalizerSerializer().addStrategy(new StandardizeSerializerStrategy())
.addStrategy(new MinMaxSerializerStrategy())
.addStrategy(new MultiStandardizeSer... | [
"public",
"static",
"NormalizerSerializer",
"getDefault",
"(",
")",
"{",
"if",
"(",
"defaultSerializer",
"==",
"null",
")",
"{",
"defaultSerializer",
"=",
"new",
"NormalizerSerializer",
"(",
")",
".",
"addStrategy",
"(",
"new",
"StandardizeSerializerStrategy",
"(",
... | Get the default serializer configured with strategies for the built-in normalizer implementations
@return the default serializer | [
"Get",
"the",
"default",
"serializer",
"configured",
"with",
"strategies",
"for",
"the",
"built",
"-",
"in",
"normalizer",
"implementations"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java#L125-L135 |
127,952 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java | NormalizerSerializer.getStrategy | private NormalizerSerializerStrategy getStrategy(Normalizer normalizer) {
for (NormalizerSerializerStrategy strategy : strategies) {
if (strategySupportsNormalizer(strategy, normalizer.getType(), normalizer.getClass())) {
return strategy;
}
}
throw new Run... | java | private NormalizerSerializerStrategy getStrategy(Normalizer normalizer) {
for (NormalizerSerializerStrategy strategy : strategies) {
if (strategySupportsNormalizer(strategy, normalizer.getType(), normalizer.getClass())) {
return strategy;
}
}
throw new Run... | [
"private",
"NormalizerSerializerStrategy",
"getStrategy",
"(",
"Normalizer",
"normalizer",
")",
"{",
"for",
"(",
"NormalizerSerializerStrategy",
"strategy",
":",
"strategies",
")",
"{",
"if",
"(",
"strategySupportsNormalizer",
"(",
"strategy",
",",
"normalizer",
".",
... | Get a serializer strategy the given normalizer
@param normalizer the normalizer to find a compatible serializer strategy for
@return the compatible strategy | [
"Get",
"a",
"serializer",
"strategy",
"the",
"given",
"normalizer"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java#L154-L164 |
127,953 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java | NormalizerSerializer.getStrategy | private NormalizerSerializerStrategy getStrategy(Header header) throws Exception {
if (header.normalizerType.equals(NormalizerType.CUSTOM)) {
return header.customStrategyClass.newInstance();
}
for (NormalizerSerializerStrategy strategy : strategies) {
if (strategySupports... | java | private NormalizerSerializerStrategy getStrategy(Header header) throws Exception {
if (header.normalizerType.equals(NormalizerType.CUSTOM)) {
return header.customStrategyClass.newInstance();
}
for (NormalizerSerializerStrategy strategy : strategies) {
if (strategySupports... | [
"private",
"NormalizerSerializerStrategy",
"getStrategy",
"(",
"Header",
"header",
")",
"throws",
"Exception",
"{",
"if",
"(",
"header",
".",
"normalizerType",
".",
"equals",
"(",
"NormalizerType",
".",
"CUSTOM",
")",
")",
"{",
"return",
"header",
".",
"customSt... | Get a serializer strategy the given serialized file header
@param header the header to find the associated serializer strategy for
@return the compatible strategy | [
"Get",
"a",
"serializer",
"strategy",
"the",
"given",
"serialized",
"file",
"header"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java#L172-L182 |
127,954 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java | NormalizerSerializer.strategySupportsNormalizer | private boolean strategySupportsNormalizer(NormalizerSerializerStrategy strategy, NormalizerType normalizerType,
Class<? extends Normalizer> normalizerClass) {
if (!strategy.getSupportedType().equals(normalizerType)) {
return false;
}
if... | java | private boolean strategySupportsNormalizer(NormalizerSerializerStrategy strategy, NormalizerType normalizerType,
Class<? extends Normalizer> normalizerClass) {
if (!strategy.getSupportedType().equals(normalizerType)) {
return false;
}
if... | [
"private",
"boolean",
"strategySupportsNormalizer",
"(",
"NormalizerSerializerStrategy",
"strategy",
",",
"NormalizerType",
"normalizerType",
",",
"Class",
"<",
"?",
"extends",
"Normalizer",
">",
"normalizerClass",
")",
"{",
"if",
"(",
"!",
"strategy",
".",
"getSuppor... | Check if a serializer strategy supports a normalizer. If the normalizer is a custom opType, it checks if the
supported normalizer class matches.
@param strategy
@param normalizerType
@param normalizerClass
@return whether the strategy supports the normalizer | [
"Check",
"if",
"a",
"serializer",
"strategy",
"supports",
"a",
"normalizer",
".",
"If",
"the",
"normalizer",
"is",
"a",
"custom",
"opType",
"it",
"checks",
"if",
"the",
"supported",
"normalizer",
"class",
"matches",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java#L193-L208 |
127,955 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java | NormalizerSerializer.parseHeader | private Header parseHeader(InputStream stream) throws IOException, ClassNotFoundException {
DataInputStream dis = new DataInputStream(stream);
// Check if the stream starts with the expected header
String header = dis.readUTF();
if (!header.equals(HEADER)) {
throw new Illegal... | java | private Header parseHeader(InputStream stream) throws IOException, ClassNotFoundException {
DataInputStream dis = new DataInputStream(stream);
// Check if the stream starts with the expected header
String header = dis.readUTF();
if (!header.equals(HEADER)) {
throw new Illegal... | [
"private",
"Header",
"parseHeader",
"(",
"InputStream",
"stream",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"DataInputStream",
"dis",
"=",
"new",
"DataInputStream",
"(",
"stream",
")",
";",
"// Check if the stream starts with the expected header",
... | Parse the data header
@param stream the input stream
@return the parsed header with information about the contents
@throws IOException
@throws IllegalArgumentException if the data format is invalid | [
"Parse",
"the",
"data",
"header"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java#L218-L245 |
127,956 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java | NormalizerSerializer.writeHeader | private void writeHeader(OutputStream stream, Header header) throws IOException {
DataOutputStream dos = new DataOutputStream(stream);
dos.writeUTF(HEADER);
// Write the current version
dos.writeInt(1);
// Write the normalizer opType
dos.writeUTF(header.normalizerType.t... | java | private void writeHeader(OutputStream stream, Header header) throws IOException {
DataOutputStream dos = new DataOutputStream(stream);
dos.writeUTF(HEADER);
// Write the current version
dos.writeInt(1);
// Write the normalizer opType
dos.writeUTF(header.normalizerType.t... | [
"private",
"void",
"writeHeader",
"(",
"OutputStream",
"stream",
",",
"Header",
"header",
")",
"throws",
"IOException",
"{",
"DataOutputStream",
"dos",
"=",
"new",
"DataOutputStream",
"(",
"stream",
")",
";",
"dos",
".",
"writeUTF",
"(",
"HEADER",
")",
";",
... | Write the data header
@param stream the output stream
@param header the header to write
@throws IOException | [
"Write",
"the",
"data",
"header"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java#L254-L268 |
127,957 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/play/PlayUIServer.java | PlayUIServer.autoAttachStatsStorageBySessionId | public void autoAttachStatsStorageBySessionId(Function<String, StatsStorage> statsStorageProvider) {
if (statsStorageProvider != null) {
this.statsStorageLoader = new StatsStorageLoader(statsStorageProvider);
}
} | java | public void autoAttachStatsStorageBySessionId(Function<String, StatsStorage> statsStorageProvider) {
if (statsStorageProvider != null) {
this.statsStorageLoader = new StatsStorageLoader(statsStorageProvider);
}
} | [
"public",
"void",
"autoAttachStatsStorageBySessionId",
"(",
"Function",
"<",
"String",
",",
"StatsStorage",
">",
"statsStorageProvider",
")",
"{",
"if",
"(",
"statsStorageProvider",
"!=",
"null",
")",
"{",
"this",
".",
"statsStorageLoader",
"=",
"new",
"StatsStorage... | Auto-attach StatsStorage if an unknown session ID is passed as URL path parameter in multi-session mode
@param statsStorageProvider function that returns a StatsStorage containing the given session ID | [
"Auto",
"-",
"attach",
"StatsStorage",
"if",
"an",
"unknown",
"session",
"ID",
"is",
"passed",
"as",
"URL",
"path",
"parameter",
"in",
"multi",
"-",
"session",
"mode"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/play/PlayUIServer.java#L135-L139 |
127,958 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-native-api/src/main/java/org/nd4j/nativeblas/BaseNativeNDArrayFactory.java | BaseNativeNDArrayFactory.createFromNpyPointer | @Override
public INDArray createFromNpyPointer(Pointer pointer) {
Pointer dataPointer = nativeOps.dataPointForNumpy(pointer);
int dataBufferElementSize = nativeOps.elementSizeForNpyArray(pointer);
DataBuffer data = null;
Pointer shapeBufferPointer = nativeOps.shapeBufferForNumpy(poin... | java | @Override
public INDArray createFromNpyPointer(Pointer pointer) {
Pointer dataPointer = nativeOps.dataPointForNumpy(pointer);
int dataBufferElementSize = nativeOps.elementSizeForNpyArray(pointer);
DataBuffer data = null;
Pointer shapeBufferPointer = nativeOps.shapeBufferForNumpy(poin... | [
"@",
"Override",
"public",
"INDArray",
"createFromNpyPointer",
"(",
"Pointer",
"pointer",
")",
"{",
"Pointer",
"dataPointer",
"=",
"nativeOps",
".",
"dataPointForNumpy",
"(",
"pointer",
")",
";",
"int",
"dataBufferElementSize",
"=",
"nativeOps",
".",
"elementSizeFor... | Create from an in memory numpy pointer.
Note that this is heavily used
in our python library jumpy.
@param pointer the pointer to the
numpy array
@return an ndarray created from the in memory
numpy pointer | [
"Create",
"from",
"an",
"in",
"memory",
"numpy",
"pointer",
".",
"Note",
"that",
"this",
"is",
"heavily",
"used",
"in",
"our",
"python",
"library",
"jumpy",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-native-api/src/main/java/org/nd4j/nativeblas/BaseNativeNDArrayFactory.java#L113-L183 |
127,959 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/tools/PropertyParser.java | PropertyParser.toBoolean | public boolean toBoolean(String name, boolean defaultValue) {
String property = getProperties().getProperty(name);
return property != null ? Boolean.parseBoolean(property) : defaultValue;
} | java | public boolean toBoolean(String name, boolean defaultValue) {
String property = getProperties().getProperty(name);
return property != null ? Boolean.parseBoolean(property) : defaultValue;
} | [
"public",
"boolean",
"toBoolean",
"(",
"String",
"name",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"property",
"=",
"getProperties",
"(",
")",
".",
"getProperty",
"(",
"name",
")",
";",
"return",
"property",
"!=",
"null",
"?",
"Boolean",
".",
"pa... | Get property. The method returns the default value if the property is not parsed.
@param name property name
@param defaultValue default value
@return property | [
"Get",
"property",
".",
"The",
"method",
"returns",
"the",
"default",
"value",
"if",
"the",
"property",
"is",
"not",
"parsed",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/tools/PropertyParser.java#L228-L231 |
127,960 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameterserver-model/src/main/java/org/nd4j/parameterserver/model/SubscriberState.java | SubscriberState.empty | public static SubscriberState empty() {
val map = new ConcurrentHashMap<String, Number>();
return SubscriberState.builder().serverState("empty").streamId(-1)
.parameterUpdaterStatus(map).totalUpdates(-1).isMaster(false).build();
} | java | public static SubscriberState empty() {
val map = new ConcurrentHashMap<String, Number>();
return SubscriberState.builder().serverState("empty").streamId(-1)
.parameterUpdaterStatus(map).totalUpdates(-1).isMaster(false).build();
} | [
"public",
"static",
"SubscriberState",
"empty",
"(",
")",
"{",
"val",
"map",
"=",
"new",
"ConcurrentHashMap",
"<",
"String",
",",
"Number",
">",
"(",
")",
";",
"return",
"SubscriberState",
".",
"builder",
"(",
")",
".",
"serverState",
"(",
"\"empty\"",
")"... | Returns an empty subscriber state
with -1 as total updates, master as false
and server state as empty
@return an empty subscriber state | [
"Returns",
"an",
"empty",
"subscriber",
"state",
"with",
"-",
"1",
"as",
"total",
"updates",
"master",
"as",
"false",
"and",
"server",
"state",
"as",
"empty"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameterserver-model/src/main/java/org/nd4j/parameterserver/model/SubscriberState.java#L56-L60 |
127,961 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/execution/input/Operands.java | Operands.getById | public INDArray getById(int id) {
return map.get(NodeDescriptor.builder().id(id).build());
} | java | public INDArray getById(int id) {
return map.get(NodeDescriptor.builder().id(id).build());
} | [
"public",
"INDArray",
"getById",
"(",
"int",
"id",
")",
"{",
"return",
"map",
".",
"get",
"(",
"NodeDescriptor",
".",
"builder",
"(",
")",
".",
"id",
"(",
"id",
")",
".",
"build",
"(",
")",
")",
";",
"}"
] | This method returns array identified its numeric id
@param name
@return | [
"This",
"method",
"returns",
"array",
"identified",
"its",
"numeric",
"id"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/execution/input/Operands.java#L96-L98 |
127,962 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/execution/input/Operands.java | Operands.asArray | public INDArray[] asArray() {
val val = map.values();
val res = new INDArray[val.size()];
int cnt = 0;
for (val v: val)
res[cnt++] = v;
return res;
} | java | public INDArray[] asArray() {
val val = map.values();
val res = new INDArray[val.size()];
int cnt = 0;
for (val v: val)
res[cnt++] = v;
return res;
} | [
"public",
"INDArray",
"[",
"]",
"asArray",
"(",
")",
"{",
"val",
"val",
"=",
"map",
".",
"values",
"(",
")",
";",
"val",
"res",
"=",
"new",
"INDArray",
"[",
"val",
".",
"size",
"(",
")",
"]",
";",
"int",
"cnt",
"=",
"0",
";",
"for",
"(",
"val... | This method return operands as array, in order of addition
@return | [
"This",
"method",
"return",
"operands",
"as",
"array",
"in",
"order",
"of",
"addition"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/execution/input/Operands.java#L113-L121 |
127,963 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/execution/input/Operands.java | Operands.asCollection | public Collection<Pair<NodeDescriptor, INDArray>> asCollection() {
val c = new HashSet<Pair<NodeDescriptor, INDArray>>();
for (val k: map.keySet())
c.add(Pair.makePair(k, map.get(k)));
return c;
} | java | public Collection<Pair<NodeDescriptor, INDArray>> asCollection() {
val c = new HashSet<Pair<NodeDescriptor, INDArray>>();
for (val k: map.keySet())
c.add(Pair.makePair(k, map.get(k)));
return c;
} | [
"public",
"Collection",
"<",
"Pair",
"<",
"NodeDescriptor",
",",
"INDArray",
">",
">",
"asCollection",
"(",
")",
"{",
"val",
"c",
"=",
"new",
"HashSet",
"<",
"Pair",
"<",
"NodeDescriptor",
",",
"INDArray",
">",
">",
"(",
")",
";",
"for",
"(",
"val",
... | This method returns contents of this entity as collection of key->value pairs
@return | [
"This",
"method",
"returns",
"contents",
"of",
"this",
"entity",
"as",
"collection",
"of",
"key",
"-",
">",
"value",
"pairs"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/execution/input/Operands.java#L127-L133 |
127,964 | deeplearning4j/deeplearning4j | nd4j/nd4j-buffer/src/main/java/org/nd4j/linalg/api/buffer/util/DataTypeUtil.java | DataTypeUtil.lengthForDtype | public static int lengthForDtype(DataType type) {
switch (type) {
case DOUBLE:
return 8;
case FLOAT:
return 4;
case INT:
return 4;
case HALF:
return 2;
case LONG:
return 8;... | java | public static int lengthForDtype(DataType type) {
switch (type) {
case DOUBLE:
return 8;
case FLOAT:
return 4;
case INT:
return 4;
case HALF:
return 2;
case LONG:
return 8;... | [
"public",
"static",
"int",
"lengthForDtype",
"(",
"DataType",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"DOUBLE",
":",
"return",
"8",
";",
"case",
"FLOAT",
":",
"return",
"4",
";",
"case",
"INT",
":",
"return",
"4",
";",
"case",
"HAL... | Returns the length for the given data opType
@param type
@return | [
"Returns",
"the",
"length",
"for",
"the",
"given",
"data",
"opType"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-buffer/src/main/java/org/nd4j/linalg/api/buffer/util/DataTypeUtil.java#L42-L61 |
127,965 | deeplearning4j/deeplearning4j | nd4j/nd4j-buffer/src/main/java/org/nd4j/linalg/api/buffer/util/DataTypeUtil.java | DataTypeUtil.getDtypeFromContext | public static DataType getDtypeFromContext(String dType) {
switch (dType) {
case "double":
return DataType.DOUBLE;
case "float":
return DataType.FLOAT;
case "int":
return DataType.INT;
case "half":
re... | java | public static DataType getDtypeFromContext(String dType) {
switch (dType) {
case "double":
return DataType.DOUBLE;
case "float":
return DataType.FLOAT;
case "int":
return DataType.INT;
case "half":
re... | [
"public",
"static",
"DataType",
"getDtypeFromContext",
"(",
"String",
"dType",
")",
"{",
"switch",
"(",
"dType",
")",
"{",
"case",
"\"double\"",
":",
"return",
"DataType",
".",
"DOUBLE",
";",
"case",
"\"float\"",
":",
"return",
"DataType",
".",
"FLOAT",
";",... | Get the allocation mode from the context
@return | [
"Get",
"the",
"allocation",
"mode",
"from",
"the",
"context"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-buffer/src/main/java/org/nd4j/linalg/api/buffer/util/DataTypeUtil.java#L67-L80 |
127,966 | deeplearning4j/deeplearning4j | nd4j/nd4j-buffer/src/main/java/org/nd4j/linalg/api/buffer/util/DataTypeUtil.java | DataTypeUtil.getDtypeFromContext | public static DataType getDtypeFromContext() {
try {
lock.readLock().lock();
if (dtype == null) {
lock.readLock().unlock();
lock.writeLock().lock();
if (dtype == null)
dtype = getDtypeFromContext(Nd4jContext.getInstanc... | java | public static DataType getDtypeFromContext() {
try {
lock.readLock().lock();
if (dtype == null) {
lock.readLock().unlock();
lock.writeLock().lock();
if (dtype == null)
dtype = getDtypeFromContext(Nd4jContext.getInstanc... | [
"public",
"static",
"DataType",
"getDtypeFromContext",
"(",
")",
"{",
"try",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"if",
"(",
"dtype",
"==",
"null",
")",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",... | get the allocation mode from the context
@return | [
"get",
"the",
"allocation",
"mode",
"from",
"the",
"context"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-buffer/src/main/java/org/nd4j/linalg/api/buffer/util/DataTypeUtil.java#L106-L125 |
127,967 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validateNonNegative | public static void validateNonNegative(int[] data, String paramName){
if(data == null) {
return;
}
boolean nonnegative = true;
for(int value : data){
if(value < 0) {
nonnegative = false;
}
}
Preconditions.checkArgume... | java | public static void validateNonNegative(int[] data, String paramName){
if(data == null) {
return;
}
boolean nonnegative = true;
for(int value : data){
if(value < 0) {
nonnegative = false;
}
}
Preconditions.checkArgume... | [
"public",
"static",
"void",
"validateNonNegative",
"(",
"int",
"[",
"]",
"data",
",",
"String",
"paramName",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"return",
";",
"}",
"boolean",
"nonnegative",
"=",
"true",
";",
"for",
"(",
"int",
"value"... | Checks that all values are >= 0.
@param data An array
@param paramName The param name, for error reporting | [
"Checks",
"that",
"all",
"values",
"are",
">",
"=",
"0",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L61-L77 |
127,968 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validate1NonNegative | public static int[] validate1NonNegative(int[] data, String paramName){
validateNonNegative(data, paramName);
return validate1(data, paramName);
} | java | public static int[] validate1NonNegative(int[] data, String paramName){
validateNonNegative(data, paramName);
return validate1(data, paramName);
} | [
"public",
"static",
"int",
"[",
"]",
"validate1NonNegative",
"(",
"int",
"[",
"]",
"data",
",",
"String",
"paramName",
")",
"{",
"validateNonNegative",
"(",
"data",
",",
"paramName",
")",
";",
"return",
"validate1",
"(",
"data",
",",
"paramName",
")",
";",... | Reformats the input array to a length 1 array and checks that all values are >= 0.
If the array is length 1, returns the array
@param data An array
@param paramName The param name, for error reporting
@return An int array of length 1 that represents the input | [
"Reformats",
"the",
"input",
"array",
"to",
"a",
"length",
"1",
"array",
"and",
"checks",
"that",
"all",
"values",
"are",
">",
"=",
"0",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L88-L91 |
127,969 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validate1 | public static int[] validate1(int[] data, String paramName){
if(data == null) {
return null;
}
Preconditions.checkArgument(data.length == 1,
"Need 1 %s value, got %s values: %s",
paramName, data.length, data);
return data;
} | java | public static int[] validate1(int[] data, String paramName){
if(data == null) {
return null;
}
Preconditions.checkArgument(data.length == 1,
"Need 1 %s value, got %s values: %s",
paramName, data.length, data);
return data;
} | [
"public",
"static",
"int",
"[",
"]",
"validate1",
"(",
"int",
"[",
"]",
"data",
",",
"String",
"paramName",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Preconditions",
".",
"checkArgument",
"(",
"data",
".",
"len... | Reformats the input array to a length 1 array.
If the array is length 1, returns the array
@param data An array
@param paramName The param name, for error reporting
@return An int array of length 1 that represents the input | [
"Reformats",
"the",
"input",
"array",
"to",
"a",
"length",
"1",
"array",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L102-L112 |
127,970 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validate2NonNegative | public static int[] validate2NonNegative(int[] data, boolean allowSz1, String paramName) {
validateNonNegative(data, paramName);
return validate2(data, allowSz1, paramName);
} | java | public static int[] validate2NonNegative(int[] data, boolean allowSz1, String paramName) {
validateNonNegative(data, paramName);
return validate2(data, allowSz1, paramName);
} | [
"public",
"static",
"int",
"[",
"]",
"validate2NonNegative",
"(",
"int",
"[",
"]",
"data",
",",
"boolean",
"allowSz1",
",",
"String",
"paramName",
")",
"{",
"validateNonNegative",
"(",
"data",
",",
"paramName",
")",
";",
"return",
"validate2",
"(",
"data",
... | Reformats the input array to a length 2 array and checks that all values are >= 0.
If the array is length 1, returns [a, a]
If the array is length 2, returns the array.
@param data An array
@param paramName The param name, for error reporting
@return An int array of length 2 that represents the input | [
"Reformats",
"the",
"input",
"array",
"to",
"a",
"length",
"2",
"array",
"and",
"checks",
"that",
"all",
"values",
"are",
">",
"=",
"0",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L124-L127 |
127,971 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validate2 | public static int[] validate2(int[] data, boolean allowSz1, String paramName){
if(data == null) {
return null;
}
if(allowSz1){
Preconditions.checkArgument(data.length == 1 || data.length == 2,
"Need either 1 or 2 %s values, got %s values: %s",
... | java | public static int[] validate2(int[] data, boolean allowSz1, String paramName){
if(data == null) {
return null;
}
if(allowSz1){
Preconditions.checkArgument(data.length == 1 || data.length == 2,
"Need either 1 or 2 %s values, got %s values: %s",
... | [
"public",
"static",
"int",
"[",
"]",
"validate2",
"(",
"int",
"[",
"]",
"data",
",",
"boolean",
"allowSz1",
",",
"String",
"paramName",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"allowSz1",
")",
"{"... | Reformats the input array to a length 2 array.
If the array is length 1, returns [a, a]
If the array is length 2, returns the array.
@param data An array
@param paramName The param name, for error reporting
@return An int array of length 2 that represents the input | [
"Reformats",
"the",
"input",
"array",
"to",
"a",
"length",
"2",
"array",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L139-L159 |
127,972 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validate2x2NonNegative | public static int[][] validate2x2NonNegative(int[][] data, String paramName){
for(int[] part : data)
validateNonNegative(part, paramName);
return validate2x2(data, paramName);
}
/**
* Reformats the input array to a 2x2 array.
*
* If the array is 2x1 ([[a], [b]]), ret... | java | public static int[][] validate2x2NonNegative(int[][] data, String paramName){
for(int[] part : data)
validateNonNegative(part, paramName);
return validate2x2(data, paramName);
}
/**
* Reformats the input array to a 2x2 array.
*
* If the array is 2x1 ([[a], [b]]), ret... | [
"public",
"static",
"int",
"[",
"]",
"[",
"]",
"validate2x2NonNegative",
"(",
"int",
"[",
"]",
"[",
"]",
"data",
",",
"String",
"paramName",
")",
"{",
"for",
"(",
"int",
"[",
"]",
"part",
":",
"data",
")",
"validateNonNegative",
"(",
"part",
",",
"pa... | Reformats the input array to a 2x2 array and checks that all values are >= 0.
If the array is 2x1 ([[a], [b]]), returns [[a, a], [b, b]]
If the array is 1x2 ([[a, b]]), returns [[a, b], [a, b]]
If the array is 2x2, returns the array
@param data An array
@param paramName The param name, for error reporting
@return An ... | [
"Reformats",
"the",
"input",
"array",
"to",
"a",
"2x2",
"array",
"and",
"checks",
"that",
"all",
"values",
"are",
">",
"=",
"0",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L172-L218 |
127,973 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validate3NonNegative | public static int[] validate3NonNegative(int[] data, String paramName){
validateNonNegative(data, paramName);
return validate3(data, paramName);
} | java | public static int[] validate3NonNegative(int[] data, String paramName){
validateNonNegative(data, paramName);
return validate3(data, paramName);
} | [
"public",
"static",
"int",
"[",
"]",
"validate3NonNegative",
"(",
"int",
"[",
"]",
"data",
",",
"String",
"paramName",
")",
"{",
"validateNonNegative",
"(",
"data",
",",
"paramName",
")",
";",
"return",
"validate3",
"(",
"data",
",",
"paramName",
")",
";",... | Reformats the input array to a length 3 array and checks that all values >= 0.
If the array is length 1, returns [a, a, a]
If the array is length 3, returns the array.
@param data An array
@param paramName The param name, for error reporting
@return An int array of length 3 that represents the input | [
"Reformats",
"the",
"input",
"array",
"to",
"a",
"length",
"3",
"array",
"and",
"checks",
"that",
"all",
"values",
">",
"=",
"0",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L230-L233 |
127,974 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validate3 | public static int[] validate3(int[] data, String paramName){
if(data == null) {
return null;
}
Preconditions.checkArgument(data.length == 1 || data.length == 3,
"Need either 1 or 3 %s values, got %s values: %s",
paramName, data.length, data);
... | java | public static int[] validate3(int[] data, String paramName){
if(data == null) {
return null;
}
Preconditions.checkArgument(data.length == 1 || data.length == 3,
"Need either 1 or 3 %s values, got %s values: %s",
paramName, data.length, data);
... | [
"public",
"static",
"int",
"[",
"]",
"validate3",
"(",
"int",
"[",
"]",
"data",
",",
"String",
"paramName",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Preconditions",
".",
"checkArgument",
"(",
"data",
".",
"len... | Reformats the input array to a length 3 array.
If the array is length 1, returns [a, a, a]
If the array is length 3, returns the array.
@param data An array
@param paramName The param name, for error reporting
@return An int array of length 3 that represents the input | [
"Reformats",
"the",
"input",
"array",
"to",
"a",
"length",
"3",
"array",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L245-L259 |
127,975 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validate4NonNegative | public static int[] validate4NonNegative(int[] data, String paramName){
validateNonNegative(data, paramName);
return validate4(data, paramName);
} | java | public static int[] validate4NonNegative(int[] data, String paramName){
validateNonNegative(data, paramName);
return validate4(data, paramName);
} | [
"public",
"static",
"int",
"[",
"]",
"validate4NonNegative",
"(",
"int",
"[",
"]",
"data",
",",
"String",
"paramName",
")",
"{",
"validateNonNegative",
"(",
"data",
",",
"paramName",
")",
";",
"return",
"validate4",
"(",
"data",
",",
"paramName",
")",
";",... | Reformats the input array to a length 4 array and checks that all values >= 0.
If the array is length 1, returns [a, a, a, a]
If the array is length 2, return [a, a, b, b]
If the array is length 4, returns the array.
@param data An array
@param paramName The param name, for error reporting
@return An int array of len... | [
"Reformats",
"the",
"input",
"array",
"to",
"a",
"length",
"4",
"array",
"and",
"checks",
"that",
"all",
"values",
">",
"=",
"0",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L272-L275 |
127,976 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validate4 | public static int[] validate4(int[] data, String paramName){
if(data == null) {
return null;
}
Preconditions.checkArgument(data.length == 1 || data.length == 2 || data.length == 4,
"Need either 1, 2, or 4 %s values, got %s values: %s",
paramName, data... | java | public static int[] validate4(int[] data, String paramName){
if(data == null) {
return null;
}
Preconditions.checkArgument(data.length == 1 || data.length == 2 || data.length == 4,
"Need either 1, 2, or 4 %s values, got %s values: %s",
paramName, data... | [
"public",
"static",
"int",
"[",
"]",
"validate4",
"(",
"int",
"[",
"]",
"data",
",",
"String",
"paramName",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Preconditions",
".",
"checkArgument",
"(",
"data",
".",
"len... | Reformats the input array to a length 4 array.
If the array is length 1, returns [a, a, a, a]
If the array is length 2, return [a, a, b, b]
If the array is length 4, returns the array.
@param data An array
@param paramName The param name, for error reporting
@return An int array of length 4 that represents the input | [
"Reformats",
"the",
"input",
"array",
"to",
"a",
"length",
"4",
"array",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L288-L304 |
127,977 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validate6NonNegative | public static int[] validate6NonNegative(int[] data, String paramName){
validateNonNegative(data, paramName);
return validate6(data, paramName);
} | java | public static int[] validate6NonNegative(int[] data, String paramName){
validateNonNegative(data, paramName);
return validate6(data, paramName);
} | [
"public",
"static",
"int",
"[",
"]",
"validate6NonNegative",
"(",
"int",
"[",
"]",
"data",
",",
"String",
"paramName",
")",
"{",
"validateNonNegative",
"(",
"data",
",",
"paramName",
")",
";",
"return",
"validate6",
"(",
"data",
",",
"paramName",
")",
";",... | Reformats the input array to a length 6 array and checks that all values >= 0.
If the array is length 1, returns [a, a, a, a, a, a]
If the array is length 3, return [a, a, b, b, c, c]
If the array is length 6, returns the array.
@param data An array
@param paramName The param name, for error reporting
@return An int ... | [
"Reformats",
"the",
"input",
"array",
"to",
"a",
"length",
"6",
"array",
"and",
"checks",
"that",
"all",
"values",
">",
"=",
"0",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L317-L320 |
127,978 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java | ValidationUtils.validate6 | public static int[] validate6(int[] data, String paramName){
if(data == null) {
return null;
}
Preconditions.checkArgument(data.length == 1 || data.length == 3 || data.length == 6,
"Need either 1, 3, or 6 %s values, got %s values: %s",
paramName, data... | java | public static int[] validate6(int[] data, String paramName){
if(data == null) {
return null;
}
Preconditions.checkArgument(data.length == 1 || data.length == 3 || data.length == 6,
"Need either 1, 3, or 6 %s values, got %s values: %s",
paramName, data... | [
"public",
"static",
"int",
"[",
"]",
"validate6",
"(",
"int",
"[",
"]",
"data",
",",
"String",
"paramName",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Preconditions",
".",
"checkArgument",
"(",
"data",
".",
"len... | Reformats the input array to a length 6 array.
If the array is length 1, returns [a, a, a, a, a, a]
If the array is length 3, return [a, a, b, b, c, c]
If the array is length 6, returns the array.
@param data An array
@param paramName The param name, for error reporting
@return An int array of length 6 that represent... | [
"Reformats",
"the",
"input",
"array",
"to",
"a",
"length",
"6",
"array",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L333-L349 |
127,979 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/reader/impl/TreeModelUtils.java | TreeModelUtils.wordsNearest | @Override
public Collection<String> wordsNearest(String label, int n) {
if (!vocabCache.hasToken(label))
return new ArrayList<>();
Collection<String> collection = wordsNearest(Arrays.asList(label), new ArrayList<String>(), n + 1);
if (collection.contains(label))
coll... | java | @Override
public Collection<String> wordsNearest(String label, int n) {
if (!vocabCache.hasToken(label))
return new ArrayList<>();
Collection<String> collection = wordsNearest(Arrays.asList(label), new ArrayList<String>(), n + 1);
if (collection.contains(label))
coll... | [
"@",
"Override",
"public",
"Collection",
"<",
"String",
">",
"wordsNearest",
"(",
"String",
"label",
",",
"int",
"n",
")",
"{",
"if",
"(",
"!",
"vocabCache",
".",
"hasToken",
"(",
"label",
")",
")",
"return",
"new",
"ArrayList",
"<>",
"(",
")",
";",
... | This method returns nearest words for target word, based on tree structure.
This method is recommended to use if you're going to call for nearest words multiple times.
VPTree will be built upon firt call to this method
@param label label of element we're looking nearest words to
@param n number of nearest elements to ... | [
"This",
"method",
"returns",
"nearest",
"words",
"for",
"target",
"word",
"based",
"on",
"tree",
"structure",
".",
"This",
"method",
"is",
"recommended",
"to",
"use",
"if",
"you",
"re",
"going",
"to",
"call",
"for",
"nearest",
"words",
"multiple",
"times",
... | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/reader/impl/TreeModelUtils.java#L66-L76 |
127,980 | deeplearning4j/deeplearning4j | datavec/datavec-perf/src/main/java/org/datavec/perf/timing/IOTiming.java | IOTiming.averageFileRead | public static TimingStatistics averageFileRead(long nTimes, RecordReader recordReader, File file, INDArrayCreationFunction function) throws Exception {
TimingStatistics timingStatistics = null;
for(int i = 0; i < nTimes; i++) {
TimingStatistics timingStatistics1 = timeNDArrayCreation(recordR... | java | public static TimingStatistics averageFileRead(long nTimes, RecordReader recordReader, File file, INDArrayCreationFunction function) throws Exception {
TimingStatistics timingStatistics = null;
for(int i = 0; i < nTimes; i++) {
TimingStatistics timingStatistics1 = timeNDArrayCreation(recordR... | [
"public",
"static",
"TimingStatistics",
"averageFileRead",
"(",
"long",
"nTimes",
",",
"RecordReader",
"recordReader",
",",
"File",
"file",
",",
"INDArrayCreationFunction",
"function",
")",
"throws",
"Exception",
"{",
"TimingStatistics",
"timingStatistics",
"=",
"null",... | Returns statistics for components of a datavec pipeline
averaged over the specified number of times
@param nTimes the number of times to run the pipeline for averaging
@param recordReader the record reader
@param file the file to read
@param function the function
@return the averaged {@link TimingStatistics} for input... | [
"Returns",
"statistics",
"for",
"components",
"of",
"a",
"datavec",
"pipeline",
"averaged",
"over",
"the",
"specified",
"number",
"of",
"times"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-perf/src/main/java/org/datavec/perf/timing/IOTiming.java#L59-L72 |
127,981 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java | Indices.adjustIndices | public static INDArrayIndex[] adjustIndices(int[] originalShape, INDArrayIndex... indexes) {
if (Shape.isVector(originalShape) && indexes.length == 1)
return indexes;
if (indexes.length < originalShape.length)
indexes = fillIn(originalShape, indexes);
if (indexes.length ... | java | public static INDArrayIndex[] adjustIndices(int[] originalShape, INDArrayIndex... indexes) {
if (Shape.isVector(originalShape) && indexes.length == 1)
return indexes;
if (indexes.length < originalShape.length)
indexes = fillIn(originalShape, indexes);
if (indexes.length ... | [
"public",
"static",
"INDArrayIndex",
"[",
"]",
"adjustIndices",
"(",
"int",
"[",
"]",
"originalShape",
",",
"INDArrayIndex",
"...",
"indexes",
")",
"{",
"if",
"(",
"Shape",
".",
"isVector",
"(",
"originalShape",
")",
"&&",
"indexes",
".",
"length",
"==",
"... | Prunes indices of greater length than the shape
and fills in missing indices if there are any
@param originalShape the original shape to adjust to
@param indexes the indexes to adjust
@return the adjusted indices | [
"Prunes",
"indices",
"of",
"greater",
"length",
"than",
"the",
"shape",
"and",
"fills",
"in",
"missing",
"indices",
"if",
"there",
"are",
"any"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java#L206-L226 |
127,982 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java | Indices.isContiguous | public static boolean isContiguous(int[] indices, int diff) {
if (indices.length < 1)
return true;
for (int i = 1; i < indices.length; i++) {
if (Math.abs(indices[i] - indices[i - 1]) > diff)
return false;
}
return true;
} | java | public static boolean isContiguous(int[] indices, int diff) {
if (indices.length < 1)
return true;
for (int i = 1; i < indices.length; i++) {
if (Math.abs(indices[i] - indices[i - 1]) > diff)
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isContiguous",
"(",
"int",
"[",
"]",
"indices",
",",
"int",
"diff",
")",
"{",
"if",
"(",
"indices",
".",
"length",
"<",
"1",
")",
"return",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"indices",
"... | Returns whether indices are contiguous
by a certain amount or not
@param indices the indices to test
@param diff the difference considered to be contiguous
@return whether the given indices are contiguous or not | [
"Returns",
"whether",
"indices",
"are",
"contiguous",
"by",
"a",
"certain",
"amount",
"or",
"not"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java#L276-L285 |
127,983 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java | Indices.createFromStartAndEnd | public static INDArrayIndex[] createFromStartAndEnd(INDArray start, INDArray end) {
if (start.length() != end.length())
throw new IllegalArgumentException("Start length must be equal to end length");
else {
if (start.length() > Integer.MAX_VALUE)
throw new ND4JIll... | java | public static INDArrayIndex[] createFromStartAndEnd(INDArray start, INDArray end) {
if (start.length() != end.length())
throw new IllegalArgumentException("Start length must be equal to end length");
else {
if (start.length() > Integer.MAX_VALUE)
throw new ND4JIll... | [
"public",
"static",
"INDArrayIndex",
"[",
"]",
"createFromStartAndEnd",
"(",
"INDArray",
"start",
",",
"INDArray",
"end",
")",
"{",
"if",
"(",
"start",
".",
"length",
"(",
")",
"!=",
"end",
".",
"length",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentExce... | Create an n dimensional index
based on the given interval indices.
Start and end represent the begin and
end of each interval
@param start the start indexes
@param end the end indexes
@return the interval index relative to the given
start and end indices | [
"Create",
"an",
"n",
"dimensional",
"index",
"based",
"on",
"the",
"given",
"interval",
"indices",
".",
"Start",
"and",
"end",
"represent",
"the",
"begin",
"and",
"end",
"of",
"each",
"interval"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java#L298-L311 |
127,984 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java | Indices.stride | public static int[] stride(INDArray arr, INDArrayIndex[] indexes, int... shape) {
List<Integer> strides = new ArrayList<>();
int strideIndex = 0;
//list of indexes to prepend to for new axes
//if all is encountered
List<Integer> prependNewAxes = new ArrayList<>();
for (i... | java | public static int[] stride(INDArray arr, INDArrayIndex[] indexes, int... shape) {
List<Integer> strides = new ArrayList<>();
int strideIndex = 0;
//list of indexes to prepend to for new axes
//if all is encountered
List<Integer> prependNewAxes = new ArrayList<>();
for (i... | [
"public",
"static",
"int",
"[",
"]",
"stride",
"(",
"INDArray",
"arr",
",",
"INDArrayIndex",
"[",
"]",
"indexes",
",",
"int",
"...",
"shape",
")",
"{",
"List",
"<",
"Integer",
">",
"strides",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int",
"stri... | Return the stride to be used for indexing
@param arr the array to get the strides for
@param indexes the indexes to use for computing stride
@param shape the shape of the output
@return the strides used for indexing | [
"Return",
"the",
"stride",
"to",
"be",
"used",
"for",
"indexing"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java#L461-L500 |
127,985 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java | Indices.isScalar | public static boolean isScalar(INDArray indexOver, INDArrayIndex... indexes) {
boolean allOneLength = true;
for (int i = 0; i < indexes.length; i++) {
allOneLength = allOneLength && indexes[i].length() == 1;
}
int numNewAxes = NDArrayIndex.numNewAxis(indexes);
if (al... | java | public static boolean isScalar(INDArray indexOver, INDArrayIndex... indexes) {
boolean allOneLength = true;
for (int i = 0; i < indexes.length; i++) {
allOneLength = allOneLength && indexes[i].length() == 1;
}
int numNewAxes = NDArrayIndex.numNewAxis(indexes);
if (al... | [
"public",
"static",
"boolean",
"isScalar",
"(",
"INDArray",
"indexOver",
",",
"INDArrayIndex",
"...",
"indexes",
")",
"{",
"boolean",
"allOneLength",
"=",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"indexes",
".",
"length",
";",
"i",
... | Check if the given indexes
over the specified array
are searching for a scalar
@param indexOver the array to index over
@param indexes the index query
@return true if the given indexes are searching
for a scalar false otherwise | [
"Check",
"if",
"the",
"given",
"indexes",
"over",
"the",
"specified",
"array",
"are",
"searching",
"for",
"a",
"scalar"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java#L512-L526 |
127,986 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/CpuLapack.java | CpuLapack.sgetrf | @Override
public void sgetrf(int M, int N, INDArray A, INDArray IPIV, INDArray INFO) {
int status = LAPACKE_sgetrf(getColumnOrder(A), M, N,
(FloatPointer)A.data().addressPointer(),
getLda(A), (IntPointer)IPIV.data().addressPointer()
);
if( status < 0 ) {
... | java | @Override
public void sgetrf(int M, int N, INDArray A, INDArray IPIV, INDArray INFO) {
int status = LAPACKE_sgetrf(getColumnOrder(A), M, N,
(FloatPointer)A.data().addressPointer(),
getLda(A), (IntPointer)IPIV.data().addressPointer()
);
if( status < 0 ) {
... | [
"@",
"Override",
"public",
"void",
"sgetrf",
"(",
"int",
"M",
",",
"int",
"N",
",",
"INDArray",
"A",
",",
"INDArray",
"IPIV",
",",
"INDArray",
"INFO",
")",
"{",
"int",
"status",
"=",
"LAPACKE_sgetrf",
"(",
"getColumnOrder",
"(",
"A",
")",
",",
"M",
"... | L U DECOMP | [
"L",
"U",
"DECOMP"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/CpuLapack.java#L48-L57 |
127,987 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/CpuLapack.java | CpuLapack.getri | @Override
public void getri(int N, INDArray A, int lda, int[] IPIV, INDArray WORK, int lwork, int INFO) {
} | java | @Override
public void getri(int N, INDArray A, int lda, int[] IPIV, INDArray WORK, int lwork, int INFO) {
} | [
"@",
"Override",
"public",
"void",
"getri",
"(",
"int",
"N",
",",
"INDArray",
"A",
",",
"int",
"lda",
",",
"int",
"[",
"]",
"IPIV",
",",
"INDArray",
"WORK",
",",
"int",
"lwork",
",",
"int",
"INFO",
")",
"{",
"}"
] | Generate inverse given LU decomp
@param N
@param A
@param lda
@param IPIV
@param WORK
@param lwork
@param INFO | [
"Generate",
"inverse",
"given",
"LU",
"decomp"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/CpuLapack.java#L286-L289 |
127,988 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/v2/transport/impl/AeronUdpTransport.java | AeronUdpTransport.jointMessageHandler | protected void jointMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
byte[] data = new byte[length];
buffer.getBytes(offset, data);
// deserialize message
val message = VoidMessage.fromBytes(data);
// we're checking if this is known connection or not... | java | protected void jointMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
byte[] data = new byte[length];
buffer.getBytes(offset, data);
// deserialize message
val message = VoidMessage.fromBytes(data);
// we're checking if this is known connection or not... | [
"protected",
"void",
"jointMessageHandler",
"(",
"DirectBuffer",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
",",
"Header",
"header",
")",
"{",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"buffer",
".",
"getBytes",
"(... | This method converts aeron buffer into VoidMessage and puts into temp queue for further processing
@param buffer
@param offset
@param length
@param header | [
"This",
"method",
"converts",
"aeron",
"buffer",
"into",
"VoidMessage",
"and",
"puts",
"into",
"temp",
"queue",
"for",
"further",
"processing"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/v2/transport/impl/AeronUdpTransport.java#L245-L265 |
127,989 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/LossLayer.java | LossLayer.f1Score | @Override
public double f1Score(INDArray examples, INDArray labels) {
Evaluation eval = new Evaluation();
eval.eval(labels, activate(examples, false, LayerWorkspaceMgr.noWorkspacesImmutable()));
return eval.f1();
} | java | @Override
public double f1Score(INDArray examples, INDArray labels) {
Evaluation eval = new Evaluation();
eval.eval(labels, activate(examples, false, LayerWorkspaceMgr.noWorkspacesImmutable()));
return eval.f1();
} | [
"@",
"Override",
"public",
"double",
"f1Score",
"(",
"INDArray",
"examples",
",",
"INDArray",
"labels",
")",
"{",
"Evaluation",
"eval",
"=",
"new",
"Evaluation",
"(",
")",
";",
"eval",
".",
"eval",
"(",
"labels",
",",
"activate",
"(",
"examples",
",",
"f... | Returns the f1 score for the given examples.
Think of this to be like a percentage right.
The higher the number the more it got right.
This is on a scale from 0 to 1.
@param examples te the examples to classify (one example in each row)
@param labels the true labels
@return the scores for each ndarray | [
"Returns",
"the",
"f1",
"score",
"for",
"the",
"given",
"examples",
".",
"Think",
"of",
"this",
"to",
"be",
"like",
"a",
"percentage",
"right",
".",
"The",
"higher",
"the",
"number",
"the",
"more",
"it",
"got",
"right",
".",
"This",
"is",
"on",
"a",
... | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/LossLayer.java#L225-L230 |
127,990 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/LossLayer.java | LossLayer.predict | @Override
public int[] predict(INDArray input) {
INDArray output = activate(input, false, LayerWorkspaceMgr.noWorkspacesImmutable());
int[] ret = new int[input.rows()];
for (int i = 0; i < ret.length; i++)
ret[i] = Nd4j.getBlasWrapper().iamax(output.getRow(i));
return ret... | java | @Override
public int[] predict(INDArray input) {
INDArray output = activate(input, false, LayerWorkspaceMgr.noWorkspacesImmutable());
int[] ret = new int[input.rows()];
for (int i = 0; i < ret.length; i++)
ret[i] = Nd4j.getBlasWrapper().iamax(output.getRow(i));
return ret... | [
"@",
"Override",
"public",
"int",
"[",
"]",
"predict",
"(",
"INDArray",
"input",
")",
"{",
"INDArray",
"output",
"=",
"activate",
"(",
"input",
",",
"false",
",",
"LayerWorkspaceMgr",
".",
"noWorkspacesImmutable",
"(",
")",
")",
";",
"int",
"[",
"]",
"re... | Returns the predictions for each example in the dataset
@param input the matrix to predict
@return the prediction for the dataset | [
"Returns",
"the",
"predictions",
"for",
"each",
"example",
"in",
"the",
"dataset"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/LossLayer.java#L253-L260 |
127,991 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/LossLayer.java | LossLayer.predict | @Override
public List<String> predict(DataSet dataSet) {
int[] intRet = predict(dataSet.getFeatures());
List<String> ret = new ArrayList<>();
for (int i : intRet) {
ret.add(i, dataSet.getLabelName(i));
}
return ret;
} | java | @Override
public List<String> predict(DataSet dataSet) {
int[] intRet = predict(dataSet.getFeatures());
List<String> ret = new ArrayList<>();
for (int i : intRet) {
ret.add(i, dataSet.getLabelName(i));
}
return ret;
} | [
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"predict",
"(",
"DataSet",
"dataSet",
")",
"{",
"int",
"[",
"]",
"intRet",
"=",
"predict",
"(",
"dataSet",
".",
"getFeatures",
"(",
")",
")",
";",
"List",
"<",
"String",
">",
"ret",
"=",
"new",
... | Return predicted label names
@param dataSet to predict
@return the predicted labels for the dataSet | [
"Return",
"predicted",
"label",
"names"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/LossLayer.java#L268-L276 |
127,992 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/LossLayer.java | LossLayer.fit | @Override
public void fit(INDArray examples, int[] labels) {
INDArray outcomeMatrix = FeatureUtil.toOutcomeMatrix(labels, numLabels());
fit(examples, outcomeMatrix);
} | java | @Override
public void fit(INDArray examples, int[] labels) {
INDArray outcomeMatrix = FeatureUtil.toOutcomeMatrix(labels, numLabels());
fit(examples, outcomeMatrix);
} | [
"@",
"Override",
"public",
"void",
"fit",
"(",
"INDArray",
"examples",
",",
"int",
"[",
"]",
"labels",
")",
"{",
"INDArray",
"outcomeMatrix",
"=",
"FeatureUtil",
".",
"toOutcomeMatrix",
"(",
"labels",
",",
"numLabels",
"(",
")",
")",
";",
"fit",
"(",
"ex... | Fit the model
@param examples the examples to classify (one example in each row)
@param labels the labels for each example (the number of labels must match | [
"Fit",
"the",
"model"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/LossLayer.java#L305-L310 |
127,993 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-core/src/main/java/org/deeplearning4j/ui/UiConnectionInfo.java | UiConnectionInfo.getFirstPart | public String getFirstPart() {
StringBuilder builder = new StringBuilder();
builder.append(useHttps ? "https" : "http").append("://").append(address).append(":").append(port).append("");
return builder.toString();
} | java | public String getFirstPart() {
StringBuilder builder = new StringBuilder();
builder.append(useHttps ? "https" : "http").append("://").append(address).append(":").append(port).append("");
return builder.toString();
} | [
"public",
"String",
"getFirstPart",
"(",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"useHttps",
"?",
"\"https\"",
":",
"\"http\"",
")",
".",
"append",
"(",
"\"://\"",
")",
".",
"append",... | This method returns scheme, address and port for this UiConnectionInfo
i.e: https://localhost:8080
@return | [
"This",
"method",
"returns",
"scheme",
"address",
"and",
"port",
"for",
"this",
"UiConnectionInfo"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-core/src/main/java/org/deeplearning4j/ui/UiConnectionInfo.java#L52-L58 |
127,994 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/deeplearning4j-aws/src/main/java/org/deeplearning4j/aws/s3/reader/S3Downloader.java | S3Downloader.keysForBucket | public List<String> keysForBucket(String bucket) {
AmazonS3 s3 = getClient();
List<String> ret = new ArrayList<>();
ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(bucket);
ObjectListing objectListing;
do {
objectListing = s3.listObjec... | java | public List<String> keysForBucket(String bucket) {
AmazonS3 s3 = getClient();
List<String> ret = new ArrayList<>();
ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(bucket);
ObjectListing objectListing;
do {
objectListing = s3.listObjec... | [
"public",
"List",
"<",
"String",
">",
"keysForBucket",
"(",
"String",
"bucket",
")",
"{",
"AmazonS3",
"s3",
"=",
"getClient",
"(",
")",
";",
"List",
"<",
"String",
">",
"ret",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"ListObjectsRequest",
"listObjec... | Return the keys for a bucket
@param bucket the bucket to get the keys for
@return the bucket's keys | [
"Return",
"the",
"keys",
"for",
"a",
"bucket"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/deeplearning4j-aws/src/main/java/org/deeplearning4j/aws/s3/reader/S3Downloader.java#L44-L59 |
127,995 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/v2/transport/impl/BaseTransport.java | BaseTransport.forwardToParameterServer | private void forwardToParameterServer(INDArrayMessage message) {
try {
incomingFlow.accept(message);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | private void forwardToParameterServer(INDArrayMessage message) {
try {
incomingFlow.accept(message);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"private",
"void",
"forwardToParameterServer",
"(",
"INDArrayMessage",
"message",
")",
"{",
"try",
"{",
"incomingFlow",
".",
"accept",
"(",
"message",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",... | This method puts INDArray to the flow read by parameter server
@param message | [
"This",
"method",
"puts",
"INDArray",
"to",
"the",
"flow",
"read",
"by",
"parameter",
"server"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/v2/transport/impl/BaseTransport.java#L343-L349 |
127,996 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-data/deeplearning4j-datasets/src/main/java/org/deeplearning4j/datasets/fetchers/CacheableExtractableDataSetFetcher.java | CacheableExtractableDataSetFetcher.downloadAndExtract | public void downloadAndExtract(DataSetType set) throws IOException {
String localFilename = new File(remoteDataUrl(set)).getName();
File tmpFile = new File(System.getProperty("java.io.tmpdir"), localFilename);
File localCacheDir = getLocalCacheDir();
// check empty cache
if(loca... | java | public void downloadAndExtract(DataSetType set) throws IOException {
String localFilename = new File(remoteDataUrl(set)).getName();
File tmpFile = new File(System.getProperty("java.io.tmpdir"), localFilename);
File localCacheDir = getLocalCacheDir();
// check empty cache
if(loca... | [
"public",
"void",
"downloadAndExtract",
"(",
"DataSetType",
"set",
")",
"throws",
"IOException",
"{",
"String",
"localFilename",
"=",
"new",
"File",
"(",
"remoteDataUrl",
"(",
"set",
")",
")",
".",
"getName",
"(",
")",
";",
"File",
"tmpFile",
"=",
"new",
"... | Downloads and extracts the local dataset.
@throws IOException | [
"Downloads",
"and",
"extracts",
"the",
"local",
"dataset",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-data/deeplearning4j-datasets/src/main/java/org/deeplearning4j/datasets/fetchers/CacheableExtractableDataSetFetcher.java#L49-L96 |
127,997 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-ui-model/src/main/java/org/deeplearning4j/ui/storage/BaseCollectionStatsStorage.java | BaseCollectionStatsStorage.checkStorageEvents | protected List<StatsStorageEvent> checkStorageEvents(Persistable p) {
if (listeners.isEmpty())
return null;
int count = 0;
StatsStorageEvent newSID = null;
StatsStorageEvent newTID = null;
StatsStorageEvent newWID = null;
//Is this a new session ID?
... | java | protected List<StatsStorageEvent> checkStorageEvents(Persistable p) {
if (listeners.isEmpty())
return null;
int count = 0;
StatsStorageEvent newSID = null;
StatsStorageEvent newTID = null;
StatsStorageEvent newWID = null;
//Is this a new session ID?
... | [
"protected",
"List",
"<",
"StatsStorageEvent",
">",
"checkStorageEvents",
"(",
"Persistable",
"p",
")",
"{",
"if",
"(",
"listeners",
".",
"isEmpty",
"(",
")",
")",
"return",
"null",
";",
"int",
"count",
"=",
"0",
";",
"StatsStorageEvent",
"newSID",
"=",
"n... | available in the DB | [
"available",
"in",
"the",
"DB"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-ui-model/src/main/java/org/deeplearning4j/ui/storage/BaseCollectionStatsStorage.java#L53-L125 |
127,998 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java | VocabularyHolder.transferBackToVocabCache | public void transferBackToVocabCache(VocabCache cache, boolean emptyHolder) {
if (!(cache instanceof InMemoryLookupCache))
throw new IllegalStateException("Sorry, only InMemoryLookupCache use implemented.");
// make sure that huffman codes are updated before transfer
List<Vocabulary... | java | public void transferBackToVocabCache(VocabCache cache, boolean emptyHolder) {
if (!(cache instanceof InMemoryLookupCache))
throw new IllegalStateException("Sorry, only InMemoryLookupCache use implemented.");
// make sure that huffman codes are updated before transfer
List<Vocabulary... | [
"public",
"void",
"transferBackToVocabCache",
"(",
"VocabCache",
"cache",
",",
"boolean",
"emptyHolder",
")",
"{",
"if",
"(",
"!",
"(",
"cache",
"instanceof",
"InMemoryLookupCache",
")",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Sorry, only InMemoryLookupC... | This method is required for compatibility purposes.
It just transfers vocabulary from VocabHolder into VocabCache
@param cache | [
"This",
"method",
"is",
"required",
"for",
"compatibility",
"purposes",
".",
"It",
"just",
"transfers",
"vocabulary",
"from",
"VocabHolder",
"into",
"VocabCache"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java#L124-L169 |
127,999 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java | VocabularyHolder.arrayToList | public static List<Integer> arrayToList(int[] array, int codeLen) {
List<Integer> result = new ArrayList<>();
for (int x = 0; x < codeLen; x++) {
result.add(array[x]);
}
return result;
} | java | public static List<Integer> arrayToList(int[] array, int codeLen) {
List<Integer> result = new ArrayList<>();
for (int x = 0; x < codeLen; x++) {
result.add(array[x]);
}
return result;
} | [
"public",
"static",
"List",
"<",
"Integer",
">",
"arrayToList",
"(",
"int",
"[",
"]",
"array",
",",
"int",
"codeLen",
")",
"{",
"List",
"<",
"Integer",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"x",
"=",
"0",
... | This method is used only for VocabCache compatibility purposes
@param array
@param codeLen
@return | [
"This",
"method",
"is",
"used",
"only",
"for",
"VocabCache",
"compatibility",
"purposes"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java#L218-L224 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.