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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
h2oai/h2o-2 | src/main/java/water/fvec/Chunk.java | Chunk.set0 | public final long set0(int idx, long l) {
setWrite();
if( _chk2.set_impl(idx,l) ) return l;
(_chk2 = inflate_impl(new NewChunk(this))).set_impl(idx,l);
return l;
} | java | public final long set0(int idx, long l) {
setWrite();
if( _chk2.set_impl(idx,l) ) return l;
(_chk2 = inflate_impl(new NewChunk(this))).set_impl(idx,l);
return l;
} | [
"public",
"final",
"long",
"set0",
"(",
"int",
"idx",
",",
"long",
"l",
")",
"{",
"setWrite",
"(",
")",
";",
"if",
"(",
"_chk2",
".",
"set_impl",
"(",
"idx",
",",
"l",
")",
")",
"return",
"l",
";",
"(",
"_chk2",
"=",
"inflate_impl",
"(",
"new",
... | Set a long element in a chunk given a 0-based chunk local index.
Write into a chunk.
May rewrite/replace chunks if the chunk needs to be
"inflated" to hold larger values. Returns the input value.
Note that the idx is an int (instead of a long), which tells you
that index 0 is the first row in the chunk, not the whol... | [
"Set",
"a",
"long",
"element",
"in",
"a",
"chunk",
"given",
"a",
"0",
"-",
"based",
"chunk",
"local",
"index",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/Chunk.java#L129-L134 | train |
h2oai/h2o-2 | src/main/java/water/fvec/Chunk.java | Chunk.set0 | public final double set0(int idx, double d) {
setWrite();
if( _chk2.set_impl(idx,d) ) return d;
(_chk2 = inflate_impl(new NewChunk(this))).set_impl(idx,d);
return d;
} | java | public final double set0(int idx, double d) {
setWrite();
if( _chk2.set_impl(idx,d) ) return d;
(_chk2 = inflate_impl(new NewChunk(this))).set_impl(idx,d);
return d;
} | [
"public",
"final",
"double",
"set0",
"(",
"int",
"idx",
",",
"double",
"d",
")",
"{",
"setWrite",
"(",
")",
";",
"if",
"(",
"_chk2",
".",
"set_impl",
"(",
"idx",
",",
"d",
")",
")",
"return",
"d",
";",
"(",
"_chk2",
"=",
"inflate_impl",
"(",
"new... | Set a double element in a chunk given a 0-based chunk local index. | [
"Set",
"a",
"double",
"element",
"in",
"a",
"chunk",
"given",
"a",
"0",
"-",
"based",
"chunk",
"local",
"index",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/Chunk.java#L137-L142 | train |
h2oai/h2o-2 | src/main/java/water/fvec/Chunk.java | Chunk.set0 | public final float set0(int idx, float f) {
setWrite();
if( _chk2.set_impl(idx,f) ) return f;
(_chk2 = inflate_impl(new NewChunk(this))).set_impl(idx,f);
return f;
} | java | public final float set0(int idx, float f) {
setWrite();
if( _chk2.set_impl(idx,f) ) return f;
(_chk2 = inflate_impl(new NewChunk(this))).set_impl(idx,f);
return f;
} | [
"public",
"final",
"float",
"set0",
"(",
"int",
"idx",
",",
"float",
"f",
")",
"{",
"setWrite",
"(",
")",
";",
"if",
"(",
"_chk2",
".",
"set_impl",
"(",
"idx",
",",
"f",
")",
")",
"return",
"f",
";",
"(",
"_chk2",
"=",
"inflate_impl",
"(",
"new",... | Set a floating element in a chunk given a 0-based chunk local index. | [
"Set",
"a",
"floating",
"element",
"in",
"a",
"chunk",
"given",
"a",
"0",
"-",
"based",
"chunk",
"local",
"index",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/Chunk.java#L145-L150 | train |
h2oai/h2o-2 | src/main/java/water/fvec/Chunk.java | Chunk.setNA0 | public final boolean setNA0(int idx) {
setWrite();
if( _chk2.setNA_impl(idx) ) return true;
(_chk2 = inflate_impl(new NewChunk(this))).setNA_impl(idx);
return true;
} | java | public final boolean setNA0(int idx) {
setWrite();
if( _chk2.setNA_impl(idx) ) return true;
(_chk2 = inflate_impl(new NewChunk(this))).setNA_impl(idx);
return true;
} | [
"public",
"final",
"boolean",
"setNA0",
"(",
"int",
"idx",
")",
"{",
"setWrite",
"(",
")",
";",
"if",
"(",
"_chk2",
".",
"setNA_impl",
"(",
"idx",
")",
")",
"return",
"true",
";",
"(",
"_chk2",
"=",
"inflate_impl",
"(",
"new",
"NewChunk",
"(",
"this"... | Set the element in a chunk as missing given a 0-based chunk local index. | [
"Set",
"the",
"element",
"in",
"a",
"chunk",
"as",
"missing",
"given",
"a",
"0",
"-",
"based",
"chunk",
"local",
"index",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/Chunk.java#L153-L158 | train |
h2oai/h2o-2 | src/main/java/water/Model.java | Model.scoreImpl | protected Frame scoreImpl(Frame adaptFrm) {
if (isSupervised()) {
int ridx = adaptFrm.find(responseName());
assert ridx == -1 : "Adapted frame should not contain response in scoring method!";
assert nfeatures() == adaptFrm.numCols() : "Number of model features " + nfeatures() + " != number of test... | java | protected Frame scoreImpl(Frame adaptFrm) {
if (isSupervised()) {
int ridx = adaptFrm.find(responseName());
assert ridx == -1 : "Adapted frame should not contain response in scoring method!";
assert nfeatures() == adaptFrm.numCols() : "Number of model features " + nfeatures() + " != number of test... | [
"protected",
"Frame",
"scoreImpl",
"(",
"Frame",
"adaptFrm",
")",
"{",
"if",
"(",
"isSupervised",
"(",
")",
")",
"{",
"int",
"ridx",
"=",
"adaptFrm",
".",
"find",
"(",
"responseName",
"(",
")",
")",
";",
"assert",
"ridx",
"==",
"-",
"1",
":",
"\"Adap... | Score already adapted frame.
@param adaptFrm
@return | [
"Score",
"already",
"adapted",
"frame",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Model.java#L252-L285 | train |
h2oai/h2o-2 | src/main/java/water/Model.java | Model.score | public final float[] score( Frame fr, boolean exact, int row ) {
double tmp[] = new double[fr.numCols()];
for( int i=0; i<tmp.length; i++ )
tmp[i] = fr.vecs()[i].at(row);
return score(fr.names(),fr.domains(),exact,tmp);
} | java | public final float[] score( Frame fr, boolean exact, int row ) {
double tmp[] = new double[fr.numCols()];
for( int i=0; i<tmp.length; i++ )
tmp[i] = fr.vecs()[i].at(row);
return score(fr.names(),fr.domains(),exact,tmp);
} | [
"public",
"final",
"float",
"[",
"]",
"score",
"(",
"Frame",
"fr",
",",
"boolean",
"exact",
",",
"int",
"row",
")",
"{",
"double",
"tmp",
"[",
"]",
"=",
"new",
"double",
"[",
"fr",
".",
"numCols",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"="... | Single row scoring, on a compatible Frame. | [
"Single",
"row",
"scoring",
"on",
"a",
"compatible",
"Frame",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Model.java#L288-L293 | train |
h2oai/h2o-2 | src/main/java/water/Model.java | Model.score | public final float[] score( String names[], String domains[][], boolean exact, double row[] ) {
return score(adapt(names,domains,exact),row,new float[nclasses()]);
} | java | public final float[] score( String names[], String domains[][], boolean exact, double row[] ) {
return score(adapt(names,domains,exact),row,new float[nclasses()]);
} | [
"public",
"final",
"float",
"[",
"]",
"score",
"(",
"String",
"names",
"[",
"]",
",",
"String",
"domains",
"[",
"]",
"[",
"]",
",",
"boolean",
"exact",
",",
"double",
"row",
"[",
"]",
")",
"{",
"return",
"score",
"(",
"adapt",
"(",
"names",
",",
... | Single row scoring, on a compatible set of data. Fairly expensive to adapt. | [
"Single",
"row",
"scoring",
"on",
"a",
"compatible",
"set",
"of",
"data",
".",
"Fairly",
"expensive",
"to",
"adapt",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Model.java#L296-L298 | train |
h2oai/h2o-2 | src/main/java/water/Model.java | Model.toJavaSuper | protected SB toJavaSuper( SB sb ) {
sb.nl();
sb.ii(1);
sb.i().p("public String[] getNames() { return NAMES; } ").nl();
sb.i().p("public String[][] getDomainValues() { return DOMAINS; }").nl();
String uuid = this.uniqueId != null ? this.uniqueId.getId() : this._key.toString();
sb.i().p("public ... | java | protected SB toJavaSuper( SB sb ) {
sb.nl();
sb.ii(1);
sb.i().p("public String[] getNames() { return NAMES; } ").nl();
sb.i().p("public String[][] getDomainValues() { return DOMAINS; }").nl();
String uuid = this.uniqueId != null ? this.uniqueId.getId() : this._key.toString();
sb.i().p("public ... | [
"protected",
"SB",
"toJavaSuper",
"(",
"SB",
"sb",
")",
"{",
"sb",
".",
"nl",
"(",
")",
";",
"sb",
".",
"ii",
"(",
"1",
")",
";",
"sb",
".",
"i",
"(",
")",
".",
"p",
"(",
"\"public String[] getNames() { return NAMES; } \"",
")",
".",
"nl",
"(",
"... | Generate implementation for super class. | [
"Generate",
"implementation",
"for",
"super",
"class",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Model.java#L641-L650 | train |
h2oai/h2o-2 | src/main/java/water/Model.java | Model.toJavaPredict | private SB toJavaPredict(SB ccsb, SB fileCtxSb) { // ccsb = classContext
ccsb.nl();
ccsb.p(" // Pass in data in a double[], pre-aligned to the Model's requirements.").nl();
ccsb.p(" // Jam predictions into the preds[] array; preds[0] is reserved for the").nl();
ccsb.p(" // main prediction (class for ... | java | private SB toJavaPredict(SB ccsb, SB fileCtxSb) { // ccsb = classContext
ccsb.nl();
ccsb.p(" // Pass in data in a double[], pre-aligned to the Model's requirements.").nl();
ccsb.p(" // Jam predictions into the preds[] array; preds[0] is reserved for the").nl();
ccsb.p(" // main prediction (class for ... | [
"private",
"SB",
"toJavaPredict",
"(",
"SB",
"ccsb",
",",
"SB",
"fileCtxSb",
")",
"{",
"// ccsb = classContext",
"ccsb",
".",
"nl",
"(",
")",
";",
"ccsb",
".",
"p",
"(",
"\" // Pass in data in a double[], pre-aligned to the Model's requirements.\"",
")",
".",
"nl",... | Wrapper around the main predict call, including the signature and return value | [
"Wrapper",
"around",
"the",
"main",
"predict",
"call",
"including",
"the",
"signature",
"and",
"return",
"value"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Model.java#L696-L711 | train |
h2oai/h2o-2 | src/main/java/water/Func.java | Func.emptyLTrash | protected final void emptyLTrash() {
if (_lVecTrash.isEmpty()) return;
Futures fs = new Futures();
cleanupTrash(_lVecTrash, fs);
fs.blockForPending();
} | java | protected final void emptyLTrash() {
if (_lVecTrash.isEmpty()) return;
Futures fs = new Futures();
cleanupTrash(_lVecTrash, fs);
fs.blockForPending();
} | [
"protected",
"final",
"void",
"emptyLTrash",
"(",
")",
"{",
"if",
"(",
"_lVecTrash",
".",
"isEmpty",
"(",
")",
")",
"return",
";",
"Futures",
"fs",
"=",
"new",
"Futures",
"(",
")",
";",
"cleanupTrash",
"(",
"_lVecTrash",
",",
"fs",
")",
";",
"fs",
".... | User call which empty local trash of vectors. | [
"User",
"call",
"which",
"empty",
"local",
"trash",
"of",
"vectors",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Func.java#L74-L79 | train |
h2oai/h2o-2 | src/main/java/hex/deeplearning/DeepLearning.java | DeepLearning.registered | @Override
protected void registered(RequestServer.API_VERSION ver) {
super.registered(ver);
for (Argument arg : _arguments) {
if ( arg._name.equals("activation") || arg._name.equals("initial_weight_distribution")
|| arg._name.equals("expert_mode") || arg._name.equals("adaptive_rate")
... | java | @Override
protected void registered(RequestServer.API_VERSION ver) {
super.registered(ver);
for (Argument arg : _arguments) {
if ( arg._name.equals("activation") || arg._name.equals("initial_weight_distribution")
|| arg._name.equals("expert_mode") || arg._name.equals("adaptive_rate")
... | [
"@",
"Override",
"protected",
"void",
"registered",
"(",
"RequestServer",
".",
"API_VERSION",
"ver",
")",
"{",
"super",
".",
"registered",
"(",
"ver",
")",
";",
"for",
"(",
"Argument",
"arg",
":",
"_arguments",
")",
"{",
"if",
"(",
"arg",
".",
"_name",
... | Helper to specify which arguments trigger a refresh on change
@param ver | [
"Helper",
"to",
"specify",
"which",
"arguments",
"trigger",
"a",
"refresh",
"on",
"change"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/deeplearning/DeepLearning.java#L581-L595 | train |
h2oai/h2o-2 | src/main/java/hex/deeplearning/DeepLearning.java | DeepLearning.prepareDataInfo | private DataInfo prepareDataInfo() {
final boolean del_enum_resp = classification && !response.isEnum();
final Frame train = FrameTask.DataInfo.prepareFrame(source, autoencoder ? null : response, ignored_cols, classification, ignore_const_cols, true /*drop >20% NA cols*/);
final DataInfo dinfo = new FrameTa... | java | private DataInfo prepareDataInfo() {
final boolean del_enum_resp = classification && !response.isEnum();
final Frame train = FrameTask.DataInfo.prepareFrame(source, autoencoder ? null : response, ignored_cols, classification, ignore_const_cols, true /*drop >20% NA cols*/);
final DataInfo dinfo = new FrameTa... | [
"private",
"DataInfo",
"prepareDataInfo",
"(",
")",
"{",
"final",
"boolean",
"del_enum_resp",
"=",
"classification",
"&&",
"!",
"response",
".",
"isEnum",
"(",
")",
";",
"final",
"Frame",
"train",
"=",
"FrameTask",
".",
"DataInfo",
".",
"prepareFrame",
"(",
... | Helper to create a DataInfo object from the source and response
@return DataInfo object | [
"Helper",
"to",
"create",
"a",
"DataInfo",
"object",
"from",
"the",
"source",
"and",
"response"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/deeplearning/DeepLearning.java#L979-L991 | train |
h2oai/h2o-2 | src/main/java/hex/deeplearning/DeepLearning.java | DeepLearning.updateFrame | Frame updateFrame(Frame target, Frame src) {
if (src != target) ltrash(src);
return src;
} | java | Frame updateFrame(Frame target, Frame src) {
if (src != target) ltrash(src);
return src;
} | [
"Frame",
"updateFrame",
"(",
"Frame",
"target",
",",
"Frame",
"src",
")",
"{",
"if",
"(",
"src",
"!=",
"target",
")",
"ltrash",
"(",
"src",
")",
";",
"return",
"src",
";",
"}"
] | Helper to update a Frame and adding it to the local trash at the same time
@param target Frame referece, to be overwritten
@param src Newly made frame, to be deleted via local trash
@return src | [
"Helper",
"to",
"update",
"a",
"Frame",
"and",
"adding",
"it",
"to",
"the",
"local",
"trash",
"at",
"the",
"same",
"time"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/deeplearning/DeepLearning.java#L1020-L1023 | train |
h2oai/h2o-2 | src/main/java/hex/deeplearning/DeepLearning.java | DeepLearning.lock_data | private void lock_data() {
source.read_lock(self());
if( validation != null && source._key != null && validation._key !=null && !source._key.equals(validation._key) )
validation.read_lock(self());
} | java | private void lock_data() {
source.read_lock(self());
if( validation != null && source._key != null && validation._key !=null && !source._key.equals(validation._key) )
validation.read_lock(self());
} | [
"private",
"void",
"lock_data",
"(",
")",
"{",
"source",
".",
"read_lock",
"(",
"self",
"(",
")",
")",
";",
"if",
"(",
"validation",
"!=",
"null",
"&&",
"source",
".",
"_key",
"!=",
"null",
"&&",
"validation",
".",
"_key",
"!=",
"null",
"&&",
"!",
... | Lock the input datasets against deletes | [
"Lock",
"the",
"input",
"datasets",
"against",
"deletes"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/deeplearning/DeepLearning.java#L1149-L1153 | train |
h2oai/h2o-2 | src/main/java/hex/deeplearning/DeepLearning.java | DeepLearning.unlock_data | private void unlock_data() {
source.unlock(self());
if( validation != null && source._key != null && validation._key != null && !source._key.equals(validation._key) )
validation.unlock(self());
} | java | private void unlock_data() {
source.unlock(self());
if( validation != null && source._key != null && validation._key != null && !source._key.equals(validation._key) )
validation.unlock(self());
} | [
"private",
"void",
"unlock_data",
"(",
")",
"{",
"source",
".",
"unlock",
"(",
"self",
"(",
")",
")",
";",
"if",
"(",
"validation",
"!=",
"null",
"&&",
"source",
".",
"_key",
"!=",
"null",
"&&",
"validation",
".",
"_key",
"!=",
"null",
"&&",
"!",
"... | Release the lock for the input datasets | [
"Release",
"the",
"lock",
"for",
"the",
"input",
"datasets"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/deeplearning/DeepLearning.java#L1158-L1162 | train |
h2oai/h2o-2 | src/main/java/hex/deeplearning/DeepLearning.java | DeepLearning.reBalance | private Frame reBalance(final Frame fr, boolean local) {
int chunks = (int)Math.min( 4 * H2O.NUMCPUS * (local ? 1 : H2O.CLOUD.size()), fr.numRows());
if (fr.anyVec().nChunks() > chunks && !reproducible) {
Log.info("Dataset already contains " + fr.anyVec().nChunks() + " chunks. No need to rebalance.");
... | java | private Frame reBalance(final Frame fr, boolean local) {
int chunks = (int)Math.min( 4 * H2O.NUMCPUS * (local ? 1 : H2O.CLOUD.size()), fr.numRows());
if (fr.anyVec().nChunks() > chunks && !reproducible) {
Log.info("Dataset already contains " + fr.anyVec().nChunks() + " chunks. No need to rebalance.");
... | [
"private",
"Frame",
"reBalance",
"(",
"final",
"Frame",
"fr",
",",
"boolean",
"local",
")",
"{",
"int",
"chunks",
"=",
"(",
"int",
")",
"Math",
".",
"min",
"(",
"4",
"*",
"H2O",
".",
"NUMCPUS",
"*",
"(",
"local",
"?",
"1",
":",
"H2O",
".",
"CLOUD... | Rebalance a frame for load balancing
@param fr Input frame
@param local whether to only create enough chunks to max out all cores on one node only
@return Frame that has potentially more chunks | [
"Rebalance",
"a",
"frame",
"for",
"load",
"balancing"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/deeplearning/DeepLearning.java#L1179-L1196 | train |
h2oai/h2o-2 | src/main/java/hex/deeplearning/DeepLearning.java | DeepLearning.computeRowUsageFraction | private static float computeRowUsageFraction(final long numRows, final long train_samples_per_iteration, final boolean replicate_training_data) {
float rowUsageFraction = (float)train_samples_per_iteration / numRows;
if (replicate_training_data) rowUsageFraction /= H2O.CLOUD.size();
assert(rowUsageFraction ... | java | private static float computeRowUsageFraction(final long numRows, final long train_samples_per_iteration, final boolean replicate_training_data) {
float rowUsageFraction = (float)train_samples_per_iteration / numRows;
if (replicate_training_data) rowUsageFraction /= H2O.CLOUD.size();
assert(rowUsageFraction ... | [
"private",
"static",
"float",
"computeRowUsageFraction",
"(",
"final",
"long",
"numRows",
",",
"final",
"long",
"train_samples_per_iteration",
",",
"final",
"boolean",
"replicate_training_data",
")",
"{",
"float",
"rowUsageFraction",
"=",
"(",
"float",
")",
"train_sam... | Compute the fraction of rows that need to be used for training during one iteration
@param numRows number of training rows
@param train_samples_per_iteration number of training rows to be processed per iteration
@param replicate_training_data whether of not the training data is replicated on each node
@return fraction ... | [
"Compute",
"the",
"fraction",
"of",
"rows",
"that",
"need",
"to",
"be",
"used",
"for",
"training",
"during",
"one",
"iteration"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/deeplearning/DeepLearning.java#L1288-L1293 | train |
h2oai/h2o-2 | src/main/java/water/util/CrossValUtils.java | CrossValUtils.crossValidate | public static void crossValidate(Job.ValidatedJob job) {
if (job.state != Job.JobState.RUNNING) return; //don't do cross-validation if the full model builder failed
if (job.validation != null)
throw new IllegalArgumentException("Cannot provide validation dataset and n_folds > 0 at the same time.");
if... | java | public static void crossValidate(Job.ValidatedJob job) {
if (job.state != Job.JobState.RUNNING) return; //don't do cross-validation if the full model builder failed
if (job.validation != null)
throw new IllegalArgumentException("Cannot provide validation dataset and n_folds > 0 at the same time.");
if... | [
"public",
"static",
"void",
"crossValidate",
"(",
"Job",
".",
"ValidatedJob",
"job",
")",
"{",
"if",
"(",
"job",
".",
"state",
"!=",
"Job",
".",
"JobState",
".",
"RUNNING",
")",
"return",
";",
"//don't do cross-validation if the full model builder failed",
"if",
... | Cross-Validate a ValidatedJob
@param job (must contain valid entries for n_folds, validation, destination_key, source, response) | [
"Cross",
"-",
"Validate",
"a",
"ValidatedJob"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/util/CrossValUtils.java#L14-L56 | train |
h2oai/h2o-2 | src/main/java/water/api/ModelMetrics.java | ModelMetrics.fetchAll | protected static List<water.ModelMetrics>fetchAll() {
return new ArrayList<water.ModelMetrics>(H2O.KeySnapshot.globalSnapshot().fetchAll(water.ModelMetrics.class).values());
} | java | protected static List<water.ModelMetrics>fetchAll() {
return new ArrayList<water.ModelMetrics>(H2O.KeySnapshot.globalSnapshot().fetchAll(water.ModelMetrics.class).values());
} | [
"protected",
"static",
"List",
"<",
"water",
".",
"ModelMetrics",
">",
"fetchAll",
"(",
")",
"{",
"return",
"new",
"ArrayList",
"<",
"water",
".",
"ModelMetrics",
">",
"(",
"H2O",
".",
"KeySnapshot",
".",
"globalSnapshot",
"(",
")",
".",
"fetchAll",
"(",
... | Fetch all ModelMetrics from the KV store. | [
"Fetch",
"all",
"ModelMetrics",
"from",
"the",
"KV",
"store",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/ModelMetrics.java#L52-L54 | train |
h2oai/h2o-2 | src/main/java/water/api/ModelMetrics.java | ModelMetrics.serveOneOrAll | private Response serveOneOrAll(List<water.ModelMetrics> list) {
JsonArray metricsArray = new JsonArray();
for (water.ModelMetrics metrics : list) {
JsonObject metricsJson = metrics.toJSON();
metricsArray.add(metricsJson);
}
JsonObject result = new JsonObject();
result.add("metrics", me... | java | private Response serveOneOrAll(List<water.ModelMetrics> list) {
JsonArray metricsArray = new JsonArray();
for (water.ModelMetrics metrics : list) {
JsonObject metricsJson = metrics.toJSON();
metricsArray.add(metricsJson);
}
JsonObject result = new JsonObject();
result.add("metrics", me... | [
"private",
"Response",
"serveOneOrAll",
"(",
"List",
"<",
"water",
".",
"ModelMetrics",
">",
"list",
")",
"{",
"JsonArray",
"metricsArray",
"=",
"new",
"JsonArray",
"(",
")",
";",
"for",
"(",
"water",
".",
"ModelMetrics",
"metrics",
":",
"list",
")",
"{",
... | For one or more water.ModelMetrics from the KV store return Response containing a map of them. | [
"For",
"one",
"or",
"more",
"water",
".",
"ModelMetrics",
"from",
"the",
"KV",
"store",
"return",
"Response",
"containing",
"a",
"map",
"of",
"them",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/ModelMetrics.java#L60-L71 | train |
h2oai/h2o-2 | src/main/java/hex/gbm/DTreeUtils.java | DTreeUtils.scoreTree | public static void scoreTree(double data[], float preds[], CompressedTree[] ts) {
for( int c=0; c<ts.length; c++ )
if( ts[c] != null )
preds[ts.length==1?0:c+1] += ts[c].score(data);
} | java | public static void scoreTree(double data[], float preds[], CompressedTree[] ts) {
for( int c=0; c<ts.length; c++ )
if( ts[c] != null )
preds[ts.length==1?0:c+1] += ts[c].score(data);
} | [
"public",
"static",
"void",
"scoreTree",
"(",
"double",
"data",
"[",
"]",
",",
"float",
"preds",
"[",
"]",
",",
"CompressedTree",
"[",
"]",
"ts",
")",
"{",
"for",
"(",
"int",
"c",
"=",
"0",
";",
"c",
"<",
"ts",
".",
"length",
";",
"c",
"++",
")... | Score given tree on the row of data.
@param data row of data
@param preds array to hold resulting prediction
@param ts a tree representation (single regression tree, or multi tree) | [
"Score",
"given",
"tree",
"on",
"the",
"row",
"of",
"data",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/gbm/DTreeUtils.java#L15-L19 | train |
h2oai/h2o-2 | src/main/java/water/api/RequestServer.java | RequestServer.registerRequest | public static Request registerRequest(Request req) {
assert req.supportedVersions().length > 0;
for (API_VERSION ver : req.supportedVersions()) {
String href = req.href(ver);
assert (! _requests.containsKey(href)) : "Request with href "+href+" already registered";
_requests.put(href,req);
... | java | public static Request registerRequest(Request req) {
assert req.supportedVersions().length > 0;
for (API_VERSION ver : req.supportedVersions()) {
String href = req.href(ver);
assert (! _requests.containsKey(href)) : "Request with href "+href+" already registered";
_requests.put(href,req);
... | [
"public",
"static",
"Request",
"registerRequest",
"(",
"Request",
"req",
")",
"{",
"assert",
"req",
".",
"supportedVersions",
"(",
")",
".",
"length",
">",
"0",
";",
"for",
"(",
"API_VERSION",
"ver",
":",
"req",
".",
"supportedVersions",
"(",
")",
")",
"... | Registers the request with the request server. | [
"Registers",
"the",
"request",
"with",
"the",
"request",
"server",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/RequestServer.java#L277-L286 | train |
h2oai/h2o-2 | src/main/java/water/api/RequestServer.java | RequestServer.start | public static void start() {
new Thread( new Runnable() {
@Override public void run() {
while( true ) {
try {
// Try to get the NanoHTTP daemon started
SERVER = new RequestServer(H2O._apiSocket);
break;
} catch( Exception ioe ) {
... | java | public static void start() {
new Thread( new Runnable() {
@Override public void run() {
while( true ) {
try {
// Try to get the NanoHTTP daemon started
SERVER = new RequestServer(H2O._apiSocket);
break;
} catch( Exception ioe ) {
... | [
"public",
"static",
"void",
"start",
"(",
")",
"{",
"new",
"Thread",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"// Try to get the NanoHTTP daemon started",
... | Keep spinning until we get to launch the NanoHTTPD | [
"Keep",
"spinning",
"until",
"we",
"get",
"to",
"launch",
"the",
"NanoHTTPD"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/RequestServer.java#L361-L376 | train |
h2oai/h2o-2 | src/main/java/water/Atomic.java | Atomic.invoke | public final T invoke( Key key ) {
RPC<Atomic<T>> rpc = fork(key);
return (T)(rpc == null ? this : rpc.get()); // Block for it
} | java | public final T invoke( Key key ) {
RPC<Atomic<T>> rpc = fork(key);
return (T)(rpc == null ? this : rpc.get()); // Block for it
} | [
"public",
"final",
"T",
"invoke",
"(",
"Key",
"key",
")",
"{",
"RPC",
"<",
"Atomic",
"<",
"T",
">>",
"rpc",
"=",
"fork",
"(",
"key",
")",
";",
"return",
"(",
"T",
")",
"(",
"rpc",
"==",
"null",
"?",
"this",
":",
"rpc",
".",
"get",
"(",
")",
... | Block until it completes, even if run remotely | [
"Block",
"until",
"it",
"completes",
"even",
"if",
"run",
"remotely"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Atomic.java#L33-L36 | train |
h2oai/h2o-2 | src/main/java/water/genmodel/GenUtils.java | GenUtils.concat | public static String[] concat(String[] ...aa) {
int l = 0;
for (String[] a : aa) l += a.length;
String[] r = new String[l];
l = 0;
for (String[] a : aa) {
System.arraycopy(a, 0, r, l, a.length);
l += a.length;
}
return r;
} | java | public static String[] concat(String[] ...aa) {
int l = 0;
for (String[] a : aa) l += a.length;
String[] r = new String[l];
l = 0;
for (String[] a : aa) {
System.arraycopy(a, 0, r, l, a.length);
l += a.length;
}
return r;
} | [
"public",
"static",
"String",
"[",
"]",
"concat",
"(",
"String",
"[",
"]",
"...",
"aa",
")",
"{",
"int",
"l",
"=",
"0",
";",
"for",
"(",
"String",
"[",
"]",
"a",
":",
"aa",
")",
"l",
"+=",
".",
"length",
";",
"String",
"[",
"]",
"r",
"=",
"... | Concatenate given list of arrays into one long array.
<p>Expect not null array.</p>
@param aa list of string arrays
@return a long array create by concatenation of given arrays. | [
"Concatenate",
"given",
"list",
"of",
"arrays",
"into",
"one",
"long",
"array",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/genmodel/GenUtils.java#L14-L24 | train |
h2oai/h2o-2 | h2o-samples/src/main/java/samples/expert/Frames.java | Frames.parse | public static Frame parse(File file) {
Key fkey = NFSFileVec.make(file);
Key dest = Key.make(file.getName());
Frame frame = ParseDataset2.parse(dest, new Key[] { fkey });
return frame;
} | java | public static Frame parse(File file) {
Key fkey = NFSFileVec.make(file);
Key dest = Key.make(file.getName());
Frame frame = ParseDataset2.parse(dest, new Key[] { fkey });
return frame;
} | [
"public",
"static",
"Frame",
"parse",
"(",
"File",
"file",
")",
"{",
"Key",
"fkey",
"=",
"NFSFileVec",
".",
"make",
"(",
"file",
")",
";",
"Key",
"dest",
"=",
"Key",
".",
"make",
"(",
"file",
".",
"getName",
"(",
")",
")",
";",
"Frame",
"frame",
... | Parse a dataset into a Frame. | [
"Parse",
"a",
"dataset",
"into",
"a",
"Frame",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/h2o-samples/src/main/java/samples/expert/Frames.java#L45-L50 | train |
h2oai/h2o-2 | h2o-samples/src/main/java/samples/expert/Frames.java | Frames.create | public static Frame create(String[] headers, double[][] rows) {
Futures fs = new Futures();
Vec[] vecs = new Vec[rows[0].length];
Key keys[] = new Vec.VectorGroup().addVecs(vecs.length);
for( int c = 0; c < vecs.length; c++ ) {
AppendableVec vec = new AppendableVec(keys[c]);
NewChunk chunk =... | java | public static Frame create(String[] headers, double[][] rows) {
Futures fs = new Futures();
Vec[] vecs = new Vec[rows[0].length];
Key keys[] = new Vec.VectorGroup().addVecs(vecs.length);
for( int c = 0; c < vecs.length; c++ ) {
AppendableVec vec = new AppendableVec(keys[c]);
NewChunk chunk =... | [
"public",
"static",
"Frame",
"create",
"(",
"String",
"[",
"]",
"headers",
",",
"double",
"[",
"]",
"[",
"]",
"rows",
")",
"{",
"Futures",
"fs",
"=",
"new",
"Futures",
"(",
")",
";",
"Vec",
"[",
"]",
"vecs",
"=",
"new",
"Vec",
"[",
"rows",
"[",
... | Creates a frame programmatically. | [
"Creates",
"a",
"frame",
"programmatically",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/h2o-samples/src/main/java/samples/expert/Frames.java#L55-L69 | train |
h2oai/h2o-2 | src/main/java/water/fvec/FileVec.java | FileVec.chunkIdx | @Override public Value chunkIdx( int cidx ) {
final long nchk = nChunks();
assert 0 <= cidx && cidx < nchk;
Key dkey = chunkKey(cidx);
Value val1 = DKV.get(dkey);// Check for an existing one... will fetch data as needed
if( val1 != null ) return val1; // Found an existing one?
// Lazily create a... | java | @Override public Value chunkIdx( int cidx ) {
final long nchk = nChunks();
assert 0 <= cidx && cidx < nchk;
Key dkey = chunkKey(cidx);
Value val1 = DKV.get(dkey);// Check for an existing one... will fetch data as needed
if( val1 != null ) return val1; // Found an existing one?
// Lazily create a... | [
"@",
"Override",
"public",
"Value",
"chunkIdx",
"(",
"int",
"cidx",
")",
"{",
"final",
"long",
"nchk",
"=",
"nChunks",
"(",
")",
";",
"assert",
"0",
"<=",
"cidx",
"&&",
"cidx",
"<",
"nchk",
";",
"Key",
"dkey",
"=",
"chunkKey",
"(",
"cidx",
")",
";"... | Touching the DVec will force the file load. | [
"Touching",
"the",
"DVec",
"will",
"force",
"the",
"file",
"load",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/FileVec.java#L68-L88 | train |
h2oai/h2o-2 | src/main/java/water/api/Frames.java | Frames.summarizeAndEnhanceFrame | private static void summarizeAndEnhanceFrame(FrameSummary summary, Frame frame, boolean find_compatible_models, Map<String, Model> all_models, Map<String, Set<String>> all_models_cols) {
UniqueId unique_id = frame.getUniqueId();
summary.id = unique_id.getId();
summary.key = unique_id.getKey();
summary.c... | java | private static void summarizeAndEnhanceFrame(FrameSummary summary, Frame frame, boolean find_compatible_models, Map<String, Model> all_models, Map<String, Set<String>> all_models_cols) {
UniqueId unique_id = frame.getUniqueId();
summary.id = unique_id.getId();
summary.key = unique_id.getKey();
summary.c... | [
"private",
"static",
"void",
"summarizeAndEnhanceFrame",
"(",
"FrameSummary",
"summary",
",",
"Frame",
"frame",
",",
"boolean",
"find_compatible_models",
",",
"Map",
"<",
"String",
",",
"Model",
">",
"all_models",
",",
"Map",
"<",
"String",
",",
"Set",
"<",
"S... | Summarize fields in water.fvec.Frame. | [
"Summarize",
"fields",
"in",
"water",
".",
"fvec",
".",
"Frame",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Frames.java#L145-L158 | train |
h2oai/h2o-2 | src/main/java/water/api/Frames.java | Frames.serveOneOrAll | private Response serveOneOrAll(Map<String, Frame> framesMap) {
// returns empty sets if !this.find_compatible_models
Pair<Map<String, Model>, Map<String, Set<String>>> models_info = fetchModels();
Map<String, Model> all_models = models_info.getFirst();
Map<String, Set<String>> all_models_cols = models_i... | java | private Response serveOneOrAll(Map<String, Frame> framesMap) {
// returns empty sets if !this.find_compatible_models
Pair<Map<String, Model>, Map<String, Set<String>>> models_info = fetchModels();
Map<String, Model> all_models = models_info.getFirst();
Map<String, Set<String>> all_models_cols = models_i... | [
"private",
"Response",
"serveOneOrAll",
"(",
"Map",
"<",
"String",
",",
"Frame",
">",
"framesMap",
")",
"{",
"// returns empty sets if !this.find_compatible_models",
"Pair",
"<",
"Map",
"<",
"String",
",",
"Model",
">",
",",
"Map",
"<",
"String",
",",
"Set",
"... | For one or more Frame from the KV store, sumamrize and enhance them and Response containing a map of them. | [
"For",
"one",
"or",
"more",
"Frame",
"from",
"the",
"KV",
"store",
"sumamrize",
"and",
"enhance",
"them",
"and",
"Response",
"containing",
"a",
"map",
"of",
"them",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Frames.java#L172-L201 | train |
h2oai/h2o-2 | src/main/java/water/fvec/TransfVec.java | TransfVec.compose | public static Vec compose(TransfVec origVec, int[][] transfMap, String[] domain, boolean keepOrig) {
// Do a mapping from INT -> ENUM -> this vector ENUM
int[][] domMap = Utils.compose(new int[][] {origVec._values, origVec._indexes }, transfMap);
Vec result = origVec.masterVec().makeTransf(domMap[0], domMap... | java | public static Vec compose(TransfVec origVec, int[][] transfMap, String[] domain, boolean keepOrig) {
// Do a mapping from INT -> ENUM -> this vector ENUM
int[][] domMap = Utils.compose(new int[][] {origVec._values, origVec._indexes }, transfMap);
Vec result = origVec.masterVec().makeTransf(domMap[0], domMap... | [
"public",
"static",
"Vec",
"compose",
"(",
"TransfVec",
"origVec",
",",
"int",
"[",
"]",
"[",
"]",
"transfMap",
",",
"String",
"[",
"]",
"domain",
",",
"boolean",
"keepOrig",
")",
"{",
"// Do a mapping from INT -> ENUM -> this vector ENUM",
"int",
"[",
"]",
"[... | Compose given origVector with given transformation. Always returns a new vector.
Original vector is kept if keepOrig is true.
@param origVec
@param transfMap
@param keepOrig
@return a new instance of {@link TransfVec} composing transformation of origVector and tranfsMap | [
"Compose",
"given",
"origVector",
"with",
"given",
"transformation",
".",
"Always",
"returns",
"a",
"new",
"vector",
".",
"Original",
"vector",
"is",
"kept",
"if",
"keepOrig",
"is",
"true",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/TransfVec.java#L127-L133 | train |
h2oai/h2o-2 | src/main/java/water/api/Inspector.java | Inspector.redirect | public static Response redirect(Request req, Key src_key) {
return Response.redirect(req, "/2/Inspector", "src_key", src_key.toString());
} | java | public static Response redirect(Request req, Key src_key) {
return Response.redirect(req, "/2/Inspector", "src_key", src_key.toString());
} | [
"public",
"static",
"Response",
"redirect",
"(",
"Request",
"req",
",",
"Key",
"src_key",
")",
"{",
"return",
"Response",
".",
"redirect",
"(",
"req",
",",
"\"/2/Inspector\"",
",",
"\"src_key\"",
",",
"src_key",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Called from some other page, to redirect that other page to this page. | [
"Called",
"from",
"some",
"other",
"page",
"to",
"redirect",
"that",
"other",
"page",
"to",
"this",
"page",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Inspector.java#L83-L85 | train |
h2oai/h2o-2 | src/main/java/water/fvec/NewChunk.java | NewChunk.addr | public void addr( NewChunk nc ) {
long [] tmpl = _ls; _ls = nc._ls; nc._ls = tmpl;
int [] tmpi = _xs; _xs = nc._xs; nc._xs = tmpi;
tmpi = _id; _id = nc._id; nc._id = tmpi;
double[] tmpd = _ds; _ds = nc._ds; nc._ds = tmpd;
int tmp = _sparseLen; _sparseLen=nc._sparseLen; nc._sparseLe... | java | public void addr( NewChunk nc ) {
long [] tmpl = _ls; _ls = nc._ls; nc._ls = tmpl;
int [] tmpi = _xs; _xs = nc._xs; nc._xs = tmpi;
tmpi = _id; _id = nc._id; nc._id = tmpi;
double[] tmpd = _ds; _ds = nc._ds; nc._ds = tmpd;
int tmp = _sparseLen; _sparseLen=nc._sparseLen; nc._sparseLe... | [
"public",
"void",
"addr",
"(",
"NewChunk",
"nc",
")",
"{",
"long",
"[",
"]",
"tmpl",
"=",
"_ls",
";",
"_ls",
"=",
"nc",
".",
"_ls",
";",
"nc",
".",
"_ls",
"=",
"tmpl",
";",
"int",
"[",
"]",
"tmpi",
"=",
"_xs",
";",
"_xs",
"=",
"nc",
".",
"_... | PREpend all of 'nc' onto the current NewChunk. Kill nc. | [
"PREpend",
"all",
"of",
"nc",
"onto",
"the",
"current",
"NewChunk",
".",
"Kill",
"nc",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/NewChunk.java#L309-L317 | train |
h2oai/h2o-2 | src/main/java/water/fvec/NewChunk.java | NewChunk.append2 | void append2( long l, int x ) {
if(_id == null || l != 0){
if(_ls == null || _sparseLen == _ls.length) {
append2slow();
// again call append2 since calling append2slow might have changed things (eg might have switched to sparse and l could be 0)
append2(l,x);
return;
}
... | java | void append2( long l, int x ) {
if(_id == null || l != 0){
if(_ls == null || _sparseLen == _ls.length) {
append2slow();
// again call append2 since calling append2slow might have changed things (eg might have switched to sparse and l could be 0)
append2(l,x);
return;
}
... | [
"void",
"append2",
"(",
"long",
"l",
",",
"int",
"x",
")",
"{",
"if",
"(",
"_id",
"==",
"null",
"||",
"l",
"!=",
"0",
")",
"{",
"if",
"(",
"_ls",
"==",
"null",
"||",
"_sparseLen",
"==",
"_ls",
".",
"length",
")",
"{",
"append2slow",
"(",
")",
... | Fast-path append long data | [
"Fast",
"-",
"path",
"append",
"long",
"data"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/NewChunk.java#L320-L335 | train |
h2oai/h2o-2 | src/main/java/water/UKV.java | UKV.put | static public void put( Key key, Value val, Futures fs ) {
assert !val.isLockable();
Value res = DKV.put(key,val,fs);
assert res == null || !res.isLockable();
} | java | static public void put( Key key, Value val, Futures fs ) {
assert !val.isLockable();
Value res = DKV.put(key,val,fs);
assert res == null || !res.isLockable();
} | [
"static",
"public",
"void",
"put",
"(",
"Key",
"key",
",",
"Value",
"val",
",",
"Futures",
"fs",
")",
"{",
"assert",
"!",
"val",
".",
"isLockable",
"(",
")",
";",
"Value",
"res",
"=",
"DKV",
".",
"put",
"(",
"key",
",",
"val",
",",
"fs",
")",
"... | have to use the Lockable interface for all updates. | [
"have",
"to",
"use",
"the",
"Lockable",
"interface",
"for",
"all",
"updates",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/UKV.java#L26-L30 | train |
h2oai/h2o-2 | src/main/java/water/UKV.java | UKV.put | static public void put( Key key, Freezable fr ) {
if( fr == null ) UKV.remove(key);
else UKV.put(key,new Value(key, fr));
} | java | static public void put( Key key, Freezable fr ) {
if( fr == null ) UKV.remove(key);
else UKV.put(key,new Value(key, fr));
} | [
"static",
"public",
"void",
"put",
"(",
"Key",
"key",
",",
"Freezable",
"fr",
")",
"{",
"if",
"(",
"fr",
"==",
"null",
")",
"UKV",
".",
"remove",
"(",
"key",
")",
";",
"else",
"UKV",
".",
"put",
"(",
"key",
",",
"new",
"Value",
"(",
"key",
",",... | Also, allow auto-serialization | [
"Also",
"allow",
"auto",
"-",
"serialization"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/UKV.java#L54-L57 | train |
h2oai/h2o-2 | src/main/java/water/H2ONode.java | H2ONode.remove_task_tracking | void remove_task_tracking( int task ) {
RPC.RPCCall rpc = _work.get(task);
if( rpc == null ) return; // Already stopped tracking
// Atomically attempt to remove the 'dt'. If we win, we are the sole
// thread running the dt.onAckAck. Also helps GC: the 'dt' is done (sent
// to client and we rece... | java | void remove_task_tracking( int task ) {
RPC.RPCCall rpc = _work.get(task);
if( rpc == null ) return; // Already stopped tracking
// Atomically attempt to remove the 'dt'. If we win, we are the sole
// thread running the dt.onAckAck. Also helps GC: the 'dt' is done (sent
// to client and we rece... | [
"void",
"remove_task_tracking",
"(",
"int",
"task",
")",
"{",
"RPC",
".",
"RPCCall",
"rpc",
"=",
"_work",
".",
"get",
"(",
"task",
")",
";",
"if",
"(",
"rpc",
"==",
"null",
")",
"return",
";",
"// Already stopped tracking",
"// Atomically attempt to remove the... | Stop tracking a remote task, because we got an ACKACK. | [
"Stop",
"tracking",
"a",
"remote",
"task",
"because",
"we",
"got",
"an",
"ACKACK",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/H2ONode.java#L315-L338 | train |
h2oai/h2o-2 | src/main/java/water/util/FrameUtils.java | FrameUtils.frame | public static Frame frame(String[] names, double[]... rows) {
assert names == null || names.length == rows[0].length;
Futures fs = new Futures();
Vec[] vecs = new Vec[rows[0].length];
Key keys[] = Vec.VectorGroup.VG_LEN1.addVecs(vecs.length);
for( int c = 0; c < vecs.length; c++ ) {
Appendable... | java | public static Frame frame(String[] names, double[]... rows) {
assert names == null || names.length == rows[0].length;
Futures fs = new Futures();
Vec[] vecs = new Vec[rows[0].length];
Key keys[] = Vec.VectorGroup.VG_LEN1.addVecs(vecs.length);
for( int c = 0; c < vecs.length; c++ ) {
Appendable... | [
"public",
"static",
"Frame",
"frame",
"(",
"String",
"[",
"]",
"names",
",",
"double",
"[",
"]",
"...",
"rows",
")",
"{",
"assert",
"names",
"==",
"null",
"||",
"names",
".",
"length",
"==",
"rows",
"[",
"0",
"]",
".",
"length",
";",
"Futures",
"fs... | Create a new frame based on given row data.
@param names names of frame columns
@param rows data given in the form of rows
@return new frame which contains columns named according given names and including given data | [
"Create",
"a",
"new",
"frame",
"based",
"on",
"given",
"row",
"data",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/util/FrameUtils.java#L31-L46 | train |
h2oai/h2o-2 | src/main/java/water/util/FrameUtils.java | FrameUtils.parseFrame | public static Frame parseFrame(Key okey, File ...files) {
assert files.length > 0 : "Ups. No files to parse!";
for (File f : files)
if (!f.exists())
throw new RuntimeException("File not found " + f);
// Create output key if not specified
if(okey == null)
okey = Key.make(files[0].getN... | java | public static Frame parseFrame(Key okey, File ...files) {
assert files.length > 0 : "Ups. No files to parse!";
for (File f : files)
if (!f.exists())
throw new RuntimeException("File not found " + f);
// Create output key if not specified
if(okey == null)
okey = Key.make(files[0].getN... | [
"public",
"static",
"Frame",
"parseFrame",
"(",
"Key",
"okey",
",",
"File",
"...",
"files",
")",
"{",
"assert",
"files",
".",
"length",
">",
"0",
":",
"\"Ups. No files to parse!\"",
";",
"for",
"(",
"File",
"f",
":",
"files",
")",
"if",
"(",
"!",
"f",
... | Parse given file into the form of frame represented by the given key.
@param okey destination key for parsed frame
@param files files to parse
@return a new frame | [
"Parse",
"given",
"file",
"into",
"the",
"form",
"of",
"frame",
"represented",
"by",
"the",
"given",
"key",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/util/FrameUtils.java#L54-L67 | train |
h2oai/h2o-2 | src/main/java/water/ga/GoogleAnalytics.java | GoogleAnalytics.processCustomDimensionParameters | private void processCustomDimensionParameters(@SuppressWarnings("rawtypes") GoogleAnalyticsRequest request, List<NameValuePair> postParms) {
Map<String, String> customDimParms = new HashMap<String, String>();
for (String defaultCustomDimKey : defaultRequest.customDimentions().keySet()) {
customDimParms.pu... | java | private void processCustomDimensionParameters(@SuppressWarnings("rawtypes") GoogleAnalyticsRequest request, List<NameValuePair> postParms) {
Map<String, String> customDimParms = new HashMap<String, String>();
for (String defaultCustomDimKey : defaultRequest.customDimentions().keySet()) {
customDimParms.pu... | [
"private",
"void",
"processCustomDimensionParameters",
"(",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"GoogleAnalyticsRequest",
"request",
",",
"List",
"<",
"NameValuePair",
">",
"postParms",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"customDimPar... | Processes the custom dimensions and adds the values to list of parameters, which would be posted to GA.
@param request
@param postParms | [
"Processes",
"the",
"custom",
"dimensions",
"and",
"adds",
"the",
"values",
"to",
"list",
"of",
"parameters",
"which",
"would",
"be",
"posted",
"to",
"GA",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/ga/GoogleAnalytics.java#L217-L232 | train |
h2oai/h2o-2 | src/main/java/water/ga/GoogleAnalytics.java | GoogleAnalytics.processCustomMetricParameters | private void processCustomMetricParameters(@SuppressWarnings("rawtypes") GoogleAnalyticsRequest request, List<NameValuePair> postParms) {
Map<String, String> customMetricParms = new HashMap<String, String>();
for (String defaultCustomMetricKey : defaultRequest.custommMetrics().keySet()) {
customMetricParm... | java | private void processCustomMetricParameters(@SuppressWarnings("rawtypes") GoogleAnalyticsRequest request, List<NameValuePair> postParms) {
Map<String, String> customMetricParms = new HashMap<String, String>();
for (String defaultCustomMetricKey : defaultRequest.custommMetrics().keySet()) {
customMetricParm... | [
"private",
"void",
"processCustomMetricParameters",
"(",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"GoogleAnalyticsRequest",
"request",
",",
"List",
"<",
"NameValuePair",
">",
"postParms",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"customMetricPar... | Processes the custom metrics and adds the values to list of parameters, which would be posted to GA.
@param request
@param postParms | [
"Processes",
"the",
"custom",
"metrics",
"and",
"adds",
"the",
"values",
"to",
"list",
"of",
"parameters",
"which",
"would",
"be",
"posted",
"to",
"GA",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/ga/GoogleAnalytics.java#L240-L255 | train |
h2oai/h2o-2 | src/main/java/water/fvec/CBSChunk.java | CBSChunk.clen | public static int clen(int values, int bpv) {
int len = (values*bpv) >> 3;
return values*bpv % 8 == 0 ? len : len + 1;
} | java | public static int clen(int values, int bpv) {
int len = (values*bpv) >> 3;
return values*bpv % 8 == 0 ? len : len + 1;
} | [
"public",
"static",
"int",
"clen",
"(",
"int",
"values",
",",
"int",
"bpv",
")",
"{",
"int",
"len",
"=",
"(",
"values",
"*",
"bpv",
")",
">>",
"3",
";",
"return",
"values",
"*",
"bpv",
"%",
"8",
"==",
"0",
"?",
"len",
":",
"len",
"+",
"1",
";... | Returns compressed len of the given array length if the value if represented by bpv-bits. | [
"Returns",
"compressed",
"len",
"of",
"the",
"given",
"array",
"length",
"if",
"the",
"value",
"if",
"represented",
"by",
"bpv",
"-",
"bits",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/CBSChunk.java#L84-L87 | train |
h2oai/h2o-2 | src/main/java/water/TaskGetKey.java | TaskGetKey.get | public static Value get( H2ONode target, Key key, int priority ) {
RPC<TaskGetKey> rpc, old;
while( true ) { // Repeat until we get a unique TGK installed per key
// Do we have an old TaskGetKey in-progress?
rpc = TGKS.get(key);
if( rpc != null && rpc._dt._priority >= priority )
... | java | public static Value get( H2ONode target, Key key, int priority ) {
RPC<TaskGetKey> rpc, old;
while( true ) { // Repeat until we get a unique TGK installed per key
// Do we have an old TaskGetKey in-progress?
rpc = TGKS.get(key);
if( rpc != null && rpc._dt._priority >= priority )
... | [
"public",
"static",
"Value",
"get",
"(",
"H2ONode",
"target",
",",
"Key",
"key",
",",
"int",
"priority",
")",
"{",
"RPC",
"<",
"TaskGetKey",
">",
"rpc",
",",
"old",
";",
"while",
"(",
"true",
")",
"{",
"// Repeat until we get a unique TGK installed per key",
... | Get a value from a named remote node | [
"Get",
"a",
"value",
"from",
"a",
"named",
"remote",
"node"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/TaskGetKey.java#L26-L44 | train |
h2oai/h2o-2 | src/main/java/water/api/RequestBuilders.java | RequestBuilders.build | protected String build(Response response) {
StringBuilder sb = new StringBuilder();
sb.append("<div class='container'>");
sb.append("<div class='row-fluid'>");
sb.append("<div class='span12'>");
sb.append(buildJSONResponseBox(response));
if( response._status == Response.Status.done ) response.to... | java | protected String build(Response response) {
StringBuilder sb = new StringBuilder();
sb.append("<div class='container'>");
sb.append("<div class='row-fluid'>");
sb.append("<div class='span12'>");
sb.append(buildJSONResponseBox(response));
if( response._status == Response.Status.done ) response.to... | [
"protected",
"String",
"build",
"(",
"Response",
"response",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"<div class='container'>\"",
")",
";",
"sb",
".",
"append",
"(",
"\"<div class='row-fluid'>\"",
... | Builds the HTML for the given response.
This is the root of the HTML. Should display all what is needed, including
the status, timing, etc. Then call the recursive builders for the
response's JSON. | [
"Builds",
"the",
"HTML",
"for",
"the",
"given",
"response",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/RequestBuilders.java#L60-L85 | train |
h2oai/h2o-2 | src/main/java/water/Boot.java | Boot.addExternalJars | public void addExternalJars(File file) throws IllegalAccessException, InvocationTargetException, MalformedURLException {
assert file.exists() : "Unable to find external file: " + file.getAbsolutePath();
if( file.isDirectory() ) {
for( File f : file.listFiles() ) addExternalJars(f);
} else if( file.get... | java | public void addExternalJars(File file) throws IllegalAccessException, InvocationTargetException, MalformedURLException {
assert file.exists() : "Unable to find external file: " + file.getAbsolutePath();
if( file.isDirectory() ) {
for( File f : file.listFiles() ) addExternalJars(f);
} else if( file.get... | [
"public",
"void",
"addExternalJars",
"(",
"File",
"file",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
",",
"MalformedURLException",
"{",
"assert",
"file",
".",
"exists",
"(",
")",
":",
"\"Unable to find external file: \"",
"+",
"file",
"... | Adds all jars in given directory to the classpath. | [
"Adds",
"all",
"jars",
"in",
"given",
"directory",
"to",
"the",
"classpath",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Boot.java#L343-L352 | train |
h2oai/h2o-2 | src/main/java/water/Boot.java | Boot.extractInternalFiles | private void extractInternalFiles() throws IOException {
Enumeration entries = _h2oJar.entries();
while( entries.hasMoreElements() ) {
ZipEntry e = (ZipEntry) entries.nextElement();
String name = e.getName();
if( e.isDirectory() ) continue; // mkdirs() will handle these
if(! name.endsWit... | java | private void extractInternalFiles() throws IOException {
Enumeration entries = _h2oJar.entries();
while( entries.hasMoreElements() ) {
ZipEntry e = (ZipEntry) entries.nextElement();
String name = e.getName();
if( e.isDirectory() ) continue; // mkdirs() will handle these
if(! name.endsWit... | [
"private",
"void",
"extractInternalFiles",
"(",
")",
"throws",
"IOException",
"{",
"Enumeration",
"entries",
"=",
"_h2oJar",
".",
"entries",
"(",
")",
";",
"while",
"(",
"entries",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"ZipEntry",
"e",
"=",
"(",
"Zip... | Extracts the libraries from the jar file to given local path. | [
"Extracts",
"the",
"libraries",
"from",
"the",
"jar",
"file",
"to",
"given",
"local",
"path",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Boot.java#L355-L384 | train |
h2oai/h2o-2 | src/main/java/water/Boot.java | Boot.loadClass | @Override public synchronized Class loadClass( String name, boolean resolve ) throws ClassNotFoundException {
assert !name.equals(Weaver.class.getName());
Class z = loadClass2(name); // Do all the work in here
if( resolve ) resolveClass(z); // Resolve here instead in the work method
return z;
} | java | @Override public synchronized Class loadClass( String name, boolean resolve ) throws ClassNotFoundException {
assert !name.equals(Weaver.class.getName());
Class z = loadClass2(name); // Do all the work in here
if( resolve ) resolveClass(z); // Resolve here instead in the work method
return z;
} | [
"@",
"Override",
"public",
"synchronized",
"Class",
"loadClass",
"(",
"String",
"name",
",",
"boolean",
"resolve",
")",
"throws",
"ClassNotFoundException",
"{",
"assert",
"!",
"name",
".",
"equals",
"(",
"Weaver",
".",
"class",
".",
"getName",
"(",
")",
")",... | search, THEN the System or parent loader. | [
"search",
"THEN",
"the",
"System",
"or",
"parent",
"loader",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Boot.java#L424-L429 | train |
h2oai/h2o-2 | src/main/java/water/Boot.java | Boot.loadClass2 | private final Class loadClass2( String name ) throws ClassNotFoundException {
Class z = findLoadedClass(name); // Look for pre-existing class
if( z != null ) return z;
if( _weaver == null ) _weaver = new Weaver();
z = _weaver.weaveAndLoad(name, this); // Try the Happy Class Loader
if( z != null )... | java | private final Class loadClass2( String name ) throws ClassNotFoundException {
Class z = findLoadedClass(name); // Look for pre-existing class
if( z != null ) return z;
if( _weaver == null ) _weaver = new Weaver();
z = _weaver.weaveAndLoad(name, this); // Try the Happy Class Loader
if( z != null )... | [
"private",
"final",
"Class",
"loadClass2",
"(",
"String",
"name",
")",
"throws",
"ClassNotFoundException",
"{",
"Class",
"z",
"=",
"findLoadedClass",
"(",
"name",
")",
";",
"// Look for pre-existing class",
"if",
"(",
"z",
"!=",
"null",
")",
"return",
"z",
";"... | Run the class lookups in my favorite non-default order. | [
"Run",
"the",
"class",
"lookups",
"in",
"my",
"favorite",
"non",
"-",
"default",
"order",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Boot.java#L432-L446 | train |
h2oai/h2o-2 | src/main/java/water/api/DocGen.java | FieldDoc.arg | private RequestArguments.Argument arg(Request R) {
if( _arg != null ) return _arg;
Class clzz = R.getClass();
// An amazing crazy API from the JDK again. Cannot search for protected
// fields without either (1) throwing NoSuchFieldException if you ask in
// a subclass, or (2) sorting thro... | java | private RequestArguments.Argument arg(Request R) {
if( _arg != null ) return _arg;
Class clzz = R.getClass();
// An amazing crazy API from the JDK again. Cannot search for protected
// fields without either (1) throwing NoSuchFieldException if you ask in
// a subclass, or (2) sorting thro... | [
"private",
"RequestArguments",
".",
"Argument",
"arg",
"(",
"Request",
"R",
")",
"{",
"if",
"(",
"_arg",
"!=",
"null",
")",
"return",
"_arg",
";",
"Class",
"clzz",
"=",
"R",
".",
"getClass",
"(",
")",
";",
"// An amazing crazy API from the JDK again. Cannot s... | Specific accessors for input arguments. Not valid for JSON output fields. | [
"Specific",
"accessors",
"for",
"input",
"arguments",
".",
"Not",
"valid",
"for",
"JSON",
"output",
"fields",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/DocGen.java#L104-L123 | train |
h2oai/h2o-2 | h2o-samples/src/main/java/samples/launchers/CloudRemote.java | CloudRemote.launchEC2 | public static void launchEC2(Class<? extends Job> job, int boxes) throws Exception {
EC2 ec2 = new EC2();
ec2.boxes = boxes;
Cloud c = ec2.resize();
launch(c, job);
} | java | public static void launchEC2(Class<? extends Job> job, int boxes) throws Exception {
EC2 ec2 = new EC2();
ec2.boxes = boxes;
Cloud c = ec2.resize();
launch(c, job);
} | [
"public",
"static",
"void",
"launchEC2",
"(",
"Class",
"<",
"?",
"extends",
"Job",
">",
"job",
",",
"int",
"boxes",
")",
"throws",
"Exception",
"{",
"EC2",
"ec2",
"=",
"new",
"EC2",
"(",
")",
";",
"ec2",
".",
"boxes",
"=",
"boxes",
";",
"Cloud",
"c... | Starts EC2 machines and builds a cluster. | [
"Starts",
"EC2",
"machines",
"and",
"builds",
"a",
"cluster",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/h2o-samples/src/main/java/samples/launchers/CloudRemote.java#L25-L30 | train |
h2oai/h2o-2 | src/main/java/hex/singlenoderf/Tree.java | Tree.compute2 | @Override public void compute2() {
if(Job.isRunning(_jobKey)) {
Timer timer = new Timer();
_stats[0] = new ThreadLocal<hex.singlenoderf.Statistic>();
_stats[1] = new ThreadLocal<hex.singlenoderf.Statistic>();
Data d = _sampler.sample(_data, _seed, _modelKey, _local_mode);
... | java | @Override public void compute2() {
if(Job.isRunning(_jobKey)) {
Timer timer = new Timer();
_stats[0] = new ThreadLocal<hex.singlenoderf.Statistic>();
_stats[1] = new ThreadLocal<hex.singlenoderf.Statistic>();
Data d = _sampler.sample(_data, _seed, _modelKey, _local_mode);
... | [
"@",
"Override",
"public",
"void",
"compute2",
"(",
")",
"{",
"if",
"(",
"Job",
".",
"isRunning",
"(",
"_jobKey",
")",
")",
"{",
"Timer",
"timer",
"=",
"new",
"Timer",
"(",
")",
";",
"_stats",
"[",
"0",
"]",
"=",
"new",
"ThreadLocal",
"<",
"hex",
... | Actually build the tree | [
"Actually",
"build",
"the",
"tree"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/singlenoderf/Tree.java#L139-L181 | train |
h2oai/h2o-2 | src/main/java/hex/singlenoderf/Tree.java | Tree.appendKey | static void appendKey(Key model, final Key tKey, final Key dtKey, final String tString, final int tree_id) {
final int selfIdx = H2O.SELF.index();
new TAtomic<SpeeDRFModel>() {
@Override public SpeeDRFModel atomic(SpeeDRFModel old) {
if(old == null) return null;
return SpeeDRFModel.make(ol... | java | static void appendKey(Key model, final Key tKey, final Key dtKey, final String tString, final int tree_id) {
final int selfIdx = H2O.SELF.index();
new TAtomic<SpeeDRFModel>() {
@Override public SpeeDRFModel atomic(SpeeDRFModel old) {
if(old == null) return null;
return SpeeDRFModel.make(ol... | [
"static",
"void",
"appendKey",
"(",
"Key",
"model",
",",
"final",
"Key",
"tKey",
",",
"final",
"Key",
"dtKey",
",",
"final",
"String",
"tString",
",",
"final",
"int",
"tree_id",
")",
"{",
"final",
"int",
"selfIdx",
"=",
"H2O",
".",
"SELF",
".",
"index"... | which serializes "for free". | [
"which",
"serializes",
"for",
"free",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/singlenoderf/Tree.java#L185-L193 | train |
h2oai/h2o-2 | src/main/java/hex/singlenoderf/Tree.java | Tree.toKey | public Key toKey() {
AutoBuffer bs = new AutoBuffer();
bs.put4(_data_id);
bs.put8(_seed);
bs.put1(_producerId);
_tree.write(bs);
Key key = Key.make((byte)1,Key.DFJ_INTERNAL_USER, H2O.SELF);
DKV.put(key,new Value(key, bs.buf()));
return key;
} | java | public Key toKey() {
AutoBuffer bs = new AutoBuffer();
bs.put4(_data_id);
bs.put8(_seed);
bs.put1(_producerId);
_tree.write(bs);
Key key = Key.make((byte)1,Key.DFJ_INTERNAL_USER, H2O.SELF);
DKV.put(key,new Value(key, bs.buf()));
return key;
} | [
"public",
"Key",
"toKey",
"(",
")",
"{",
"AutoBuffer",
"bs",
"=",
"new",
"AutoBuffer",
"(",
")",
";",
"bs",
".",
"put4",
"(",
"_data_id",
")",
";",
"bs",
".",
"put8",
"(",
"_seed",
")",
";",
"bs",
".",
"put1",
"(",
"_producerId",
")",
";",
"_tree... | Write the Tree to a random Key homed here. | [
"Write",
"the",
"Tree",
"to",
"a",
"random",
"Key",
"homed",
"here",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/singlenoderf/Tree.java#L609-L618 | train |
h2oai/h2o-2 | src/main/java/hex/singlenoderf/Tree.java | Tree.classify | public static double classify( AutoBuffer ts, double[] ds, double badat, boolean regression ) {
ts.get4(); // Skip tree-id
ts.get8(); // Skip seed
ts.get1(); // Skip producer id
byte b;
while( (b = (byte) ts.get1()) != '[' ) { // While not a leaf indicator
assert b == '(' || b == 'S'... | java | public static double classify( AutoBuffer ts, double[] ds, double badat, boolean regression ) {
ts.get4(); // Skip tree-id
ts.get8(); // Skip seed
ts.get1(); // Skip producer id
byte b;
while( (b = (byte) ts.get1()) != '[' ) { // While not a leaf indicator
assert b == '(' || b == 'S'... | [
"public",
"static",
"double",
"classify",
"(",
"AutoBuffer",
"ts",
",",
"double",
"[",
"]",
"ds",
",",
"double",
"badat",
",",
"boolean",
"regression",
")",
"{",
"ts",
".",
"get4",
"(",
")",
";",
"// Skip tree-id",
"ts",
".",
"get8",
"(",
")",
";",
"... | Classify on the compressed tree bytes, from the pre-packed double data | [
"Classify",
"on",
"the",
"compressed",
"tree",
"bytes",
"from",
"the",
"pre",
"-",
"packed",
"double",
"data"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/singlenoderf/Tree.java#L660-L683 | train |
h2oai/h2o-2 | src/main/java/hex/singlenoderf/Tree.java | Tree.compress | public TreeModel.CompressedTree compress() {
// Log.info(Sys.RANDF, _tree.toString(new StringBuilder(), Integer.MAX_VALUE).toString());
int size = _tree.dtreeSize();
if (_tree instanceof LeafNode) {
size += 3;
}
AutoBuffer ab = new AutoBuffer(size);
if( _tree instanceof LeafNode)
ab.p... | java | public TreeModel.CompressedTree compress() {
// Log.info(Sys.RANDF, _tree.toString(new StringBuilder(), Integer.MAX_VALUE).toString());
int size = _tree.dtreeSize();
if (_tree instanceof LeafNode) {
size += 3;
}
AutoBuffer ab = new AutoBuffer(size);
if( _tree instanceof LeafNode)
ab.p... | [
"public",
"TreeModel",
".",
"CompressedTree",
"compress",
"(",
")",
"{",
"// Log.info(Sys.RANDF, _tree.toString(new StringBuilder(), Integer.MAX_VALUE).toString());",
"int",
"size",
"=",
"_tree",
".",
"dtreeSize",
"(",
")",
";",
"if",
"(",
"_tree",
"instanceof",
"LeafN... | Build a compressed-tree struct | [
"Build",
"a",
"compressed",
"-",
"tree",
"struct"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/singlenoderf/Tree.java#L738-L751 | train |
h2oai/h2o-2 | src/main/java/water/api/FrameSplitPage.java | FrameSplitPage.execImpl | @Override protected void execImpl() {
Frame frame = source;
if (shuffle) {
// FIXME: switch to global shuffle
frame = MRUtils.shuffleFramePerChunk(Utils.generateShuffledKey(frame._key), frame, seed);
frame.delete_and_lock(null).unlock(null); // save frame to DKV
// delete frame on the en... | java | @Override protected void execImpl() {
Frame frame = source;
if (shuffle) {
// FIXME: switch to global shuffle
frame = MRUtils.shuffleFramePerChunk(Utils.generateShuffledKey(frame._key), frame, seed);
frame.delete_and_lock(null).unlock(null); // save frame to DKV
// delete frame on the en... | [
"@",
"Override",
"protected",
"void",
"execImpl",
"(",
")",
"{",
"Frame",
"frame",
"=",
"source",
";",
"if",
"(",
"shuffle",
")",
"{",
"// FIXME: switch to global shuffle",
"frame",
"=",
"MRUtils",
".",
"shuffleFramePerChunk",
"(",
"Utils",
".",
"generateShuffle... | Run the function | [
"Run",
"the",
"function"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/FrameSplitPage.java#L65-L91 | train |
h2oai/h2o-2 | src/main/java/water/util/UIUtils.java | UIUtils.qlink | public static <T> String qlink(Class<T> page, Key k, String content) {
return qlink(page, "source", k, content );
} | java | public static <T> String qlink(Class<T> page, Key k, String content) {
return qlink(page, "source", k, content );
} | [
"public",
"static",
"<",
"T",
">",
"String",
"qlink",
"(",
"Class",
"<",
"T",
">",
"page",
",",
"Key",
"k",
",",
"String",
"content",
")",
"{",
"return",
"qlink",
"(",
"page",
",",
"\"source\"",
",",
"k",
",",
"content",
")",
";",
"}"
] | Return the query link to this page | [
"Return",
"the",
"query",
"link",
"to",
"this",
"page"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/util/UIUtils.java#L10-L12 | train |
h2oai/h2o-2 | src/main/java/water/MemoryManager.java | MemoryManager.malloc | public static Object malloc(int elems, long bytes, int type, Object orig, int from ) {
return malloc(elems,bytes,type,orig,from,false);
} | java | public static Object malloc(int elems, long bytes, int type, Object orig, int from ) {
return malloc(elems,bytes,type,orig,from,false);
} | [
"public",
"static",
"Object",
"malloc",
"(",
"int",
"elems",
",",
"long",
"bytes",
",",
"int",
"type",
",",
"Object",
"orig",
",",
"int",
"from",
")",
"{",
"return",
"malloc",
"(",
"elems",
",",
"bytes",
",",
"type",
",",
"orig",
",",
"from",
",",
... | Catches OutOfMemory, clears cache & retries. | [
"Catches",
"OutOfMemory",
"clears",
"cache",
"&",
"retries",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/MemoryManager.java#L222-L224 | train |
h2oai/h2o-2 | src/main/java/water/MemoryManager.java | MemoryManager.tryReserveTaskMem | public static boolean tryReserveTaskMem(long m){
if(!CAN_ALLOC)return false;
if( m == 0 ) return true;
assert m >= 0:"m < 0: " + m;
long current = _taskMem.addAndGet(-m);
if(current < 0){
_taskMem.addAndGet(m);
return false;
}
return true;
} | java | public static boolean tryReserveTaskMem(long m){
if(!CAN_ALLOC)return false;
if( m == 0 ) return true;
assert m >= 0:"m < 0: " + m;
long current = _taskMem.addAndGet(-m);
if(current < 0){
_taskMem.addAndGet(m);
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"tryReserveTaskMem",
"(",
"long",
"m",
")",
"{",
"if",
"(",
"!",
"CAN_ALLOC",
")",
"return",
"false",
";",
"if",
"(",
"m",
"==",
"0",
")",
"return",
"true",
";",
"assert",
"m",
">=",
"0",
":",
"\"m < 0: \"",
"+",
"m",
... | Try to reserve memory needed for task execution and return true if
succeeded. Tasks have a shared pool of memory which they should ask for
in advance before they even try to allocate it.
This method is another backpressure mechanism to make sure we do not
exhaust system's resources by running too many tasks at the sa... | [
"Try",
"to",
"reserve",
"memory",
"needed",
"for",
"task",
"execution",
"and",
"return",
"true",
"if",
"succeeded",
".",
"Tasks",
"have",
"a",
"shared",
"pool",
"of",
"memory",
"which",
"they",
"should",
"ask",
"for",
"in",
"advance",
"before",
"they",
"ev... | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/MemoryManager.java#L310-L320 | train |
h2oai/h2o-2 | src/main/java/water/parser/CsvParser.java | CsvParser.determineSeparatorCounts | private static int[] determineSeparatorCounts(String from, int single_quote) {
int[] result = new int[separators.length];
byte[] bits = from.getBytes();
boolean in_quote = false;
for( int j=0; j< bits.length; j++ ) {
byte c = bits[j];
if( (c == single_quote) || (c == CHAR_DOUBLE_QUOTE) )
... | java | private static int[] determineSeparatorCounts(String from, int single_quote) {
int[] result = new int[separators.length];
byte[] bits = from.getBytes();
boolean in_quote = false;
for( int j=0; j< bits.length; j++ ) {
byte c = bits[j];
if( (c == single_quote) || (c == CHAR_DOUBLE_QUOTE) )
... | [
"private",
"static",
"int",
"[",
"]",
"determineSeparatorCounts",
"(",
"String",
"from",
",",
"int",
"single_quote",
")",
"{",
"int",
"[",
"]",
"result",
"=",
"new",
"int",
"[",
"separators",
".",
"length",
"]",
";",
"byte",
"[",
"]",
"bits",
"=",
"fro... | Dermines the number of separators in given line. Correctly handles quoted
tokens. | [
"Dermines",
"the",
"number",
"of",
"separators",
"in",
"given",
"line",
".",
"Correctly",
"handles",
"quoted",
"tokens",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/parser/CsvParser.java#L512-L526 | train |
h2oai/h2o-2 | src/main/java/water/parser/CsvParser.java | CsvParser.determineTokens | private static String[] determineTokens(String from, byte separator, int single_quote) {
ArrayList<String> tokens = new ArrayList();
byte[] bits = from.getBytes();
int offset = 0;
int quotes = 0;
while (offset < bits.length) {
while ((offset < bits.length) && (bits[offset] == CHAR_SPACE)) ++of... | java | private static String[] determineTokens(String from, byte separator, int single_quote) {
ArrayList<String> tokens = new ArrayList();
byte[] bits = from.getBytes();
int offset = 0;
int quotes = 0;
while (offset < bits.length) {
while ((offset < bits.length) && (bits[offset] == CHAR_SPACE)) ++of... | [
"private",
"static",
"String",
"[",
"]",
"determineTokens",
"(",
"String",
"from",
",",
"byte",
"separator",
",",
"int",
"single_quote",
")",
"{",
"ArrayList",
"<",
"String",
">",
"tokens",
"=",
"new",
"ArrayList",
"(",
")",
";",
"byte",
"[",
"]",
"bits"... | Determines the tokens that are inside a line and returns them as strings
in an array. Assumes the given separator. | [
"Determines",
"the",
"tokens",
"that",
"are",
"inside",
"a",
"line",
"and",
"returns",
"them",
"as",
"strings",
"in",
"an",
"array",
".",
"Assumes",
"the",
"given",
"separator",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/parser/CsvParser.java#L531-L576 | train |
h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeAndEnhanceModel | protected static void summarizeAndEnhanceModel(ModelSummary summary, Model model, boolean find_compatible_frames, Map<String, Frame> all_frames, Map<String, Set<String>> all_frames_cols) {
if (model instanceof GLMModel) {
summarizeGLMModel(summary, (GLMModel) model);
} else if (model instanceof DRF.DRFMod... | java | protected static void summarizeAndEnhanceModel(ModelSummary summary, Model model, boolean find_compatible_frames, Map<String, Frame> all_frames, Map<String, Set<String>> all_frames_cols) {
if (model instanceof GLMModel) {
summarizeGLMModel(summary, (GLMModel) model);
} else if (model instanceof DRF.DRFMod... | [
"protected",
"static",
"void",
"summarizeAndEnhanceModel",
"(",
"ModelSummary",
"summary",
",",
"Model",
"model",
",",
"boolean",
"find_compatible_frames",
",",
"Map",
"<",
"String",
",",
"Frame",
">",
"all_frames",
",",
"Map",
"<",
"String",
",",
"Set",
"<",
... | Summarize subclasses of water.Model. | [
"Summarize",
"subclasses",
"of",
"water",
".",
"Model",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L168-L190 | train |
h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeModelCommonFields | private static void summarizeModelCommonFields(ModelSummary summary, Model model) {
String[] names = model._names;
summary.warnings = model.warnings;
summary.model_algorithm = model.getClass().toString(); // fallback only
// model.job() is a local copy; on multinode clusters we need to get from the D... | java | private static void summarizeModelCommonFields(ModelSummary summary, Model model) {
String[] names = model._names;
summary.warnings = model.warnings;
summary.model_algorithm = model.getClass().toString(); // fallback only
// model.job() is a local copy; on multinode clusters we need to get from the D... | [
"private",
"static",
"void",
"summarizeModelCommonFields",
"(",
"ModelSummary",
"summary",
",",
"Model",
"model",
")",
"{",
"String",
"[",
"]",
"names",
"=",
"model",
".",
"_names",
";",
"summary",
".",
"warnings",
"=",
"model",
".",
"warnings",
";",
"summar... | Summarize fields which are generic to water.Model. | [
"Summarize",
"fields",
"which",
"are",
"generic",
"to",
"water",
".",
"Model",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L196-L231 | train |
h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeGLMModel | private static void summarizeGLMModel(ModelSummary summary, hex.glm.GLMModel model) {
// add generic fields such as column names
summarizeModelCommonFields(summary, model);
summary.model_algorithm = "GLM";
JsonObject all_params = (model.get_params()).toJSON();
summary.critical_parameters = whiteli... | java | private static void summarizeGLMModel(ModelSummary summary, hex.glm.GLMModel model) {
// add generic fields such as column names
summarizeModelCommonFields(summary, model);
summary.model_algorithm = "GLM";
JsonObject all_params = (model.get_params()).toJSON();
summary.critical_parameters = whiteli... | [
"private",
"static",
"void",
"summarizeGLMModel",
"(",
"ModelSummary",
"summary",
",",
"hex",
".",
"glm",
".",
"GLMModel",
"model",
")",
"{",
"// add generic fields such as column names",
"summarizeModelCommonFields",
"(",
"summary",
",",
"model",
")",
";",
"summary",... | Summarize fields which are specific to hex.glm.GLMModel. | [
"Summarize",
"fields",
"which",
"are",
"specific",
"to",
"hex",
".",
"glm",
".",
"GLMModel",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L244-L254 | train |
h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeDRFModel | private static void summarizeDRFModel(ModelSummary summary, hex.drf.DRF.DRFModel model) {
// add generic fields such as column names
summarizeModelCommonFields(summary, model);
summary.model_algorithm = "BigData RF";
JsonObject all_params = (model.get_params()).toJSON();
summary.critical_parameter... | java | private static void summarizeDRFModel(ModelSummary summary, hex.drf.DRF.DRFModel model) {
// add generic fields such as column names
summarizeModelCommonFields(summary, model);
summary.model_algorithm = "BigData RF";
JsonObject all_params = (model.get_params()).toJSON();
summary.critical_parameter... | [
"private",
"static",
"void",
"summarizeDRFModel",
"(",
"ModelSummary",
"summary",
",",
"hex",
".",
"drf",
".",
"DRF",
".",
"DRFModel",
"model",
")",
"{",
"// add generic fields such as column names",
"summarizeModelCommonFields",
"(",
"summary",
",",
"model",
")",
"... | Summarize fields which are specific to hex.drf.DRF.DRFModel. | [
"Summarize",
"fields",
"which",
"are",
"specific",
"to",
"hex",
".",
"drf",
".",
"DRF",
".",
"DRFModel",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L267-L277 | train |
h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeSpeeDRFModel | private static void summarizeSpeeDRFModel(ModelSummary summary, hex.singlenoderf.SpeeDRFModel model) {
// add generic fields such as column names
summarizeModelCommonFields(summary, model);
summary.model_algorithm = "Random Forest";
JsonObject all_params = (model.get_params()).toJSON();
summary.cr... | java | private static void summarizeSpeeDRFModel(ModelSummary summary, hex.singlenoderf.SpeeDRFModel model) {
// add generic fields such as column names
summarizeModelCommonFields(summary, model);
summary.model_algorithm = "Random Forest";
JsonObject all_params = (model.get_params()).toJSON();
summary.cr... | [
"private",
"static",
"void",
"summarizeSpeeDRFModel",
"(",
"ModelSummary",
"summary",
",",
"hex",
".",
"singlenoderf",
".",
"SpeeDRFModel",
"model",
")",
"{",
"// add generic fields such as column names",
"summarizeModelCommonFields",
"(",
"summary",
",",
"model",
")",
... | Summarize fields which are specific to hex.drf.DRF.SpeeDRFModel. | [
"Summarize",
"fields",
"which",
"are",
"specific",
"to",
"hex",
".",
"drf",
".",
"DRF",
".",
"SpeeDRFModel",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L289-L299 | train |
h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeDeepLearningModel | private static void summarizeDeepLearningModel(ModelSummary summary, hex.deeplearning.DeepLearningModel model) {
// add generic fields such as column names
summarizeModelCommonFields(summary, model);
summary.model_algorithm = "DeepLearning";
JsonObject all_params = (model.get_params()).toJSON();
s... | java | private static void summarizeDeepLearningModel(ModelSummary summary, hex.deeplearning.DeepLearningModel model) {
// add generic fields such as column names
summarizeModelCommonFields(summary, model);
summary.model_algorithm = "DeepLearning";
JsonObject all_params = (model.get_params()).toJSON();
s... | [
"private",
"static",
"void",
"summarizeDeepLearningModel",
"(",
"ModelSummary",
"summary",
",",
"hex",
".",
"deeplearning",
".",
"DeepLearningModel",
"model",
")",
"{",
"// add generic fields such as column names",
"summarizeModelCommonFields",
"(",
"summary",
",",
"model",... | Summarize fields which are specific to hex.deeplearning.DeepLearningModel. | [
"Summarize",
"fields",
"which",
"are",
"specific",
"to",
"hex",
".",
"deeplearning",
".",
"DeepLearningModel",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L311-L321 | train |
h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeGBMModel | private static void summarizeGBMModel(ModelSummary summary, hex.gbm.GBM.GBMModel model) {
// add generic fields such as column names
summarizeModelCommonFields(summary, model);
summary.model_algorithm = "GBM";
JsonObject all_params = (model.get_params()).toJSON();
summary.critical_parameters = whi... | java | private static void summarizeGBMModel(ModelSummary summary, hex.gbm.GBM.GBMModel model) {
// add generic fields such as column names
summarizeModelCommonFields(summary, model);
summary.model_algorithm = "GBM";
JsonObject all_params = (model.get_params()).toJSON();
summary.critical_parameters = whi... | [
"private",
"static",
"void",
"summarizeGBMModel",
"(",
"ModelSummary",
"summary",
",",
"hex",
".",
"gbm",
".",
"GBM",
".",
"GBMModel",
"model",
")",
"{",
"// add generic fields such as column names",
"summarizeModelCommonFields",
"(",
"summary",
",",
"model",
")",
"... | Summarize fields which are specific to hex.gbm.GBM.GBMModel. | [
"Summarize",
"fields",
"which",
"are",
"specific",
"to",
"hex",
".",
"gbm",
".",
"GBM",
".",
"GBMModel",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L333-L343 | train |
h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.summarizeNBModel | private static void summarizeNBModel(ModelSummary summary, hex.nb.NBModel model) {
// add generic fields such as column names
summarizeModelCommonFields(summary, model);
summary.model_algorithm = "Naive Bayes";
JsonObject all_params = (model.get_params()).toJSON();
summary.critical_parameters = wh... | java | private static void summarizeNBModel(ModelSummary summary, hex.nb.NBModel model) {
// add generic fields such as column names
summarizeModelCommonFields(summary, model);
summary.model_algorithm = "Naive Bayes";
JsonObject all_params = (model.get_params()).toJSON();
summary.critical_parameters = wh... | [
"private",
"static",
"void",
"summarizeNBModel",
"(",
"ModelSummary",
"summary",
",",
"hex",
".",
"nb",
".",
"NBModel",
"model",
")",
"{",
"// add generic fields such as column names",
"summarizeModelCommonFields",
"(",
"summary",
",",
"model",
")",
";",
"summary",
... | Summarize fields which are specific to hex.nb.NBModel. | [
"Summarize",
"fields",
"which",
"are",
"specific",
"to",
"hex",
".",
"nb",
".",
"NBModel",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L355-L365 | train |
h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.fetchAll | protected Map<String, Model> fetchAll() {
return H2O.KeySnapshot.globalSnapshot().fetchAll(water.Model.class);
} | java | protected Map<String, Model> fetchAll() {
return H2O.KeySnapshot.globalSnapshot().fetchAll(water.Model.class);
} | [
"protected",
"Map",
"<",
"String",
",",
"Model",
">",
"fetchAll",
"(",
")",
"{",
"return",
"H2O",
".",
"KeySnapshot",
".",
"globalSnapshot",
"(",
")",
".",
"fetchAll",
"(",
"water",
".",
"Model",
".",
"class",
")",
";",
"}"
] | Fetch all Models from the KV store. | [
"Fetch",
"all",
"Models",
"from",
"the",
"KV",
"store",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L370-L372 | train |
h2oai/h2o-2 | src/main/java/water/api/Models.java | Models.serveOneOrAll | private Response serveOneOrAll(Map<String, Model> modelsMap) {
// returns empty sets if !this.find_compatible_frames
Pair<Map<String, Frame>, Map<String, Set<String>>> frames_info = fetchFrames();
Map<String, Frame> all_frames = frames_info.getFirst();
Map<String, Set<String>> all_frames_cols = frames_i... | java | private Response serveOneOrAll(Map<String, Model> modelsMap) {
// returns empty sets if !this.find_compatible_frames
Pair<Map<String, Frame>, Map<String, Set<String>>> frames_info = fetchFrames();
Map<String, Frame> all_frames = frames_info.getFirst();
Map<String, Set<String>> all_frames_cols = frames_i... | [
"private",
"Response",
"serveOneOrAll",
"(",
"Map",
"<",
"String",
",",
"Model",
">",
"modelsMap",
")",
"{",
"// returns empty sets if !this.find_compatible_frames",
"Pair",
"<",
"Map",
"<",
"String",
",",
"Frame",
">",
",",
"Map",
"<",
"String",
",",
"Set",
"... | Fetch all the Models from the KV store, sumamrize and enhance them, and return a map of them. | [
"Fetch",
"all",
"the",
"Models",
"from",
"the",
"KV",
"store",
"sumamrize",
"and",
"enhance",
"them",
"and",
"return",
"a",
"map",
"of",
"them",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L386-L415 | train |
h2oai/h2o-2 | src/main/java/water/fvec/ParseDataset2.java | ParseProgress.make | static ParseProgress make( Key[] fkeys ) {
long total = 0;
for( Key fkey : fkeys )
total += getVec(fkey).length();
return new ParseProgress(0,total);
} | java | static ParseProgress make( Key[] fkeys ) {
long total = 0;
for( Key fkey : fkeys )
total += getVec(fkey).length();
return new ParseProgress(0,total);
} | [
"static",
"ParseProgress",
"make",
"(",
"Key",
"[",
"]",
"fkeys",
")",
"{",
"long",
"total",
"=",
"0",
";",
"for",
"(",
"Key",
"fkey",
":",
"fkeys",
")",
"total",
"+=",
"getVec",
"(",
"fkey",
")",
".",
"length",
"(",
")",
";",
"return",
"new",
"P... | Total number of steps is equal to total bytecount across files | [
"Total",
"number",
"of",
"steps",
"is",
"equal",
"to",
"total",
"bytecount",
"across",
"files"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/ParseDataset2.java#L159-L164 | train |
h2oai/h2o-2 | src/main/java/water/score/ScoreModel.java | ScoreModel.xml2jname | protected static String xml2jname( String xml ) {
// Convert pname to a valid java name
StringBuilder nn = new StringBuilder();
char[] cs = xml.toCharArray();
if( !Character.isJavaIdentifierStart(cs[0]) )
nn.append('X');
for( char c : cs ) {
if( !Character.isJavaIdentifierPart(c) ) {
... | java | protected static String xml2jname( String xml ) {
// Convert pname to a valid java name
StringBuilder nn = new StringBuilder();
char[] cs = xml.toCharArray();
if( !Character.isJavaIdentifierStart(cs[0]) )
nn.append('X');
for( char c : cs ) {
if( !Character.isJavaIdentifierPart(c) ) {
... | [
"protected",
"static",
"String",
"xml2jname",
"(",
"String",
"xml",
")",
"{",
"// Convert pname to a valid java name",
"StringBuilder",
"nn",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"char",
"[",
"]",
"cs",
"=",
"xml",
".",
"toCharArray",
"(",
")",
";",
"... | Convert an XML name to a java name | [
"Convert",
"an",
"XML",
"name",
"to",
"a",
"java",
"name"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/score/ScoreModel.java#L22-L37 | train |
h2oai/h2o-2 | src/main/java/water/score/ScoreModel.java | ScoreModel.uniqueClassName | protected static String uniqueClassName(String name) {
// Make a unique class name
String cname = xml2jname(name);
if( CLASS_NAMES.contains(cname) ) {
int i=0;
while( CLASS_NAMES.contains(cname+i) ) i++;
cname = cname+i;
}
CLASS_NAMES.add(cname);
return cname;
} | java | protected static String uniqueClassName(String name) {
// Make a unique class name
String cname = xml2jname(name);
if( CLASS_NAMES.contains(cname) ) {
int i=0;
while( CLASS_NAMES.contains(cname+i) ) i++;
cname = cname+i;
}
CLASS_NAMES.add(cname);
return cname;
} | [
"protected",
"static",
"String",
"uniqueClassName",
"(",
"String",
"name",
")",
"{",
"// Make a unique class name",
"String",
"cname",
"=",
"xml2jname",
"(",
"name",
")",
";",
"if",
"(",
"CLASS_NAMES",
".",
"contains",
"(",
"cname",
")",
")",
"{",
"int",
"i"... | Make a unique class name for jit'd subclasses of ScoreModel | [
"Make",
"a",
"unique",
"class",
"name",
"for",
"jit",
"d",
"subclasses",
"of",
"ScoreModel"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/score/ScoreModel.java#L44-L54 | train |
h2oai/h2o-2 | src/main/java/water/score/ScoreModel.java | ScoreModel.columnMapping | public int[] columnMapping( String[] features ) {
int[] map = new int[_colNames.length];
for( int i=0; i<_colNames.length; i++ ) {
map[i] = -1; // Assume it is missing
for( int j=0; j<features.length; j++ ) {
if( _colNames[i].equals(features[j]) ) {
if( map[i] != -1 ) ... | java | public int[] columnMapping( String[] features ) {
int[] map = new int[_colNames.length];
for( int i=0; i<_colNames.length; i++ ) {
map[i] = -1; // Assume it is missing
for( int j=0; j<features.length; j++ ) {
if( _colNames[i].equals(features[j]) ) {
if( map[i] != -1 ) ... | [
"public",
"int",
"[",
"]",
"columnMapping",
"(",
"String",
"[",
"]",
"features",
")",
"{",
"int",
"[",
"]",
"map",
"=",
"new",
"int",
"[",
"_colNames",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_colNames",
".",
... | needs, then this map will contain a -1 for the missing feature index. | [
"needs",
"then",
"this",
"map",
"will",
"contain",
"a",
"-",
"1",
"for",
"the",
"missing",
"feature",
"index",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/score/ScoreModel.java#L61-L74 | train |
h2oai/h2o-2 | src/main/java/water/Value.java | Value.setHdfs | public void setHdfs() {
assert onICE();
byte[] mem = memOrLoad(); // Get into stable memory
_persist = Value.HDFS|Value.NOTdsk;
Persist.I[Value.HDFS].store(this);
removeIce(); // Remove from ICE disk
assert onHDFS(); // Flip to HDFS
_mem = mem; // Close a race with the H2O... | java | public void setHdfs() {
assert onICE();
byte[] mem = memOrLoad(); // Get into stable memory
_persist = Value.HDFS|Value.NOTdsk;
Persist.I[Value.HDFS].store(this);
removeIce(); // Remove from ICE disk
assert onHDFS(); // Flip to HDFS
_mem = mem; // Close a race with the H2O... | [
"public",
"void",
"setHdfs",
"(",
")",
"{",
"assert",
"onICE",
"(",
")",
";",
"byte",
"[",
"]",
"mem",
"=",
"memOrLoad",
"(",
")",
";",
"// Get into stable memory",
"_persist",
"=",
"Value",
".",
"HDFS",
"|",
"Value",
".",
"NOTdsk",
";",
"Persist",
"."... | Set persistence to HDFS from ICE | [
"Set",
"persistence",
"to",
"HDFS",
"from",
"ICE"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Value.java#L211-L219 | train |
h2oai/h2o-2 | src/main/java/water/Value.java | Value.openStream | public InputStream openStream(ProgressMonitor p) throws IOException {
if(onNFS() ) return PersistNFS .openStream(_key );
if(onHDFS()) return PersistHdfs.openStream(_key,p);
if(onS3() ) return PersistS3 .openStream(_key,p);
if(onTachyon()) return PersistTachyon.openStream(_key,p);
if( isFrame() ) ... | java | public InputStream openStream(ProgressMonitor p) throws IOException {
if(onNFS() ) return PersistNFS .openStream(_key );
if(onHDFS()) return PersistHdfs.openStream(_key,p);
if(onS3() ) return PersistS3 .openStream(_key,p);
if(onTachyon()) return PersistTachyon.openStream(_key,p);
if( isFrame() ) ... | [
"public",
"InputStream",
"openStream",
"(",
"ProgressMonitor",
"p",
")",
"throws",
"IOException",
"{",
"if",
"(",
"onNFS",
"(",
")",
")",
"return",
"PersistNFS",
".",
"openStream",
"(",
"_key",
")",
";",
"if",
"(",
"onHDFS",
"(",
")",
")",
"return",
"Per... | Creates a Stream for reading bytes | [
"Creates",
"a",
"Stream",
"for",
"reading",
"bytes"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Value.java#L281-L289 | train |
h2oai/h2o-2 | src/main/java/water/Value.java | Value.lowerActiveGetCount | void lowerActiveGetCount( H2ONode h2o ) {
assert _key.home(); // Only the HOME node for a key tracks replicas
assert h2o != H2O.SELF;// Do not track self as a replica
while( true ) { // Repeat, in case racing GETs are bumping the counter
int old = _rwlock.get(); // Read the lock-word
a... | java | void lowerActiveGetCount( H2ONode h2o ) {
assert _key.home(); // Only the HOME node for a key tracks replicas
assert h2o != H2O.SELF;// Do not track self as a replica
while( true ) { // Repeat, in case racing GETs are bumping the counter
int old = _rwlock.get(); // Read the lock-word
a... | [
"void",
"lowerActiveGetCount",
"(",
"H2ONode",
"h2o",
")",
"{",
"assert",
"_key",
".",
"home",
"(",
")",
";",
"// Only the HOME node for a key tracks replicas",
"assert",
"h2o",
"!=",
"H2O",
".",
"SELF",
";",
"// Do not track self as a replica",
"while",
"(",
"true"... | Atomically lower active GET count | [
"Atomically",
"lower",
"active",
"GET",
"count"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Value.java#L502-L516 | train |
h2oai/h2o-2 | src/main/java/water/Value.java | Value.startRemotePut | void startRemotePut() {
assert !_key.home();
int x = 0;
// assert I am waiting on threads with higher priority?
while( (x=_rwlock.get()) != -1 ) // Spin until rwlock==-1
if( x == 1 || RW_CAS(0,1,"remote_need_notify") )
try { ForkJoinPool.managedBlock(this); } catch( InterruptedException e ... | java | void startRemotePut() {
assert !_key.home();
int x = 0;
// assert I am waiting on threads with higher priority?
while( (x=_rwlock.get()) != -1 ) // Spin until rwlock==-1
if( x == 1 || RW_CAS(0,1,"remote_need_notify") )
try { ForkJoinPool.managedBlock(this); } catch( InterruptedException e ... | [
"void",
"startRemotePut",
"(",
")",
"{",
"assert",
"!",
"_key",
".",
"home",
"(",
")",
";",
"int",
"x",
"=",
"0",
";",
"// assert I am waiting on threads with higher priority?",
"while",
"(",
"(",
"x",
"=",
"_rwlock",
".",
"get",
"(",
")",
")",
"!=",
"-"... | Block this thread until all prior remote PUTs complete - to force
remote-PUT ordering on the home node. | [
"Block",
"this",
"thread",
"until",
"all",
"prior",
"remote",
"PUTs",
"complete",
"-",
"to",
"force",
"remote",
"-",
"PUT",
"ordering",
"on",
"the",
"home",
"node",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Value.java#L564-L571 | train |
h2oai/h2o-2 | src/main/java/water/util/RString.java | RString.clear | public void clear() {
for( Placeholder p : _placeholders.values() ) {
p.start.removeTill(p.end);
}
} | java | public void clear() {
for( Placeholder p : _placeholders.values() ) {
p.start.removeTill(p.end);
}
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"for",
"(",
"Placeholder",
"p",
":",
"_placeholders",
".",
"values",
"(",
")",
")",
"{",
"p",
".",
"start",
".",
"removeTill",
"(",
"p",
".",
"end",
")",
";",
"}",
"}"
] | they can be used again. | [
"they",
"can",
"be",
"used",
"again",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/util/RString.java#L273-L277 | train |
h2oai/h2o-2 | src/main/java/water/util/RString.java | RString.replace | public void replace(String what, Object with) {
if (what.charAt(0)=='$')
throw new RuntimeException("$ is now control char that denotes URL encoding!");
for (Placeholder p : _placeholders.get(what))
p.end.insertAndAdvance(with.toString());
for (Placeholder p : _placeholders.get("$"+what))
... | java | public void replace(String what, Object with) {
if (what.charAt(0)=='$')
throw new RuntimeException("$ is now control char that denotes URL encoding!");
for (Placeholder p : _placeholders.get(what))
p.end.insertAndAdvance(with.toString());
for (Placeholder p : _placeholders.get("$"+what))
... | [
"public",
"void",
"replace",
"(",
"String",
"what",
",",
"Object",
"with",
")",
"{",
"if",
"(",
"what",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"$ is now control char that denotes URL encoding!\"",
")",
"... | another in order. | [
"another",
"in",
"order",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/util/RString.java#L304-L316 | train |
h2oai/h2o-2 | src/main/java/water/util/RString.java | RString.restartGroup | public RString restartGroup(String what) {
List<Placeholder> all = _placeholders.get(what);
assert all.size() == 1;
Placeholder result = all.get(0);
if( result.group == null ) {
throw new NoSuchElementException("Element " + what + " is not a group.");
}
result.group.clear();
return re... | java | public RString restartGroup(String what) {
List<Placeholder> all = _placeholders.get(what);
assert all.size() == 1;
Placeholder result = all.get(0);
if( result.group == null ) {
throw new NoSuchElementException("Element " + what + " is not a group.");
}
result.group.clear();
return re... | [
"public",
"RString",
"restartGroup",
"(",
"String",
"what",
")",
"{",
"List",
"<",
"Placeholder",
">",
"all",
"=",
"_placeholders",
".",
"get",
"(",
"what",
")",
";",
"assert",
"all",
".",
"size",
"(",
")",
"==",
"1",
";",
"Placeholder",
"result",
"=",... | can be filled again. | [
"can",
"be",
"filled",
"again",
"."
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/util/RString.java#L320-L330 | train |
belaban/JGroups | src/org/jgroups/protocols/AUTH.java | AUTH.handleAuthHeader | protected boolean handleAuthHeader(GMS.GmsHeader gms_hdr, AuthHeader auth_hdr, Message msg) {
if(needsAuthentication(gms_hdr)) {
if(this.auth_token.authenticate(auth_hdr.getToken(), msg))
return true; // authentication passed, send message up the stack
else {
... | java | protected boolean handleAuthHeader(GMS.GmsHeader gms_hdr, AuthHeader auth_hdr, Message msg) {
if(needsAuthentication(gms_hdr)) {
if(this.auth_token.authenticate(auth_hdr.getToken(), msg))
return true; // authentication passed, send message up the stack
else {
... | [
"protected",
"boolean",
"handleAuthHeader",
"(",
"GMS",
".",
"GmsHeader",
"gms_hdr",
",",
"AuthHeader",
"auth_hdr",
",",
"Message",
"msg",
")",
"{",
"if",
"(",
"needsAuthentication",
"(",
"gms_hdr",
")",
")",
"{",
"if",
"(",
"this",
".",
"auth_token",
".",
... | Handles a GMS header
@param gms_hdr
@param msg
@return true if the message should be passed up, or else false | [
"Handles",
"a",
"GMS",
"header"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/AUTH.java#L214-L227 | train |
belaban/JGroups | src/org/jgroups/util/TimeScheduler3.java | TimeScheduler3.stop | public synchronized void stop() {
Thread tmp=runner;
runner=null;
if(tmp != null) {
tmp.interrupt();
try {tmp.join(500);} catch(InterruptedException e) {}
}
// we may need to do multiple iterations as the iterator works on a copy and tasks might have been... | java | public synchronized void stop() {
Thread tmp=runner;
runner=null;
if(tmp != null) {
tmp.interrupt();
try {tmp.join(500);} catch(InterruptedException e) {}
}
// we may need to do multiple iterations as the iterator works on a copy and tasks might have been... | [
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"Thread",
"tmp",
"=",
"runner",
";",
"runner",
"=",
"null",
";",
"if",
"(",
"tmp",
"!=",
"null",
")",
"{",
"tmp",
".",
"interrupt",
"(",
")",
";",
"try",
"{",
"tmp",
".",
"join",
"(",
"500"... | Stops the timer, cancelling all tasks | [
"Stops",
"the",
"timer",
"cancelling",
"all",
"tasks"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/TimeScheduler3.java#L158-L190 | train |
belaban/JGroups | src/org/jgroups/blocks/cs/NioBaseServer.java | NioBaseServer.printBuffers | @ManagedOperation(description="Prints the send and receive buffers")
public String printBuffers() {
StringBuilder sb=new StringBuilder("\n");
synchronized(this) {
for(Map.Entry<Address,Connection> entry: conns.entrySet()) {
NioConnection val=(NioConnection)entry.getValue(... | java | @ManagedOperation(description="Prints the send and receive buffers")
public String printBuffers() {
StringBuilder sb=new StringBuilder("\n");
synchronized(this) {
for(Map.Entry<Address,Connection> entry: conns.entrySet()) {
NioConnection val=(NioConnection)entry.getValue(... | [
"@",
"ManagedOperation",
"(",
"description",
"=",
"\"Prints the send and receive buffers\"",
")",
"public",
"String",
"printBuffers",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"\\n\"",
")",
";",
"synchronized",
"(",
"this",
")",
"{"... | Prints send and receive buffers for all connections | [
"Prints",
"send",
"and",
"receive",
"buffers",
"for",
"all",
"connections"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/cs/NioBaseServer.java#L76-L87 | train |
belaban/JGroups | src/org/jgroups/util/RingBufferSeqno.java | RingBufferSeqno.stable | public void stable(long seqno) {
lock.lock();
try {
if(seqno <= low)
return;
if(seqno > hd)
throw new IllegalArgumentException("seqno " + seqno + " cannot be bigger than hd (" + hd + ")");
int from=index(low+1), length=(int)(seqno - lo... | java | public void stable(long seqno) {
lock.lock();
try {
if(seqno <= low)
return;
if(seqno > hd)
throw new IllegalArgumentException("seqno " + seqno + " cannot be bigger than hd (" + hd + ")");
int from=index(low+1), length=(int)(seqno - lo... | [
"public",
"void",
"stable",
"(",
"long",
"seqno",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"seqno",
"<=",
"low",
")",
"return",
";",
"if",
"(",
"seqno",
">",
"hd",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\... | Nulls elements between low and seqno and forwards low | [
"Nulls",
"elements",
"between",
"low",
"and",
"seqno",
"and",
"forwards",
"low"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RingBufferSeqno.java#L278-L301 | train |
belaban/JGroups | src/org/jgroups/demos/wb/GraphPanel.java | GraphPanel.adjustNodes | public void adjustNodes(java.util.List<Address> v) {
Node n;
boolean removed=false;
synchronized(nodes) {
for(int i=0; i < nodes.size(); i++) {
n=nodes.get(i);
if(!v.contains(n.addr)) {
System.out.println("adjustNodes(): node " + n... | java | public void adjustNodes(java.util.List<Address> v) {
Node n;
boolean removed=false;
synchronized(nodes) {
for(int i=0; i < nodes.size(); i++) {
n=nodes.get(i);
if(!v.contains(n.addr)) {
System.out.println("adjustNodes(): node " + n... | [
"public",
"void",
"adjustNodes",
"(",
"java",
".",
"util",
".",
"List",
"<",
"Address",
">",
"v",
")",
"{",
"Node",
"n",
";",
"boolean",
"removed",
"=",
"false",
";",
"synchronized",
"(",
"nodes",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
... | Removes nodes that are not in the view | [
"Removes",
"nodes",
"that",
"are",
"not",
"in",
"the",
"view"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/demos/wb/GraphPanel.java#L113-L129 | train |
belaban/JGroups | src/org/jgroups/demos/Chat.java | Chat.start | public void start(JChannel ch) throws Exception {
channel=ch;
channel.setReceiver(this);
channel.connect("ChatCluster");
eventLoop();
channel.close();
} | java | public void start(JChannel ch) throws Exception {
channel=ch;
channel.setReceiver(this);
channel.connect("ChatCluster");
eventLoop();
channel.close();
} | [
"public",
"void",
"start",
"(",
"JChannel",
"ch",
")",
"throws",
"Exception",
"{",
"channel",
"=",
"ch",
";",
"channel",
".",
"setReceiver",
"(",
"this",
")",
";",
"channel",
".",
"connect",
"(",
"\"ChatCluster\"",
")",
";",
"eventLoop",
"(",
")",
";",
... | Method called from other app, injecting channel | [
"Method",
"called",
"from",
"other",
"app",
"injecting",
"channel"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/demos/Chat.java#L24-L30 | train |
belaban/JGroups | src/org/jgroups/util/ResponseCollector.java | ResponseCollector.waitForAllResponses | public boolean waitForAllResponses(long timeout) {
if(timeout <= 0)
timeout=2000L;
return cond.waitFor(this::hasAllResponses, timeout, TimeUnit.MILLISECONDS);
} | java | public boolean waitForAllResponses(long timeout) {
if(timeout <= 0)
timeout=2000L;
return cond.waitFor(this::hasAllResponses, timeout, TimeUnit.MILLISECONDS);
} | [
"public",
"boolean",
"waitForAllResponses",
"(",
"long",
"timeout",
")",
"{",
"if",
"(",
"timeout",
"<=",
"0",
")",
"timeout",
"=",
"2000L",
";",
"return",
"cond",
".",
"waitFor",
"(",
"this",
"::",
"hasAllResponses",
",",
"timeout",
",",
"TimeUnit",
".",
... | Waits until all responses have been received, or until a timeout has elapsed.
@param timeout Number of milliseconds to wait max. This value needs to be greater than 0, or else
it will be adjusted to 2000
@return boolean True if all responses have been received within timeout ms, else false (e.g. if interrupted) | [
"Waits",
"until",
"all",
"responses",
"have",
"been",
"received",
"or",
"until",
"a",
"timeout",
"has",
"elapsed",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/ResponseCollector.java#L160-L164 | train |
belaban/JGroups | src/org/jgroups/util/ForwardQueue.java | ForwardQueue.deliveryTableSize | public int deliveryTableSize() {
int retval=0;
for(BoundedHashMap<Long,Long> val: delivery_table.values())
retval+=val.size();
return retval;
} | java | public int deliveryTableSize() {
int retval=0;
for(BoundedHashMap<Long,Long> val: delivery_table.values())
retval+=val.size();
return retval;
} | [
"public",
"int",
"deliveryTableSize",
"(",
")",
"{",
"int",
"retval",
"=",
"0",
";",
"for",
"(",
"BoundedHashMap",
"<",
"Long",
",",
"Long",
">",
"val",
":",
"delivery_table",
".",
"values",
"(",
")",
")",
"retval",
"+=",
"val",
".",
"size",
"(",
")"... | Total size of all queues of the delivery table | [
"Total",
"size",
"of",
"all",
"queues",
"of",
"the",
"delivery",
"table"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/ForwardQueue.java#L81-L86 | train |
belaban/JGroups | src/org/jgroups/util/ForwardQueue.java | ForwardQueue.canDeliver | protected boolean canDeliver(Address sender, long seqno) {
BoundedHashMap<Long,Long> seqno_set=delivery_table.get(sender);
if(seqno_set == null) {
seqno_set=new BoundedHashMap<>(delivery_table_max_size);
BoundedHashMap<Long,Long> existing=delivery_table.put(sender,seqno_set);
... | java | protected boolean canDeliver(Address sender, long seqno) {
BoundedHashMap<Long,Long> seqno_set=delivery_table.get(sender);
if(seqno_set == null) {
seqno_set=new BoundedHashMap<>(delivery_table_max_size);
BoundedHashMap<Long,Long> existing=delivery_table.put(sender,seqno_set);
... | [
"protected",
"boolean",
"canDeliver",
"(",
"Address",
"sender",
",",
"long",
"seqno",
")",
"{",
"BoundedHashMap",
"<",
"Long",
",",
"Long",
">",
"seqno_set",
"=",
"delivery_table",
".",
"get",
"(",
"sender",
")",
";",
"if",
"(",
"seqno_set",
"==",
"null",
... | Checks if seqno has already been received from sender. This weeds out duplicates.
Note that this method is never called concurrently for the same sender. | [
"Checks",
"if",
"seqno",
"has",
"already",
"been",
"received",
"from",
"sender",
".",
"This",
"weeds",
"out",
"duplicates",
".",
"Note",
"that",
"this",
"method",
"is",
"never",
"called",
"concurrently",
"for",
"the",
"same",
"sender",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/ForwardQueue.java#L236-L245 | train |
belaban/JGroups | src/org/jgroups/auth/Krb5TokenUtils.java | Krb5TokenUtils.generateSecuritySubject | public static Subject generateSecuritySubject(String jassLoginConfig, String username, String password) throws LoginException {
LoginContext loginCtx = null;
try {
// "Client" references the JAAS configuration in the jaas.conf file.
loginCtx = new LoginContext... | java | public static Subject generateSecuritySubject(String jassLoginConfig, String username, String password) throws LoginException {
LoginContext loginCtx = null;
try {
// "Client" references the JAAS configuration in the jaas.conf file.
loginCtx = new LoginContext... | [
"public",
"static",
"Subject",
"generateSecuritySubject",
"(",
"String",
"jassLoginConfig",
",",
"String",
"username",
",",
"String",
"password",
")",
"throws",
"LoginException",
"{",
"LoginContext",
"loginCtx",
"=",
"null",
";",
"try",
"{",
"// \"Client\" references ... | Authenticate against the KDC using JAAS. | [
"Authenticate",
"against",
"the",
"KDC",
"using",
"JAAS",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/auth/Krb5TokenUtils.java#L42-L60 | train |
belaban/JGroups | src/org/jgroups/auth/Krb5TokenUtils.java | Krb5TokenUtils.initiateSecurityContext | public static byte[] initiateSecurityContext(Subject subject, String servicePrincipalName) throws GSSException {
GSSManager manager = GSSManager.getInstance();
GSSName serverName = manager.createName(servicePrincipalName, GSSName.NT_HOSTBASED_SERVICE);
final GSSContext context = manager.c... | java | public static byte[] initiateSecurityContext(Subject subject, String servicePrincipalName) throws GSSException {
GSSManager manager = GSSManager.getInstance();
GSSName serverName = manager.createName(servicePrincipalName, GSSName.NT_HOSTBASED_SERVICE);
final GSSContext context = manager.c... | [
"public",
"static",
"byte",
"[",
"]",
"initiateSecurityContext",
"(",
"Subject",
"subject",
",",
"String",
"servicePrincipalName",
")",
"throws",
"GSSException",
"{",
"GSSManager",
"manager",
"=",
"GSSManager",
".",
"getInstance",
"(",
")",
";",
"GSSName",
"server... | Generate the service ticket that will be passed to the cluster master for authentication | [
"Generate",
"the",
"service",
"ticket",
"that",
"will",
"be",
"passed",
"to",
"the",
"cluster",
"master",
"for",
"authentication"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/auth/Krb5TokenUtils.java#L63-L84 | train |
belaban/JGroups | src/org/jgroups/auth/Krb5TokenUtils.java | Krb5TokenUtils.validateSecurityContext | public static String validateSecurityContext(Subject subject, final byte[] serviceTicket) throws GSSException {
// Accept the context and return the client principal name.
return Subject.doAs(subject, (PrivilegedAction<String>)() -> {
try {
// Identify the server that commun... | java | public static String validateSecurityContext(Subject subject, final byte[] serviceTicket) throws GSSException {
// Accept the context and return the client principal name.
return Subject.doAs(subject, (PrivilegedAction<String>)() -> {
try {
// Identify the server that commun... | [
"public",
"static",
"String",
"validateSecurityContext",
"(",
"Subject",
"subject",
",",
"final",
"byte",
"[",
"]",
"serviceTicket",
")",
"throws",
"GSSException",
"{",
"// Accept the context and return the client principal name.",
"return",
"Subject",
".",
"doAs",
"(",
... | Validate the service ticket by extracting the client principal name | [
"Validate",
"the",
"service",
"ticket",
"by",
"extracting",
"the",
"client",
"principal",
"name"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/auth/Krb5TokenUtils.java#L87-L103 | train |
belaban/JGroups | src/org/jgroups/ViewId.java | ViewId.compareTo | public int compareTo(ViewId other) {
return id > other.id ? 1 : id < other.id ? -1 : creator.compareTo(other.creator);
} | java | public int compareTo(ViewId other) {
return id > other.id ? 1 : id < other.id ? -1 : creator.compareTo(other.creator);
} | [
"public",
"int",
"compareTo",
"(",
"ViewId",
"other",
")",
"{",
"return",
"id",
">",
"other",
".",
"id",
"?",
"1",
":",
"id",
"<",
"other",
".",
"id",
"?",
"-",
"1",
":",
"creator",
".",
"compareTo",
"(",
"other",
".",
"creator",
")",
";",
"}"
] | Establishes an order between 2 ViewIds. The comparison is done on the IDs, if they are equal, we use the creator.
@return 0 for equality, value less than 0 if smaller, greater than 0 if greater. | [
"Establishes",
"an",
"order",
"between",
"2",
"ViewIds",
".",
"The",
"comparison",
"is",
"done",
"on",
"the",
"IDs",
"if",
"they",
"are",
"equal",
"we",
"use",
"the",
"creator",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/ViewId.java#L86-L88 | train |
belaban/JGroups | src/org/jgroups/protocols/pbcast/ViewHandler.java | ViewHandler.processing | public <T extends ViewHandler<R>> T processing(boolean flag) {
lock.lock();
try {
setProcessing(flag);
return (T)this;
}
finally {
lock.unlock();
}
} | java | public <T extends ViewHandler<R>> T processing(boolean flag) {
lock.lock();
try {
setProcessing(flag);
return (T)this;
}
finally {
lock.unlock();
}
} | [
"public",
"<",
"T",
"extends",
"ViewHandler",
"<",
"R",
">",
">",
"T",
"processing",
"(",
"boolean",
"flag",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"setProcessing",
"(",
"flag",
")",
";",
"return",
"(",
"T",
")",
"this",
";",
"... | To be used by testing only! | [
"To",
"be",
"used",
"by",
"testing",
"only!"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/ViewHandler.java#L139-L148 | train |
belaban/JGroups | src/org/jgroups/protocols/pbcast/ViewHandler.java | ViewHandler.process | protected void process(Collection<R> requests) {
for(;;) {
while(!requests.isEmpty()) {
removeAndProcess(requests); // remove matching requests and process them
}
lock.lock();
try {
if(requests.isEmpty()) {
setPr... | java | protected void process(Collection<R> requests) {
for(;;) {
while(!requests.isEmpty()) {
removeAndProcess(requests); // remove matching requests and process them
}
lock.lock();
try {
if(requests.isEmpty()) {
setPr... | [
"protected",
"void",
"process",
"(",
"Collection",
"<",
"R",
">",
"requests",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"while",
"(",
"!",
"requests",
".",
"isEmpty",
"(",
")",
")",
"{",
"removeAndProcess",
"(",
"requests",
")",
";",
"// remove matchin... | We're guaranteed that only one thread will be called with this method at any time | [
"We",
"re",
"guaranteed",
"that",
"only",
"one",
"thread",
"will",
"be",
"called",
"with",
"this",
"method",
"at",
"any",
"time"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/ViewHandler.java#L241-L257 | train |
belaban/JGroups | src/org/jgroups/util/Promise.java | Promise.setResult | public void setResult(T obj) {
lock.lock();
try {
result=obj;
hasResult=true;
cond.signal(true);
}
finally {
lock.unlock();
}
} | java | public void setResult(T obj) {
lock.lock();
try {
result=obj;
hasResult=true;
cond.signal(true);
}
finally {
lock.unlock();
}
} | [
"public",
"void",
"setResult",
"(",
"T",
"obj",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"result",
"=",
"obj",
";",
"hasResult",
"=",
"true",
";",
"cond",
".",
"signal",
"(",
"true",
")",
";",
"}",
"finally",
"{",
"lock",
".",
... | Sets the result and notifies any threads waiting for it | [
"Sets",
"the",
"result",
"and",
"notifies",
"any",
"threads",
"waiting",
"for",
"it"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Promise.java#L96-L106 | train |
belaban/JGroups | src/org/jgroups/util/Promise.java | Promise._getResultWithTimeout | protected T _getResultWithTimeout(final long timeout) throws TimeoutException {
if(timeout <= 0)
cond.waitFor(this::hasResult);
else if(!cond.waitFor(this::hasResult, timeout, TimeUnit.MILLISECONDS))
throw new TimeoutException();
return result;
} | java | protected T _getResultWithTimeout(final long timeout) throws TimeoutException {
if(timeout <= 0)
cond.waitFor(this::hasResult);
else if(!cond.waitFor(this::hasResult, timeout, TimeUnit.MILLISECONDS))
throw new TimeoutException();
return result;
} | [
"protected",
"T",
"_getResultWithTimeout",
"(",
"final",
"long",
"timeout",
")",
"throws",
"TimeoutException",
"{",
"if",
"(",
"timeout",
"<=",
"0",
")",
"cond",
".",
"waitFor",
"(",
"this",
"::",
"hasResult",
")",
";",
"else",
"if",
"(",
"!",
"cond",
".... | Blocks until a result is available, or timeout milliseconds have elapsed. Needs to be called with lock held
@param timeout in ms
@return An object
@throws TimeoutException If a timeout occurred (implies that timeout > 0) | [
"Blocks",
"until",
"a",
"result",
"is",
"available",
"or",
"timeout",
"milliseconds",
"have",
"elapsed",
".",
"Needs",
"to",
"be",
"called",
"with",
"lock",
"held"
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Promise.java#L143-L149 | train |
belaban/JGroups | src/org/jgroups/protocols/pbcast/ServerGmsImpl.java | ServerGmsImpl.handleViewChange | public void handleViewChange(View view, Digest digest) {
if(gms.isLeaving() && !view.containsMember(gms.local_addr))
return;
View prev_view=gms.view();
gms.installView(view, digest);
Address prev_coord=prev_view != null? prev_view.getCoord() : null, curr_coord=view.getCoord()... | java | public void handleViewChange(View view, Digest digest) {
if(gms.isLeaving() && !view.containsMember(gms.local_addr))
return;
View prev_view=gms.view();
gms.installView(view, digest);
Address prev_coord=prev_view != null? prev_view.getCoord() : null, curr_coord=view.getCoord()... | [
"public",
"void",
"handleViewChange",
"(",
"View",
"view",
",",
"Digest",
"digest",
")",
"{",
"if",
"(",
"gms",
".",
"isLeaving",
"(",
")",
"&&",
"!",
"view",
".",
"containsMember",
"(",
"gms",
".",
"local_addr",
")",
")",
"return",
";",
"View",
"prev_... | Called by the GMS when a VIEW is received.
@param view The view to be installed
@param digest If view is a MergeView, the digest contains the seqnos of all members and has to be set by GMS | [
"Called",
"by",
"the",
"GMS",
"when",
"a",
"VIEW",
"is",
"received",
"."
] | bd3ca786aa57fed41dfbc10a94b1281e388be03b | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/ServerGmsImpl.java#L63-L71 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.