id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
131,300 | h2oai/h2o-3 | h2o-genmodel-extensions/xgboost/src/main/java/hex/genmodel/algos/xgboost/XGBoostMojoModel.java | XGBoostMojoModel.toPreds | public static double[] toPreds(double in[], float[] out, double[] preds,
int nclasses, double[] priorClassDistrib, double defaultThreshold) {
if (nclasses > 2) {
for (int i = 0; i < out.length; ++i)
preds[1 + i] = out[i];
preds[0] = GenModel.getPrediction(preds, priorCl... | java | public static double[] toPreds(double in[], float[] out, double[] preds,
int nclasses, double[] priorClassDistrib, double defaultThreshold) {
if (nclasses > 2) {
for (int i = 0; i < out.length; ++i)
preds[1 + i] = out[i];
preds[0] = GenModel.getPrediction(preds, priorCl... | [
"public",
"static",
"double",
"[",
"]",
"toPreds",
"(",
"double",
"in",
"[",
"]",
",",
"float",
"[",
"]",
"out",
",",
"double",
"[",
"]",
"preds",
",",
"int",
"nclasses",
",",
"double",
"[",
"]",
"priorClassDistrib",
",",
"double",
"defaultThreshold",
... | for float output | [
"for",
"float",
"output"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel-extensions/xgboost/src/main/java/hex/genmodel/algos/xgboost/XGBoostMojoModel.java#L71-L85 |
131,301 | h2oai/h2o-3 | h2o-mapreduce-generic/src/main/java/water/hadoop/h2odriver.java | h2odriver.convertStringToByteArr | static public byte[] convertStringToByteArr(String s) {
if ((s.length() % 2) != 0) {
throw new RuntimeException("String length must be even (was " + s.length() + ")");
}
ArrayList<Byte> byteArrayList = new ArrayList<Byte>();
for (int i = 0; i < s.length(); i = i + 2) {
String s2 = s.substri... | java | static public byte[] convertStringToByteArr(String s) {
if ((s.length() % 2) != 0) {
throw new RuntimeException("String length must be even (was " + s.length() + ")");
}
ArrayList<Byte> byteArrayList = new ArrayList<Byte>();
for (int i = 0; i < s.length(); i = i + 2) {
String s2 = s.substri... | [
"static",
"public",
"byte",
"[",
"]",
"convertStringToByteArr",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"(",
"s",
".",
"length",
"(",
")",
"%",
"2",
")",
"!=",
"0",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"String length must be even (was \"",... | Hexadecimal string to brute-force convert into an array of bytes.
The length of the string must be even.
The length of the string is 2x the length of the byte array.
@param s Hexadecimal string
@return byte array | [
"Hexadecimal",
"string",
"to",
"brute",
"-",
"force",
"convert",
"into",
"an",
"array",
"of",
"bytes",
".",
"The",
"length",
"of",
"the",
"string",
"must",
"be",
"even",
".",
"The",
"length",
"of",
"the",
"string",
"is",
"2x",
"the",
"length",
"of",
"t... | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-mapreduce-generic/src/main/java/water/hadoop/h2odriver.java#L794-L812 |
131,302 | h2oai/h2o-3 | h2o-mapreduce-generic/src/main/java/water/hadoop/h2odriver.java | h2odriver.run | @Override
public int run(String[] args) {
int rv = -1;
try {
rv = run2(args);
}
catch (org.apache.hadoop.mapred.FileAlreadyExistsException e) {
if (ctrlc != null) { ctrlc.setComplete(); }
System.out.println("ERROR: " + (e.getMessage() != null ? e.getMessage() : "(null)"));
Sys... | java | @Override
public int run(String[] args) {
int rv = -1;
try {
rv = run2(args);
}
catch (org.apache.hadoop.mapred.FileAlreadyExistsException e) {
if (ctrlc != null) { ctrlc.setComplete(); }
System.out.println("ERROR: " + (e.getMessage() != null ? e.getMessage() : "(null)"));
Sys... | [
"@",
"Override",
"public",
"int",
"run",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"int",
"rv",
"=",
"-",
"1",
";",
"try",
"{",
"rv",
"=",
"run2",
"(",
"args",
")",
";",
"}",
"catch",
"(",
"org",
".",
"apache",
".",
"hadoop",
".",
"mapred",
... | The run method called by ToolRunner.
@param args Arguments after ToolRunner arguments have been removed.
@return Exit value of program. | [
"The",
"run",
"method",
"called",
"by",
"ToolRunner",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-mapreduce-generic/src/main/java/water/hadoop/h2odriver.java#L1865-L1884 |
131,303 | h2oai/h2o-3 | h2o-core/src/main/java/water/Lockable.java | Lockable.delete | public static void delete( Key key ) {
Value val = DKV.get(key);
if( val==null ) return;
((Lockable)val.get()).delete();
} | java | public static void delete( Key key ) {
Value val = DKV.get(key);
if( val==null ) return;
((Lockable)val.get()).delete();
} | [
"public",
"static",
"void",
"delete",
"(",
"Key",
"key",
")",
"{",
"Value",
"val",
"=",
"DKV",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"return",
";",
"(",
"(",
"Lockable",
")",
"val",
".",
"get",
"(",
")",
")",
... | Write-lock key and delete; blocking.
Throws IAE if the key is already locked. | [
"Write",
"-",
"lock",
"key",
"and",
"delete",
";",
"blocking",
".",
"Throws",
"IAE",
"if",
"the",
"key",
"is",
"already",
"locked",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/Lockable.java#L81-L85 |
131,304 | h2oai/h2o-3 | h2o-core/src/main/java/water/Lockable.java | Lockable.delete | public final Futures delete( Key<Job> job_key, Futures fs ) {
if( _key != null ) {
Log.debug("lock-then-delete "+_key+" by job "+job_key);
new PriorWriteLock(job_key).invoke(_key);
}
return remove(fs);
} | java | public final Futures delete( Key<Job> job_key, Futures fs ) {
if( _key != null ) {
Log.debug("lock-then-delete "+_key+" by job "+job_key);
new PriorWriteLock(job_key).invoke(_key);
}
return remove(fs);
} | [
"public",
"final",
"Futures",
"delete",
"(",
"Key",
"<",
"Job",
">",
"job_key",
",",
"Futures",
"fs",
")",
"{",
"if",
"(",
"_key",
"!=",
"null",
")",
"{",
"Log",
".",
"debug",
"(",
"\"lock-then-delete \"",
"+",
"_key",
"+",
"\" by job \"",
"+",
"job_ke... | Write-lock 'this' and delete.
Throws IAE if the _key is already locked.
Subclasses that need custom deletion logic should override {@link #remove_impl(Futures)}. | [
"Write",
"-",
"lock",
"this",
"and",
"delete",
".",
"Throws",
"IAE",
"if",
"the",
"_key",
"is",
"already",
"locked",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/Lockable.java#L99-L105 |
131,305 | h2oai/h2o-3 | h2o-core/src/main/java/water/Lockable.java | Lockable.read_lock | public void read_lock( Key<Job> job_key ) {
if( _key != null ) {
Log.debug("shared-read-lock "+_key+" by job "+job_key);
new ReadLock(job_key).invoke(_key);
}
} | java | public void read_lock( Key<Job> job_key ) {
if( _key != null ) {
Log.debug("shared-read-lock "+_key+" by job "+job_key);
new ReadLock(job_key).invoke(_key);
}
} | [
"public",
"void",
"read_lock",
"(",
"Key",
"<",
"Job",
">",
"job_key",
")",
"{",
"if",
"(",
"_key",
"!=",
"null",
")",
"{",
"Log",
".",
"debug",
"(",
"\"shared-read-lock \"",
"+",
"_key",
"+",
"\" by job \"",
"+",
"job_key",
")",
";",
"new",
"ReadLock"... | Atomically get a read-lock on this, preventing future deletes or updates | [
"Atomically",
"get",
"a",
"read",
"-",
"lock",
"on",
"this",
"preventing",
"future",
"deletes",
"or",
"updates"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/Lockable.java#L136-L141 |
131,306 | h2oai/h2o-3 | h2o-core/src/main/java/water/Lockable.java | Lockable.is_locked | private boolean is_locked(Key<Job> job_key) {
if( _lockers==null ) return false;
for( int i=(_lockers.length==1?0:1); i<_lockers.length; i++ ) {
Key k = _lockers[i];
if( job_key==k || (job_key != null && k != null && job_key.equals(k)) ) return true;
}
return false;
} | java | private boolean is_locked(Key<Job> job_key) {
if( _lockers==null ) return false;
for( int i=(_lockers.length==1?0:1); i<_lockers.length; i++ ) {
Key k = _lockers[i];
if( job_key==k || (job_key != null && k != null && job_key.equals(k)) ) return true;
}
return false;
} | [
"private",
"boolean",
"is_locked",
"(",
"Key",
"<",
"Job",
">",
"job_key",
")",
"{",
"if",
"(",
"_lockers",
"==",
"null",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"(",
"_lockers",
".",
"length",
"==",
"1",
"?",
"0",
":",
"1",
")"... | Accessors for locking state. Minimal self-checking; primitive results | [
"Accessors",
"for",
"locking",
"state",
".",
"Minimal",
"self",
"-",
"checking",
";",
"primitive",
"results"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/Lockable.java#L212-L219 |
131,307 | h2oai/h2o-3 | h2o-extensions/xgboost/src/main/java/ml/dmlc/xgboost4j/java/XGBoostUpdateTask.java | XGBoostUpdateTask.getBoosterBytes | public byte[] getBoosterBytes() {
final H2ONode boosterNode = getBoosterNode();
final byte[] boosterBytes;
if (H2O.SELF.equals(boosterNode)) {
boosterBytes = XGBoost.getRawArray(XGBoostUpdater.getUpdater(_modelKey).getBooster());
} else {
Log.debug("Booster will b... | java | public byte[] getBoosterBytes() {
final H2ONode boosterNode = getBoosterNode();
final byte[] boosterBytes;
if (H2O.SELF.equals(boosterNode)) {
boosterBytes = XGBoost.getRawArray(XGBoostUpdater.getUpdater(_modelKey).getBooster());
} else {
Log.debug("Booster will b... | [
"public",
"byte",
"[",
"]",
"getBoosterBytes",
"(",
")",
"{",
"final",
"H2ONode",
"boosterNode",
"=",
"getBoosterNode",
"(",
")",
";",
"final",
"byte",
"[",
"]",
"boosterBytes",
";",
"if",
"(",
"H2O",
".",
"SELF",
".",
"equals",
"(",
"boosterNode",
")",
... | This is called from driver | [
"This",
"is",
"called",
"from",
"driver"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-extensions/xgboost/src/main/java/ml/dmlc/xgboost4j/java/XGBoostUpdateTask.java#L25-L36 |
131,308 | h2oai/h2o-3 | h2o-automl/src/main/java/ai/h2o/automl/FrameMetadata.java | FrameMetadata.diffCols | public int[] diffCols(int[] filterThese) {
HashSet<Integer> filter = new HashSet<>();
for(int i:filterThese)filter.add(i);
ArrayList<Integer> res = new ArrayList<>();
for(int i=0;i<_cols.length;++i) {
if( _cols[i]._ignored || _cols[i]._response || filter.contains(i) ) continue;
res.add(i);
... | java | public int[] diffCols(int[] filterThese) {
HashSet<Integer> filter = new HashSet<>();
for(int i:filterThese)filter.add(i);
ArrayList<Integer> res = new ArrayList<>();
for(int i=0;i<_cols.length;++i) {
if( _cols[i]._ignored || _cols[i]._response || filter.contains(i) ) continue;
res.add(i);
... | [
"public",
"int",
"[",
"]",
"diffCols",
"(",
"int",
"[",
"]",
"filterThese",
")",
"{",
"HashSet",
"<",
"Integer",
">",
"filter",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i",
":",
"filterThese",
")",
"filter",
".",
"(",
"i",
... | Get the non-ignored columns that are not in the filter; do not include the response.
@param filterThese remove these columns
@return an int[] of the non-ignored column indexes | [
"Get",
"the",
"non",
"-",
"ignored",
"columns",
"that",
"are",
"not",
"in",
"the",
"filter",
";",
"do",
"not",
"include",
"the",
"response",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-automl/src/main/java/ai/h2o/automl/FrameMetadata.java#L178-L187 |
131,309 | h2oai/h2o-3 | h2o-automl/src/main/java/ai/h2o/automl/FrameMetadata.java | FrameMetadata.na_FeatureCount | public long na_FeatureCount() {
if( _featsWithNa!=-1 ) return _featsWithNa;
long cnt=0;
for(int i=0;i<_cols.length;++i) {
if( !_cols[i]._ignored && !_cols[i]._response && _cols[i]._percentNA!=0) {
cnt += 1; // check if const columns along with user ignored columns are included in ignored
... | java | public long na_FeatureCount() {
if( _featsWithNa!=-1 ) return _featsWithNa;
long cnt=0;
for(int i=0;i<_cols.length;++i) {
if( !_cols[i]._ignored && !_cols[i]._response && _cols[i]._percentNA!=0) {
cnt += 1; // check if const columns along with user ignored columns are included in ignored
... | [
"public",
"long",
"na_FeatureCount",
"(",
")",
"{",
"if",
"(",
"_featsWithNa",
"!=",
"-",
"1",
")",
"return",
"_featsWithNa",
";",
"long",
"cnt",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_cols",
".",
"length",
";",
"++",
"... | count of features with nas | [
"count",
"of",
"features",
"with",
"nas"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-automl/src/main/java/ai/h2o/automl/FrameMetadata.java#L190-L200 |
131,310 | h2oai/h2o-3 | h2o-automl/src/main/java/ai/h2o/automl/FrameMetadata.java | FrameMetadata.rowsWithNa | public long rowsWithNa() {
if( _rowsWithNa!=-1 ) return _rowsWithNa;
String x = String.format("(na.omit %s)", _fr._key);
Val res = Rapids.exec(x);
Frame f = res.getFrame();
long cnt = _fr.numRows() - f.numRows();
f.delete();
return (_rowsWithNa=cnt);
} | java | public long rowsWithNa() {
if( _rowsWithNa!=-1 ) return _rowsWithNa;
String x = String.format("(na.omit %s)", _fr._key);
Val res = Rapids.exec(x);
Frame f = res.getFrame();
long cnt = _fr.numRows() - f.numRows();
f.delete();
return (_rowsWithNa=cnt);
} | [
"public",
"long",
"rowsWithNa",
"(",
")",
"{",
"if",
"(",
"_rowsWithNa",
"!=",
"-",
"1",
")",
"return",
"_rowsWithNa",
";",
"String",
"x",
"=",
"String",
".",
"format",
"(",
"\"(na.omit %s)\"",
",",
"_fr",
".",
"_key",
")",
";",
"Val",
"res",
"=",
"R... | count of rows with nas | [
"count",
"of",
"rows",
"with",
"nas"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-automl/src/main/java/ai/h2o/automl/FrameMetadata.java#L203-L212 |
131,311 | h2oai/h2o-3 | h2o-automl/src/main/java/ai/h2o/automl/FrameMetadata.java | FrameMetadata.nClass | public long nClass() {
if( _nclass!=-1 ) return _nclass;
if(_isClassification==true){
long cnt=0;
cnt = _fr.vec(_response).domain().length;
/*for(int i=0;i<_cols.length;++i) {
if(_cols[i]._response==true) cnt = _cols[i]._v.domain().length;
}*/
return(_nclass=cnt);
}else{
... | java | public long nClass() {
if( _nclass!=-1 ) return _nclass;
if(_isClassification==true){
long cnt=0;
cnt = _fr.vec(_response).domain().length;
/*for(int i=0;i<_cols.length;++i) {
if(_cols[i]._response==true) cnt = _cols[i]._v.domain().length;
}*/
return(_nclass=cnt);
}else{
... | [
"public",
"long",
"nClass",
"(",
")",
"{",
"if",
"(",
"_nclass",
"!=",
"-",
"1",
")",
"return",
"_nclass",
";",
"if",
"(",
"_isClassification",
"==",
"true",
")",
"{",
"long",
"cnt",
"=",
"0",
";",
"cnt",
"=",
"_fr",
".",
"vec",
"(",
"_response",
... | number of classes if classification problem | [
"number",
"of",
"classes",
"if",
"classification",
"problem"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-automl/src/main/java/ai/h2o/automl/FrameMetadata.java#L215-L227 |
131,312 | h2oai/h2o-3 | h2o-automl/src/main/java/ai/h2o/automl/FrameMetadata.java | FrameMetadata.isAnyNumeric | public boolean isAnyNumeric(){
int cnt =0;
for(int i=0;i<_cols.length;++i) {
if( !_cols[i]._ignored && !_cols[i]._response && _cols[i]._isNumeric) {
cnt = 1;
break;
}
}
if(cnt ==1) return true;
else return false;
} | java | public boolean isAnyNumeric(){
int cnt =0;
for(int i=0;i<_cols.length;++i) {
if( !_cols[i]._ignored && !_cols[i]._response && _cols[i]._isNumeric) {
cnt = 1;
break;
}
}
if(cnt ==1) return true;
else return false;
} | [
"public",
"boolean",
"isAnyNumeric",
"(",
")",
"{",
"int",
"cnt",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_cols",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"!",
"_cols",
"[",
"i",
"]",
".",
"_ignored",
"&&",... | checks if there are any numeric features in the frame | [
"checks",
"if",
"there",
"are",
"any",
"numeric",
"features",
"in",
"the",
"frame"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-automl/src/main/java/ai/h2o/automl/FrameMetadata.java#L230-L240 |
131,313 | h2oai/h2o-3 | h2o-automl/src/main/java/ai/h2o/automl/FrameMetadata.java | FrameMetadata.isAnyCategorical | public boolean isAnyCategorical(){
int cnt =0;
for(int i=0;i<_cols.length;++i) {
if( !_cols[i]._ignored && !_cols[i]._response && _cols[i]._isCategorical) {
cnt = 1;
break;
}
}
if(cnt ==1) return true;
else return false;
} | java | public boolean isAnyCategorical(){
int cnt =0;
for(int i=0;i<_cols.length;++i) {
if( !_cols[i]._ignored && !_cols[i]._response && _cols[i]._isCategorical) {
cnt = 1;
break;
}
}
if(cnt ==1) return true;
else return false;
} | [
"public",
"boolean",
"isAnyCategorical",
"(",
")",
"{",
"int",
"cnt",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_cols",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"!",
"_cols",
"[",
"i",
"]",
".",
"_ignored",
"... | checks if there are any categorical features in the frame | [
"checks",
"if",
"there",
"are",
"any",
"categorical",
"features",
"in",
"the",
"frame"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-automl/src/main/java/ai/h2o/automl/FrameMetadata.java#L243-L253 |
131,314 | h2oai/h2o-3 | h2o-automl/src/main/java/ai/h2o/automl/FrameMetadata.java | FrameMetadata.computeFrameMetaPass1 | public FrameMetadata computeFrameMetaPass1() {
MetaPass1[] tasks = new MetaPass1[_fr.numCols()];
for(int i=0; i<tasks.length; ++i)
tasks[i] = new MetaPass1(i,this);
_isClassification = tasks[_response]._isClassification;
MetaCollector.ParallelTasks metaCollector = new MetaCollector.ParallelTasks<>... | java | public FrameMetadata computeFrameMetaPass1() {
MetaPass1[] tasks = new MetaPass1[_fr.numCols()];
for(int i=0; i<tasks.length; ++i)
tasks[i] = new MetaPass1(i,this);
_isClassification = tasks[_response]._isClassification;
MetaCollector.ParallelTasks metaCollector = new MetaCollector.ParallelTasks<>... | [
"public",
"FrameMetadata",
"computeFrameMetaPass1",
"(",
")",
"{",
"MetaPass1",
"[",
"]",
"tasks",
"=",
"new",
"MetaPass1",
"[",
"_fr",
".",
"numCols",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tasks",
".",
"length",
";",
... | blocking call to compute 1st pass of column metadata | [
"blocking",
"call",
"to",
"compute",
"1st",
"pass",
"of",
"column",
"metadata"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-automl/src/main/java/ai/h2o/automl/FrameMetadata.java#L381-L408 |
131,315 | h2oai/h2o-3 | h2o-core/src/main/java/water/DTask.java | DTask.setException | public synchronized void setException(Throwable ex) {
if(_ex == null) {
_ex = AutoBuffer.javaSerializeWritePojo(((ex instanceof DistributedException) ? (DistributedException) ex : new DistributedException(ex,false /* don't want this setException(ex) call in the stacktrace */)));
}
} | java | public synchronized void setException(Throwable ex) {
if(_ex == null) {
_ex = AutoBuffer.javaSerializeWritePojo(((ex instanceof DistributedException) ? (DistributedException) ex : new DistributedException(ex,false /* don't want this setException(ex) call in the stacktrace */)));
}
} | [
"public",
"synchronized",
"void",
"setException",
"(",
"Throwable",
"ex",
")",
"{",
"if",
"(",
"_ex",
"==",
"null",
")",
"{",
"_ex",
"=",
"AutoBuffer",
".",
"javaSerializeWritePojo",
"(",
"(",
"(",
"ex",
"instanceof",
"DistributedException",
")",
"?",
"(",
... | Capture the first exception in _ex. Later setException attempts are ignored. | [
"Capture",
"the",
"first",
"exception",
"in",
"_ex",
".",
"Later",
"setException",
"attempts",
"are",
"ignored",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/DTask.java#L38-L42 |
131,316 | h2oai/h2o-3 | h2o-core/src/main/java/water/api/ModelMetricsHandler.java | ModelMetricsHandler.delete | @SuppressWarnings("unused") // called through reflection by RequestServer
public ModelMetricsListSchemaV3 delete(int version, ModelMetricsListSchemaV3 s) {
ModelMetricsList m = s.createAndFillImpl();
s.fillFromImpl(m.delete());
return s;
} | java | @SuppressWarnings("unused") // called through reflection by RequestServer
public ModelMetricsListSchemaV3 delete(int version, ModelMetricsListSchemaV3 s) {
ModelMetricsList m = s.createAndFillImpl();
s.fillFromImpl(m.delete());
return s;
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"// called through reflection by RequestServer",
"public",
"ModelMetricsListSchemaV3",
"delete",
"(",
"int",
"version",
",",
"ModelMetricsListSchemaV3",
"s",
")",
"{",
"ModelMetricsList",
"m",
"=",
"s",
".",
"createAndFillI... | Delete one or more ModelMetrics. | [
"Delete",
"one",
"or",
"more",
"ModelMetrics",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/api/ModelMetricsHandler.java#L228-L233 |
131,317 | h2oai/h2o-3 | h2o-core/src/main/java/water/api/ModelMetricsHandler.java | ModelMetricsHandler.make | @SuppressWarnings("unused") // called through reflection by RequestServer
public ModelMetricsMakerSchemaV3 make(int version, ModelMetricsMakerSchemaV3 s) {
// parameters checking:
if (null == s.predictions_frame) throw new H2OIllegalArgumentException("predictions_frame", "make", s.predictions_frame);
Fram... | java | @SuppressWarnings("unused") // called through reflection by RequestServer
public ModelMetricsMakerSchemaV3 make(int version, ModelMetricsMakerSchemaV3 s) {
// parameters checking:
if (null == s.predictions_frame) throw new H2OIllegalArgumentException("predictions_frame", "make", s.predictions_frame);
Fram... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"// called through reflection by RequestServer",
"public",
"ModelMetricsMakerSchemaV3",
"make",
"(",
"int",
"version",
",",
"ModelMetricsMakerSchemaV3",
"s",
")",
"{",
"// parameters checking:",
"if",
"(",
"null",
"==",
"s"... | Make a model metrics object from actual and predicted values | [
"Make",
"a",
"model",
"metrics",
"object",
"from",
"actual",
"and",
"predicted",
"values"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/api/ModelMetricsHandler.java#L298-L337 |
131,318 | h2oai/h2o-3 | h2o-core/src/main/java/water/util/JStackCollectorTask.java | JStackCollectorTask.reduce | @Override public void reduce(JStackCollectorTask that) {
for( int i=0; i<_traces.length; ++i )
if( _traces[i] == null )
_traces[i] = that._traces[i];
} | java | @Override public void reduce(JStackCollectorTask that) {
for( int i=0; i<_traces.length; ++i )
if( _traces[i] == null )
_traces[i] = that._traces[i];
} | [
"@",
"Override",
"public",
"void",
"reduce",
"(",
"JStackCollectorTask",
"that",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_traces",
".",
"length",
";",
"++",
"i",
")",
"if",
"(",
"_traces",
"[",
"i",
"]",
"==",
"null",
")",
"_t... | One per Node | [
"One",
"per",
"Node"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/util/JStackCollectorTask.java#L26-L30 |
131,319 | h2oai/h2o-3 | h2o-core/src/main/java/water/util/JStackCollectorTask.java | JStackCollectorTask.isH2OHTTPRequestThread | private int isH2OHTTPRequestThread(StackTraceElement [] elms){
for(int i = 0; i < elms.length; ++i)
if(elms[i].getClassName().equals("....JettyHTTPD$H2oDefaultServlet")) //TODO FIXME! No such class(H2oDefaultServlet) exists there now! Use class comparison if another one took the role.
return i;
re... | java | private int isH2OHTTPRequestThread(StackTraceElement [] elms){
for(int i = 0; i < elms.length; ++i)
if(elms[i].getClassName().equals("....JettyHTTPD$H2oDefaultServlet")) //TODO FIXME! No such class(H2oDefaultServlet) exists there now! Use class comparison if another one took the role.
return i;
re... | [
"private",
"int",
"isH2OHTTPRequestThread",
"(",
"StackTraceElement",
"[",
"]",
"elms",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"elms",
".",
"length",
";",
"++",
"i",
")",
"if",
"(",
"elms",
"[",
"i",
"]",
".",
"getClassName",
"(... | bruteforce search for H2O Servlet, don't call until other obvious cases were filtered out | [
"bruteforce",
"search",
"for",
"H2O",
"Servlet",
"don",
"t",
"call",
"until",
"other",
"obvious",
"cases",
"were",
"filtered",
"out"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/util/JStackCollectorTask.java#L65-L70 |
131,320 | h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/ast/prims/mungers/AstGroup.java | AstGroup.check | public static AstNumList check(long dstX, AstRoot ast) {
// Sanity check vs dst. To simplify logic, jam the 1 col/row case in as a AstNumList
AstNumList dim;
if (ast instanceof AstNumList) dim = (AstNumList) ast;
else if (ast instanceof AstNum) dim = new AstNumList(((AstNum) ast).getNum());
else th... | java | public static AstNumList check(long dstX, AstRoot ast) {
// Sanity check vs dst. To simplify logic, jam the 1 col/row case in as a AstNumList
AstNumList dim;
if (ast instanceof AstNumList) dim = (AstNumList) ast;
else if (ast instanceof AstNum) dim = new AstNumList(((AstNum) ast).getNum());
else th... | [
"public",
"static",
"AstNumList",
"check",
"(",
"long",
"dstX",
",",
"AstRoot",
"ast",
")",
"{",
"// Sanity check vs dst. To simplify logic, jam the 1 col/row case in as a AstNumList",
"AstNumList",
"dim",
";",
"if",
"(",
"ast",
"instanceof",
"AstNumList",
")",
"dim",
... | Argument check helper | [
"Argument",
"check",
"helper"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/ast/prims/mungers/AstGroup.java#L419-L430 |
131,321 | h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/ast/prims/mungers/AstGroup.java | AstGroup.doGroups | public static IcedHashMap<G, String> doGroups(Frame fr, int[] gbCols, AGG[] aggs) {
return doGroups(fr, gbCols, aggs, false);
} | java | public static IcedHashMap<G, String> doGroups(Frame fr, int[] gbCols, AGG[] aggs) {
return doGroups(fr, gbCols, aggs, false);
} | [
"public",
"static",
"IcedHashMap",
"<",
"G",
",",
"String",
">",
"doGroups",
"(",
"Frame",
"fr",
",",
"int",
"[",
"]",
"gbCols",
",",
"AGG",
"[",
"]",
"aggs",
")",
"{",
"return",
"doGroups",
"(",
"fr",
",",
"gbCols",
",",
"aggs",
",",
"false",
")",... | results using 'aggs'. Return an array of groups, with the aggregate results. | [
"results",
"using",
"aggs",
".",
"Return",
"an",
"array",
"of",
"groups",
"with",
"the",
"aggregate",
"results",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/ast/prims/mungers/AstGroup.java#L435-L437 |
131,322 | h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/ast/prims/mungers/AstGroup.java | AstGroup.buildOutput | public static Frame buildOutput(int[] gbCols, int noutCols, Frame fr, String[] fcnames, int ngrps, MRTask mrfill) {
// Build the output!
// the names of columns
final int nCols = gbCols.length + noutCols;
String[] names = new String[nCols];
String[][] domains = new String[nCols][];
byte[] types... | java | public static Frame buildOutput(int[] gbCols, int noutCols, Frame fr, String[] fcnames, int ngrps, MRTask mrfill) {
// Build the output!
// the names of columns
final int nCols = gbCols.length + noutCols;
String[] names = new String[nCols];
String[][] domains = new String[nCols][];
byte[] types... | [
"public",
"static",
"Frame",
"buildOutput",
"(",
"int",
"[",
"]",
"gbCols",
",",
"int",
"noutCols",
",",
"Frame",
"fr",
",",
"String",
"[",
"]",
"fcnames",
",",
"int",
"ngrps",
",",
"MRTask",
"mrfill",
")",
"{",
"// Build the output!",
"// the names of colum... | Build output frame from the multi-column results | [
"Build",
"output",
"frame",
"from",
"the",
"multi",
"-",
"column",
"results"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/ast/prims/mungers/AstGroup.java#L453-L475 |
131,323 | h2oai/h2o-3 | h2o-core/src/main/java/water/fvec/RollupStatsHelpers.java | RollupStatsHelpers.numericChunkRollup | public long numericChunkRollup(Chunk c, long start, long checksum) {
long pinfs=0, ninfs=0, naCnt=0, nzCnt=0;
// pull (some) members into local variables for speed
boolean isInt = _rs._isInt;
boolean hasNA = c.hasNA();
boolean hasFloat = c.hasFloat();
double dmin = _rs._mins[_rs._mins.length-1];... | java | public long numericChunkRollup(Chunk c, long start, long checksum) {
long pinfs=0, ninfs=0, naCnt=0, nzCnt=0;
// pull (some) members into local variables for speed
boolean isInt = _rs._isInt;
boolean hasNA = c.hasNA();
boolean hasFloat = c.hasFloat();
double dmin = _rs._mins[_rs._mins.length-1];... | [
"public",
"long",
"numericChunkRollup",
"(",
"Chunk",
"c",
",",
"long",
"start",
",",
"long",
"checksum",
")",
"{",
"long",
"pinfs",
"=",
"0",
",",
"ninfs",
"=",
"0",
",",
"naCnt",
"=",
"0",
",",
"nzCnt",
"=",
"0",
";",
"// pull (some) members into local... | MASTER TEMPLATE - All methods below are COPY & PASTED from this template, and some optimizations are performed based on the chunk types
@param c
@param start
@param checksum
@return | [
"MASTER",
"TEMPLATE",
"-",
"All",
"methods",
"below",
"are",
"COPY",
"&",
"PASTED",
"from",
"this",
"template",
"and",
"some",
"optimizations",
"are",
"performed",
"based",
"on",
"the",
"chunk",
"types"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/fvec/RollupStatsHelpers.java#L21-L70 |
131,324 | h2oai/h2o-3 | h2o-core/src/main/java/water/api/JobsHandler.java | JobsHandler.list | @SuppressWarnings("unused") // called through reflection by RequestServer
public JobsV3 list(int version, JobsV3 s) {
Job[] jobs = Job.jobs();
// Jobs j = new Jobs();
// j._jobs = Job.jobs();
// PojoUtils.copyProperties(s, j, PojoUtils.FieldNaming.ORIGIN_HAS_UNDERSCORES);
s.jobs = new JobV3[jobs.l... | java | @SuppressWarnings("unused") // called through reflection by RequestServer
public JobsV3 list(int version, JobsV3 s) {
Job[] jobs = Job.jobs();
// Jobs j = new Jobs();
// j._jobs = Job.jobs();
// PojoUtils.copyProperties(s, j, PojoUtils.FieldNaming.ORIGIN_HAS_UNDERSCORES);
s.jobs = new JobV3[jobs.l... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"// called through reflection by RequestServer",
"public",
"JobsV3",
"list",
"(",
"int",
"version",
",",
"JobsV3",
"s",
")",
"{",
"Job",
"[",
"]",
"jobs",
"=",
"Job",
".",
"jobs",
"(",
")",
";",
"// Jobs j = new... | Impl class for a collection of jobs; only used in the API to make it easier to cons up the jobs array via the magic of PojoUtils.copyProperties. | [
"Impl",
"class",
"for",
"a",
"collection",
"of",
"jobs",
";",
"only",
"used",
"in",
"the",
"API",
"to",
"make",
"it",
"easier",
"to",
"cons",
"up",
"the",
"jobs",
"array",
"via",
"the",
"magic",
"of",
"PojoUtils",
".",
"copyProperties",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/api/JobsHandler.java#L13-L29 |
131,325 | h2oai/h2o-3 | h2o-core/src/main/java/water/fvec/SubsetVec.java | SubsetVec.chunkForChunkIdx | @Override public Chunk chunkForChunkIdx(int cidx) {
Chunk crows = rows().chunkForChunkIdx(cidx);
return new SubsetChunk(crows,this,masterVec());
} | java | @Override public Chunk chunkForChunkIdx(int cidx) {
Chunk crows = rows().chunkForChunkIdx(cidx);
return new SubsetChunk(crows,this,masterVec());
} | [
"@",
"Override",
"public",
"Chunk",
"chunkForChunkIdx",
"(",
"int",
"cidx",
")",
"{",
"Chunk",
"crows",
"=",
"rows",
"(",
")",
".",
"chunkForChunkIdx",
"(",
"cidx",
")",
";",
"return",
"new",
"SubsetChunk",
"(",
"crows",
",",
"this",
",",
"masterVec",
"(... | A subset chunk | [
"A",
"subset",
"chunk"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/fvec/SubsetVec.java#L21-L24 |
131,326 | h2oai/h2o-3 | h2o-persist-s3/src/main/java/water/persist/PersistS3.java | PersistS3.encodeKey | public static Key encodeKey(String bucket, String key) {
Key res = encodeKeyImpl(bucket, key);
// assert checkBijection(res, bucket, key);
return res;
} | java | public static Key encodeKey(String bucket, String key) {
Key res = encodeKeyImpl(bucket, key);
// assert checkBijection(res, bucket, key);
return res;
} | [
"public",
"static",
"Key",
"encodeKey",
"(",
"String",
"bucket",
",",
"String",
"key",
")",
"{",
"Key",
"res",
"=",
"encodeKeyImpl",
"(",
"bucket",
",",
"key",
")",
";",
"// assert checkBijection(res, bucket, key);",
"return",
"res",
";",
"}"
] | Creates the key for given S3 bucket and key. Returns the H2O key, or null if the key cannot be
created.
@param bucket
Bucket name
@param key
Key name (S3)
@return H2O key pointing to the given bucket and key. | [
"Creates",
"the",
"key",
"for",
"given",
"S3",
"bucket",
"and",
"key",
".",
"Returns",
"the",
"H2O",
"key",
"or",
"null",
"if",
"the",
"key",
"cannot",
"be",
"created",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-persist-s3/src/main/java/water/persist/PersistS3.java#L279-L283 |
131,327 | h2oai/h2o-3 | h2o-persist-s3/src/main/java/water/persist/PersistS3.java | PersistS3.decodePath | private static String [] decodePath(String s) {
assert s.startsWith(KEY_PREFIX) && s.indexOf('/') >= 0 : "Attempting to decode non s3 key: " + s;
s = s.substring(KEY_PREFIX_LEN);
int dlm = s.indexOf('/');
if(dlm < 0) return new String[]{s,null};
String bucket = s.substring(0, dlm);
String key = ... | java | private static String [] decodePath(String s) {
assert s.startsWith(KEY_PREFIX) && s.indexOf('/') >= 0 : "Attempting to decode non s3 key: " + s;
s = s.substring(KEY_PREFIX_LEN);
int dlm = s.indexOf('/');
if(dlm < 0) return new String[]{s,null};
String bucket = s.substring(0, dlm);
String key = ... | [
"private",
"static",
"String",
"[",
"]",
"decodePath",
"(",
"String",
"s",
")",
"{",
"assert",
"s",
".",
"startsWith",
"(",
"KEY_PREFIX",
")",
"&&",
"s",
".",
"indexOf",
"(",
"'",
"'",
")",
">=",
"0",
":",
"\"Attempting to decode non s3 key: \"",
"+",
"s... | Decompose S3 name into bucket name and key name
@param s generic s3 path (e.g., "s3://bucketname/my/directory/file.ext")
@return array of { bucket name, key } | [
"Decompose",
"S3",
"name",
"into",
"bucket",
"name",
"and",
"key",
"name"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-persist-s3/src/main/java/water/persist/PersistS3.java#L321-L329 |
131,328 | h2oai/h2o-3 | h2o-persist-s3/src/main/java/water/persist/PersistS3.java | PersistS3.getObjectForKey | private static S3Object getObjectForKey(Key k, long offset, long length) throws IOException {
String[] bk = decodeKey(k);
GetObjectRequest r = new GetObjectRequest(bk[0], bk[1]);
r.setRange(offset, offset + length - 1); // Range is *inclusive* according to docs???
return getClient().getObject(r);
} | java | private static S3Object getObjectForKey(Key k, long offset, long length) throws IOException {
String[] bk = decodeKey(k);
GetObjectRequest r = new GetObjectRequest(bk[0], bk[1]);
r.setRange(offset, offset + length - 1); // Range is *inclusive* according to docs???
return getClient().getObject(r);
} | [
"private",
"static",
"S3Object",
"getObjectForKey",
"(",
"Key",
"k",
",",
"long",
"offset",
",",
"long",
"length",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"bk",
"=",
"decodeKey",
"(",
"k",
")",
";",
"GetObjectRequest",
"r",
"=",
"new",
"Ge... | Gets the S3 object associated with the key that can read length bytes from offset | [
"Gets",
"the",
"S3",
"object",
"associated",
"with",
"the",
"key",
"that",
"can",
"read",
"length",
"bytes",
"from",
"offset"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-persist-s3/src/main/java/water/persist/PersistS3.java#L336-L341 |
131,329 | h2oai/h2o-3 | h2o-persist-s3/src/main/java/water/persist/PersistS3.java | PersistS3.getObjectMetadataForKey | private static ObjectMetadata getObjectMetadataForKey(Key k) {
String[] bk = decodeKey(k);
assert (bk.length == 2);
return getClient().getObjectMetadata(bk[0], bk[1]);
} | java | private static ObjectMetadata getObjectMetadataForKey(Key k) {
String[] bk = decodeKey(k);
assert (bk.length == 2);
return getClient().getObjectMetadata(bk[0], bk[1]);
} | [
"private",
"static",
"ObjectMetadata",
"getObjectMetadataForKey",
"(",
"Key",
"k",
")",
"{",
"String",
"[",
"]",
"bk",
"=",
"decodeKey",
"(",
"k",
")",
";",
"assert",
"(",
"bk",
".",
"length",
"==",
"2",
")",
";",
"return",
"getClient",
"(",
")",
".",
... | Gets the object metadata associated with given key. | [
"Gets",
"the",
"object",
"metadata",
"associated",
"with",
"given",
"key",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-persist-s3/src/main/java/water/persist/PersistS3.java#L344-L348 |
131,330 | h2oai/h2o-3 | h2o-algos/src/main/java/hex/tree/TreeVisitor.java | TreeVisitor.leaf2 | private void leaf2( int mask ) throws T {
assert (mask==0 || ( (mask&16)==16 && (mask&32)==32) ) : "Unknown mask: " + mask; // Is a leaf or a special leaf on the top of tree
leaf(_ts.get4f());
} | java | private void leaf2( int mask ) throws T {
assert (mask==0 || ( (mask&16)==16 && (mask&32)==32) ) : "Unknown mask: " + mask; // Is a leaf or a special leaf on the top of tree
leaf(_ts.get4f());
} | [
"private",
"void",
"leaf2",
"(",
"int",
"mask",
")",
"throws",
"T",
"{",
"assert",
"(",
"mask",
"==",
"0",
"||",
"(",
"(",
"mask",
"&",
"16",
")",
"==",
"16",
"&&",
"(",
"mask",
"&",
"32",
")",
"==",
"32",
")",
")",
":",
"\"Unknown mask: \"",
"... | Call either the single-class leaf or the full-prediction leaf | [
"Call",
"either",
"the",
"single",
"-",
"class",
"leaf",
"or",
"the",
"full",
"-",
"prediction",
"leaf"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-algos/src/main/java/hex/tree/TreeVisitor.java#L31-L34 |
131,331 | h2oai/h2o-3 | h2o-core/src/main/java/water/fvec/ByteVec.java | ByteVec.getPreviewChunkBytes | public byte[] getPreviewChunkBytes(int chkIdx) {
if (chkIdx >= nChunks())
throw new H2OIllegalArgumentException("Asked for chunk index beyond the number of chunks.");
if (chkIdx == 0)
return chunkForChunkIdx(chkIdx)._mem;
else { //must eat partial lines
// FIXME: a hack to consume partial ... | java | public byte[] getPreviewChunkBytes(int chkIdx) {
if (chkIdx >= nChunks())
throw new H2OIllegalArgumentException("Asked for chunk index beyond the number of chunks.");
if (chkIdx == 0)
return chunkForChunkIdx(chkIdx)._mem;
else { //must eat partial lines
// FIXME: a hack to consume partial ... | [
"public",
"byte",
"[",
"]",
"getPreviewChunkBytes",
"(",
"int",
"chkIdx",
")",
"{",
"if",
"(",
"chkIdx",
">=",
"nChunks",
"(",
")",
")",
"throw",
"new",
"H2OIllegalArgumentException",
"(",
"\"Asked for chunk index beyond the number of chunks.\"",
")",
";",
"if",
"... | Get all the bytes of a given chunk.
Useful for previewing sections of files.
@param chkIdx index of desired chunk
@return array of initial bytes | [
"Get",
"all",
"the",
"bytes",
"of",
"a",
"given",
"chunk",
".",
"Useful",
"for",
"previewing",
"sections",
"of",
"files",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/fvec/ByteVec.java#L40-L54 |
131,332 | h2oai/h2o-3 | h2o-core/src/main/java/hex/AUC2.java | AUC2.checkRecallValidity | void checkRecallValidity() {
double x0 = recall.exec(this, 0);
for (int i = 1; i < _nBins; i++) {
double x1 = recall.exec(this, i);
if (x0 > x1)
throw new H2OIllegalArgumentException(String.valueOf(i), "recall", x0 + " > " + x1);
x0 = x1;
}
} | java | void checkRecallValidity() {
double x0 = recall.exec(this, 0);
for (int i = 1; i < _nBins; i++) {
double x1 = recall.exec(this, i);
if (x0 > x1)
throw new H2OIllegalArgumentException(String.valueOf(i), "recall", x0 + " > " + x1);
x0 = x1;
}
} | [
"void",
"checkRecallValidity",
"(",
")",
"{",
"double",
"x0",
"=",
"recall",
".",
"exec",
"(",
"this",
",",
"0",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"_nBins",
";",
"i",
"++",
")",
"{",
"double",
"x1",
"=",
"recall",
".",
... | Checks that recall is a non-decreasing function | [
"Checks",
"that",
"recall",
"is",
"a",
"non",
"-",
"decreasing",
"function"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/hex/AUC2.java#L191-L199 |
131,333 | h2oai/h2o-3 | h2o-core/src/main/java/hex/AUC2.java | AUC2.compute_auc | private double compute_auc() {
if (_fps[_nBins-1] == 0) return 1.0; //special case
if (_tps[_nBins-1] == 0) return 0.0; //special case
// All math is computed scaled by TP and FP. We'll descale once at the
// end. Trapezoids from (tps[i-1],fps[i-1]) to (tps[i],fps[i])
double tp0 = 0, fp0 = 0;
... | java | private double compute_auc() {
if (_fps[_nBins-1] == 0) return 1.0; //special case
if (_tps[_nBins-1] == 0) return 0.0; //special case
// All math is computed scaled by TP and FP. We'll descale once at the
// end. Trapezoids from (tps[i-1],fps[i-1]) to (tps[i],fps[i])
double tp0 = 0, fp0 = 0;
... | [
"private",
"double",
"compute_auc",
"(",
")",
"{",
"if",
"(",
"_fps",
"[",
"_nBins",
"-",
"1",
"]",
"==",
"0",
")",
"return",
"1.0",
";",
"//special case",
"if",
"(",
"_tps",
"[",
"_nBins",
"-",
"1",
"]",
"==",
"0",
")",
"return",
"0.0",
";",
"//... | points. TPR and FPR are monotonically increasing from 0 to 1. | [
"points",
".",
"TPR",
"and",
"FPR",
"are",
"monotonically",
"increasing",
"from",
"0",
"to",
"1",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/hex/AUC2.java#L203-L217 |
131,334 | h2oai/h2o-3 | h2o-core/src/main/java/hex/AUC2.java | AUC2.buildCM | public double[/*actual*/][/*predicted*/] buildCM( int idx ) {
// \ predicted: 0 1
// actual 0: TN FP
// 1: FN TP
return new double[][]{{tn(idx),fp(idx)},{fn(idx),tp(idx)}};
} | java | public double[/*actual*/][/*predicted*/] buildCM( int idx ) {
// \ predicted: 0 1
// actual 0: TN FP
// 1: FN TP
return new double[][]{{tn(idx),fp(idx)},{fn(idx),tp(idx)}};
} | [
"public",
"double",
"[",
"/*actual*/",
"]",
"[",
"/*predicted*/",
"]",
"buildCM",
"(",
"int",
"idx",
")",
"{",
"// \\ predicted: 0 1",
"// actual 0: TN FP",
"// 1: FN TP",
"return",
"new",
"double",
"[",
"]",
"[",
"]",
"{",
"{",
"tn",
"(",
... | Build a CM for a threshold index. - typed as doubles because of double observation weights | [
"Build",
"a",
"CM",
"for",
"a",
"threshold",
"index",
".",
"-",
"typed",
"as",
"doubles",
"because",
"of",
"double",
"observation",
"weights"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/hex/AUC2.java#L220-L225 |
131,335 | h2oai/h2o-3 | h2o-core/src/main/java/water/util/FrameUtils.java | FrameUtils.parseFrame | public static Frame parseFrame(Key okey, URI ...uris) throws IOException {
return parseFrame(okey, null, uris);
} | java | public static Frame parseFrame(Key okey, URI ...uris) throws IOException {
return parseFrame(okey, null, uris);
} | [
"public",
"static",
"Frame",
"parseFrame",
"(",
"Key",
"okey",
",",
"URI",
"...",
"uris",
")",
"throws",
"IOException",
"{",
"return",
"parseFrame",
"(",
"okey",
",",
"null",
",",
"uris",
")",
";",
"}"
] | Parse given set of URIs and produce a frame's key representing output.
@param okey key for ouput frame. Can be null
@param uris array of URI (file://, hdfs://, s3n://, s3a://, s3://, http://, https:// ...) to parse
@return a frame which is saved into DKV under okey
@throws IOException in case of parse error. | [
"Parse",
"given",
"set",
"of",
"URIs",
"and",
"produce",
"a",
"frame",
"s",
"key",
"representing",
"output",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/util/FrameUtils.java#L53-L55 |
131,336 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeMojoModel.java | SharedTreeMojoModel._computeGraph | public SharedTreeGraph _computeGraph(int treeToPrint) {
SharedTreeGraph g = new SharedTreeGraph();
if (treeToPrint >= _ntree_groups) {
throw new IllegalArgumentException("Tree " + treeToPrint + " does not exist (max " + _ntree_groups + ")");
}
int j;
if (treeToPrint... | java | public SharedTreeGraph _computeGraph(int treeToPrint) {
SharedTreeGraph g = new SharedTreeGraph();
if (treeToPrint >= _ntree_groups) {
throw new IllegalArgumentException("Tree " + treeToPrint + " does not exist (max " + _ntree_groups + ")");
}
int j;
if (treeToPrint... | [
"public",
"SharedTreeGraph",
"_computeGraph",
"(",
"int",
"treeToPrint",
")",
"{",
"SharedTreeGraph",
"g",
"=",
"new",
"SharedTreeGraph",
"(",
")",
";",
"if",
"(",
"treeToPrint",
">=",
"_ntree_groups",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"... | Compute a graph of the forest.
@return A graph of the forest. | [
"Compute",
"a",
"graph",
"of",
"the",
"forest",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeMojoModel.java#L434-L465 |
131,337 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeMojoModel.java | SharedTreeMojoModel.scoreAllTrees | protected void scoreAllTrees(double[] row, double[] preds) {
java.util.Arrays.fill(preds, 0);
scoreTreeRange(row, 0, _ntree_groups, preds);
} | java | protected void scoreAllTrees(double[] row, double[] preds) {
java.util.Arrays.fill(preds, 0);
scoreTreeRange(row, 0, _ntree_groups, preds);
} | [
"protected",
"void",
"scoreAllTrees",
"(",
"double",
"[",
"]",
"row",
",",
"double",
"[",
"]",
"preds",
")",
"{",
"java",
".",
"util",
".",
"Arrays",
".",
"fill",
"(",
"preds",
",",
"0",
")",
";",
"scoreTreeRange",
"(",
"row",
",",
"0",
",",
"_ntre... | Score all trees and fill in the `preds` array. | [
"Score",
"all",
"trees",
"and",
"fill",
"in",
"the",
"preds",
"array",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeMojoModel.java#L664-L667 |
131,338 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeMojoModel.java | SharedTreeMojoModel.scoreTree0 | @SuppressWarnings("ConstantConditions") // Complains that the code is too complex. Well duh!
public static double scoreTree0(byte[] tree, double[] row, boolean computeLeafAssignment) {
ByteBufferWrapper ab = new ByteBufferWrapper(tree);
GenmodelBitSet bs = null; // Lazily set on hitting first group test
... | java | @SuppressWarnings("ConstantConditions") // Complains that the code is too complex. Well duh!
public static double scoreTree0(byte[] tree, double[] row, boolean computeLeafAssignment) {
ByteBufferWrapper ab = new ByteBufferWrapper(tree);
GenmodelBitSet bs = null; // Lazily set on hitting first group test
... | [
"@",
"SuppressWarnings",
"(",
"\"ConstantConditions\"",
")",
"// Complains that the code is too complex. Well duh!",
"public",
"static",
"double",
"scoreTree0",
"(",
"byte",
"[",
"]",
"tree",
",",
"double",
"[",
"]",
"row",
",",
"boolean",
"computeLeafAssignment",
")",
... | SET IN STONE FOR MOJO VERSION "1.00" - DO NOT CHANGE
@param tree
@param row
@param computeLeafAssignment
@return | [
"SET",
"IN",
"STONE",
"FOR",
"MOJO",
"VERSION",
"1",
".",
"00",
"-",
"DO",
"NOT",
"CHANGE"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeMojoModel.java#L798-L861 |
131,339 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java | EasyPredictModelWrapper.predict | public AbstractPrediction predict(RowData data, ModelCategory mc) throws PredictException {
switch (mc) {
case AutoEncoder:
return predictAutoEncoder(data);
case Binomial:
return predictBinomial(data);
case Multinomial:
return predictMultinomial(data);
case Ordinal:
... | java | public AbstractPrediction predict(RowData data, ModelCategory mc) throws PredictException {
switch (mc) {
case AutoEncoder:
return predictAutoEncoder(data);
case Binomial:
return predictBinomial(data);
case Multinomial:
return predictMultinomial(data);
case Ordinal:
... | [
"public",
"AbstractPrediction",
"predict",
"(",
"RowData",
"data",
",",
"ModelCategory",
"mc",
")",
"throws",
"PredictException",
"{",
"switch",
"(",
"mc",
")",
"{",
"case",
"AutoEncoder",
":",
"return",
"predictAutoEncoder",
"(",
"data",
")",
";",
"case",
"Bi... | Make a prediction on a new data point.
The type of prediction returned depends on the model type.
The caller needs to know what type of prediction to expect.
This call is convenient for generically automating model deployment.
For specific applications (where the kind of model is known and doesn't change), it is reco... | [
"Make",
"a",
"prediction",
"on",
"a",
"new",
"data",
"point",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java#L332-L358 |
131,340 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java | EasyPredictModelWrapper.predictAutoEncoder | public AutoEncoderModelPrediction predictAutoEncoder(RowData data) throws PredictException {
validateModelCategory(ModelCategory.AutoEncoder);
int size = m.getPredsSize(ModelCategory.AutoEncoder);
double[] output = new double[size];
double[] rawData = nanArray(m.nfeatures());
rawData = fillRawData(... | java | public AutoEncoderModelPrediction predictAutoEncoder(RowData data) throws PredictException {
validateModelCategory(ModelCategory.AutoEncoder);
int size = m.getPredsSize(ModelCategory.AutoEncoder);
double[] output = new double[size];
double[] rawData = nanArray(m.nfeatures());
rawData = fillRawData(... | [
"public",
"AutoEncoderModelPrediction",
"predictAutoEncoder",
"(",
"RowData",
"data",
")",
"throws",
"PredictException",
"{",
"validateModelCategory",
"(",
"ModelCategory",
".",
"AutoEncoder",
")",
";",
"int",
"size",
"=",
"m",
".",
"getPredsSize",
"(",
"ModelCategory... | Make a prediction on a new data point using an AutoEncoder model.
@param data A new data point.
@return The prediction.
@throws PredictException | [
"Make",
"a",
"prediction",
"on",
"a",
"new",
"data",
"point",
"using",
"an",
"AutoEncoder",
"model",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java#L370-L388 |
131,341 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java | EasyPredictModelWrapper.expandRawData | private double[] expandRawData(double[] data, int size) {
double[] expanded = new double[size];
int pos = 0;
for (int i = 0; i < data.length; i++) {
if (m._domains[i] == null) {
expanded[pos] = data[i];
pos++;
} else {
int idx = Double.isNaN(data[i]) ? m._domains[i].lengt... | java | private double[] expandRawData(double[] data, int size) {
double[] expanded = new double[size];
int pos = 0;
for (int i = 0; i < data.length; i++) {
if (m._domains[i] == null) {
expanded[pos] = data[i];
pos++;
} else {
int idx = Double.isNaN(data[i]) ? m._domains[i].lengt... | [
"private",
"double",
"[",
"]",
"expandRawData",
"(",
"double",
"[",
"]",
"data",
",",
"int",
"size",
")",
"{",
"double",
"[",
"]",
"expanded",
"=",
"new",
"double",
"[",
"size",
"]",
";",
"int",
"pos",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
... | Creates a 1-hot encoded representation of the input data.
@param data raw input as seen by the score0 function
@param size target size of the output array
@return 1-hot encoded data | [
"Creates",
"a",
"1",
"-",
"hot",
"encoded",
"representation",
"of",
"the",
"input",
"data",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java#L396-L410 |
131,342 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java | EasyPredictModelWrapper.reconstructedToRowData | private RowData reconstructedToRowData(double[] reconstructed) {
RowData rd = new RowData();
int pos = 0;
for (int i = 0; i < m.nfeatures(); i++) {
Object value;
if (m._domains[i] == null) {
value = reconstructed[pos++];
} else {
value = catValuesAsMap(m._domains[i], recons... | java | private RowData reconstructedToRowData(double[] reconstructed) {
RowData rd = new RowData();
int pos = 0;
for (int i = 0; i < m.nfeatures(); i++) {
Object value;
if (m._domains[i] == null) {
value = reconstructed[pos++];
} else {
value = catValuesAsMap(m._domains[i], recons... | [
"private",
"RowData",
"reconstructedToRowData",
"(",
"double",
"[",
"]",
"reconstructed",
")",
"{",
"RowData",
"rd",
"=",
"new",
"RowData",
"(",
")",
";",
"int",
"pos",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m",
".",
"nfea... | Converts output of AutoEncoder to a RowData structure. Categorical fields are represented by
a map of domain values -> reconstructed values, missing domain value is represented by a 'null' key
@param reconstructed raw output of AutoEncoder
@return reconstructed RowData structure | [
"Converts",
"output",
"of",
"AutoEncoder",
"to",
"a",
"RowData",
"structure",
".",
"Categorical",
"fields",
"are",
"represented",
"by",
"a",
"map",
"of",
"domain",
"values",
"-",
">",
"reconstructed",
"values",
"missing",
"domain",
"value",
"is",
"represented",
... | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java#L418-L432 |
131,343 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java | EasyPredictModelWrapper.predictMultinomial | public MultinomialModelPrediction predictMultinomial(RowData data, double offset) throws PredictException {
double[] preds = preamble(ModelCategory.Multinomial, data, offset);
MultinomialModelPrediction p = new MultinomialModelPrediction();
if (enableLeafAssignment) { // only get leaf node assignment if en... | java | public MultinomialModelPrediction predictMultinomial(RowData data, double offset) throws PredictException {
double[] preds = preamble(ModelCategory.Multinomial, data, offset);
MultinomialModelPrediction p = new MultinomialModelPrediction();
if (enableLeafAssignment) { // only get leaf node assignment if en... | [
"public",
"MultinomialModelPrediction",
"predictMultinomial",
"(",
"RowData",
"data",
",",
"double",
"offset",
")",
"throws",
"PredictException",
"{",
"double",
"[",
"]",
"preds",
"=",
"preamble",
"(",
"ModelCategory",
".",
"Multinomial",
",",
"data",
",",
"offset... | Make a prediction on a new data point using a Multinomial model.
@param data A new data point.
@param offset Prediction offset
@return The prediction.
@throws PredictException | [
"Make",
"a",
"prediction",
"on",
"a",
"new",
"data",
"point",
"using",
"a",
"Multinomial",
"model",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java#L603-L623 |
131,344 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java | EasyPredictModelWrapper.predictOrdinal | public OrdinalModelPrediction predictOrdinal(RowData data, double offset) throws PredictException {
double[] preds = preamble(ModelCategory.Ordinal, data, offset);
OrdinalModelPrediction p = new OrdinalModelPrediction();
p.classProbabilities = new double[m.getNumResponseClasses()];
p.labelIndex = (int)... | java | public OrdinalModelPrediction predictOrdinal(RowData data, double offset) throws PredictException {
double[] preds = preamble(ModelCategory.Ordinal, data, offset);
OrdinalModelPrediction p = new OrdinalModelPrediction();
p.classProbabilities = new double[m.getNumResponseClasses()];
p.labelIndex = (int)... | [
"public",
"OrdinalModelPrediction",
"predictOrdinal",
"(",
"RowData",
"data",
",",
"double",
"offset",
")",
"throws",
"PredictException",
"{",
"double",
"[",
"]",
"preds",
"=",
"preamble",
"(",
"ModelCategory",
".",
"Ordinal",
",",
"data",
",",
"offset",
")",
... | Make a prediction on a new data point using a Ordinal model.
@param data A new data point.
@param offset Prediction offset
@return The prediction.
@throws PredictException | [
"Make",
"a",
"prediction",
"on",
"a",
"new",
"data",
"point",
"using",
"a",
"Ordinal",
"model",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java#L644-L655 |
131,345 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java | EasyPredictModelWrapper.sortByDescendingClassProbability | private SortedClassProbability[] sortByDescendingClassProbability(String[] domainValues, double[] classProbabilities) {
assert (classProbabilities.length == domainValues.length);
SortedClassProbability[] arr = new SortedClassProbability[domainValues.length];
for (int i = 0; i < domainValues.length; i++) {
... | java | private SortedClassProbability[] sortByDescendingClassProbability(String[] domainValues, double[] classProbabilities) {
assert (classProbabilities.length == domainValues.length);
SortedClassProbability[] arr = new SortedClassProbability[domainValues.length];
for (int i = 0; i < domainValues.length; i++) {
... | [
"private",
"SortedClassProbability",
"[",
"]",
"sortByDescendingClassProbability",
"(",
"String",
"[",
"]",
"domainValues",
",",
"double",
"[",
"]",
"classProbabilities",
")",
"{",
"assert",
"(",
"classProbabilities",
".",
"length",
"==",
"domainValues",
".",
"lengt... | Sort in descending order. | [
"Sort",
"in",
"descending",
"order",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java#L660-L670 |
131,346 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java | EasyPredictModelWrapper.sortByDescendingClassProbability | public SortedClassProbability[] sortByDescendingClassProbability(BinomialModelPrediction p) {
String[] domainValues = m.getDomainValues(m.getResponseIdx());
double[] classProbabilities = p.classProbabilities;
return sortByDescendingClassProbability(domainValues, classProbabilities);
} | java | public SortedClassProbability[] sortByDescendingClassProbability(BinomialModelPrediction p) {
String[] domainValues = m.getDomainValues(m.getResponseIdx());
double[] classProbabilities = p.classProbabilities;
return sortByDescendingClassProbability(domainValues, classProbabilities);
} | [
"public",
"SortedClassProbability",
"[",
"]",
"sortByDescendingClassProbability",
"(",
"BinomialModelPrediction",
"p",
")",
"{",
"String",
"[",
"]",
"domainValues",
"=",
"m",
".",
"getDomainValues",
"(",
"m",
".",
"getResponseIdx",
"(",
")",
")",
";",
"double",
... | A helper function to return an array of binomial class probabilities for a prediction in sorted order.
The returned array has the most probable class in position 0.
@param p The prediction.
@return An array with sorted class probabilities. | [
"A",
"helper",
"function",
"to",
"return",
"an",
"array",
"of",
"binomial",
"class",
"probabilities",
"for",
"a",
"prediction",
"in",
"sorted",
"order",
".",
"The",
"returned",
"array",
"has",
"the",
"most",
"probable",
"class",
"in",
"position",
"0",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java#L679-L683 |
131,347 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java | EasyPredictModelWrapper.predictClustering | public ClusteringModelPrediction predictClustering(RowData data) throws PredictException {
ClusteringModelPrediction p = new ClusteringModelPrediction();
if (useExtendedOutput && (m instanceof IClusteringModel)) {
IClusteringModel cm = (IClusteringModel) m;
// setup raw input
double[] rawData ... | java | public ClusteringModelPrediction predictClustering(RowData data) throws PredictException {
ClusteringModelPrediction p = new ClusteringModelPrediction();
if (useExtendedOutput && (m instanceof IClusteringModel)) {
IClusteringModel cm = (IClusteringModel) m;
// setup raw input
double[] rawData ... | [
"public",
"ClusteringModelPrediction",
"predictClustering",
"(",
"RowData",
"data",
")",
"throws",
"PredictException",
"{",
"ClusteringModelPrediction",
"p",
"=",
"new",
"ClusteringModelPrediction",
"(",
")",
";",
"if",
"(",
"useExtendedOutput",
"&&",
"(",
"m",
"insta... | Make a prediction on a new data point using a Clustering model.
@param data A new data point.
@return The prediction.
@throws PredictException | [
"Make",
"a",
"prediction",
"on",
"a",
"new",
"data",
"point",
"using",
"a",
"Clustering",
"model",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java#L693-L710 |
131,348 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java | EasyPredictModelWrapper.predictRegression | public RegressionModelPrediction predictRegression(RowData data, double offset) throws PredictException {
double[] preds = preamble(ModelCategory.Regression, data, offset);
RegressionModelPrediction p = new RegressionModelPrediction();
if (enableLeafAssignment) { // only get leaf node assignment if enabled... | java | public RegressionModelPrediction predictRegression(RowData data, double offset) throws PredictException {
double[] preds = preamble(ModelCategory.Regression, data, offset);
RegressionModelPrediction p = new RegressionModelPrediction();
if (enableLeafAssignment) { // only get leaf node assignment if enabled... | [
"public",
"RegressionModelPrediction",
"predictRegression",
"(",
"RowData",
"data",
",",
"double",
"offset",
")",
"throws",
"PredictException",
"{",
"double",
"[",
"]",
"preds",
"=",
"preamble",
"(",
"ModelCategory",
".",
"Regression",
",",
"data",
",",
"offset",
... | Make a prediction on a new data point using a Regression model.
@param data A new data point.
@param offset Prediction offset
@return The prediction.
@throws PredictException | [
"Make",
"a",
"prediction",
"on",
"a",
"new",
"data",
"point",
"using",
"a",
"Regression",
"model",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/easy/EasyPredictModelWrapper.java#L731-L752 |
131,349 | h2oai/h2o-3 | h2o-algos/src/main/java/hex/deepwater/DeepWater.java | DeepWater.haveBackend | public static boolean haveBackend() {
for (DeepWaterParameters.Backend b : DeepWaterParameters.Backend.values()) {
if (DeepwaterMojoModel.createDeepWaterBackend(b.toString()) != null) return true;
}
return false;
} | java | public static boolean haveBackend() {
for (DeepWaterParameters.Backend b : DeepWaterParameters.Backend.values()) {
if (DeepwaterMojoModel.createDeepWaterBackend(b.toString()) != null) return true;
}
return false;
} | [
"public",
"static",
"boolean",
"haveBackend",
"(",
")",
"{",
"for",
"(",
"DeepWaterParameters",
".",
"Backend",
"b",
":",
"DeepWaterParameters",
".",
"Backend",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"DeepwaterMojoModel",
".",
"createDeepWaterBackend",
... | Check whether we have any Deep Water native backends available | [
"Check",
"whether",
"we",
"have",
"any",
"Deep",
"Water",
"native",
"backends",
"available"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-algos/src/main/java/hex/deepwater/DeepWater.java#L40-L45 |
131,350 | h2oai/h2o-3 | h2o-core/src/main/java/water/api/ModelsHandler.java | ModelsHandler.list | @SuppressWarnings("unused") // called through reflection by RequestServer
public ModelsV3 list(int version, ModelsV3 s) {
Models m = s.createAndFillImpl();
m.models = Model.fetchAll();
return (ModelsV3) s.fillFromImplWithSynopsis(m);
} | java | @SuppressWarnings("unused") // called through reflection by RequestServer
public ModelsV3 list(int version, ModelsV3 s) {
Models m = s.createAndFillImpl();
m.models = Model.fetchAll();
return (ModelsV3) s.fillFromImplWithSynopsis(m);
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"// called through reflection by RequestServer",
"public",
"ModelsV3",
"list",
"(",
"int",
"version",
",",
"ModelsV3",
"s",
")",
"{",
"Models",
"m",
"=",
"s",
".",
"createAndFillImpl",
"(",
")",
";",
"m",
".",
"... | Return all the models. | [
"Return",
"all",
"the",
"models",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/api/ModelsHandler.java#L76-L81 |
131,351 | h2oai/h2o-3 | h2o-core/src/main/java/water/api/ModelsHandler.java | ModelsHandler.delete | @SuppressWarnings("unused") // called through reflection by RequestServer
public ModelsV3 delete(int version, ModelsV3 s) {
Model model = getFromDKV("key", s.model_id.key());
model.delete(); // lock & remove
return s;
} | java | @SuppressWarnings("unused") // called through reflection by RequestServer
public ModelsV3 delete(int version, ModelsV3 s) {
Model model = getFromDKV("key", s.model_id.key());
model.delete(); // lock & remove
return s;
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"// called through reflection by RequestServer",
"public",
"ModelsV3",
"delete",
"(",
"int",
"version",
",",
"ModelsV3",
"s",
")",
"{",
"Model",
"model",
"=",
"getFromDKV",
"(",
"\"key\"",
",",
"s",
".",
"model_id",... | Remove an unlocked model. Fails if model is in-use. | [
"Remove",
"an",
"unlocked",
"model",
".",
"Fails",
"if",
"model",
"is",
"in",
"-",
"use",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/api/ModelsHandler.java#L176-L181 |
131,352 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/ModelMojoReader.java | ModelMojoReader.readtext | protected Iterable<String> readtext(String name, boolean unescapeNewlines) throws IOException {
ArrayList<String> res = new ArrayList<>(50);
BufferedReader br = _reader.getTextFile(name);
try {
String line;
while (true) {
line = br.readLine();
if (line == null) break;
if ... | java | protected Iterable<String> readtext(String name, boolean unescapeNewlines) throws IOException {
ArrayList<String> res = new ArrayList<>(50);
BufferedReader br = _reader.getTextFile(name);
try {
String line;
while (true) {
line = br.readLine();
if (line == null) break;
if ... | [
"protected",
"Iterable",
"<",
"String",
">",
"readtext",
"(",
"String",
"name",
",",
"boolean",
"unescapeNewlines",
")",
"throws",
"IOException",
"{",
"ArrayList",
"<",
"String",
">",
"res",
"=",
"new",
"ArrayList",
"<>",
"(",
"50",
")",
";",
"BufferedReader... | Retrieve text previously saved using `startWritingTextFile` + `writeln` as an array of lines. Each line is
trimmed to remove the leading and trailing whitespace. Removes escaping of the new line characters in enabled. | [
"Retrieve",
"text",
"previously",
"saved",
"using",
"startWritingTextFile",
"+",
"writeln",
"as",
"an",
"array",
"of",
"lines",
".",
"Each",
"line",
"is",
"trimmed",
"to",
"remove",
"the",
"leading",
"and",
"trailing",
"whitespace",
".",
"Removes",
"escaping",
... | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/ModelMojoReader.java#L142-L159 |
131,353 | h2oai/h2o-3 | h2o-core/src/main/java/water/ExternalFrameUtils.java | ExternalFrameUtils.getConnection | public static ByteChannel getConnection(String h2oNodeHostname, int h2oNodeApiPort, short nodeTimeStamp) throws IOException{
SocketChannelFactory socketFactory = SocketChannelFactory.instance(H2OSecurityManager.instance());
return H2ONode.openChan(TCPReceiverThread.TCP_EXTERNAL, socketFactory, h2oNodeHo... | java | public static ByteChannel getConnection(String h2oNodeHostname, int h2oNodeApiPort, short nodeTimeStamp) throws IOException{
SocketChannelFactory socketFactory = SocketChannelFactory.instance(H2OSecurityManager.instance());
return H2ONode.openChan(TCPReceiverThread.TCP_EXTERNAL, socketFactory, h2oNodeHo... | [
"public",
"static",
"ByteChannel",
"getConnection",
"(",
"String",
"h2oNodeHostname",
",",
"int",
"h2oNodeApiPort",
",",
"short",
"nodeTimeStamp",
")",
"throws",
"IOException",
"{",
"SocketChannelFactory",
"socketFactory",
"=",
"SocketChannelFactory",
".",
"instance",
"... | Get connection to a specific h2o node. The caller of this method is usually non-H2O node who wants to read H2O
frames or write to H2O frames from non-H2O environment, such as Spark executor.
This node usually does not have H2O running. | [
"Get",
"connection",
"to",
"a",
"specific",
"h2o",
"node",
".",
"The",
"caller",
"of",
"this",
"method",
"is",
"usually",
"non",
"-",
"H2O",
"node",
"who",
"wants",
"to",
"read",
"H2O",
"frames",
"or",
"write",
"to",
"H2O",
"frames",
"from",
"non",
"-"... | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/ExternalFrameUtils.java#L49-L52 |
131,354 | h2oai/h2o-3 | h2o-core/src/main/java/water/ExternalFrameUtils.java | ExternalFrameUtils.putMarkerAndSend | private static void putMarkerAndSend(AutoBuffer ab, ByteChannel channel, long data) throws IOException{
if(data == NUM_MARKER_NEXT_BYTE_FOLLOWS){
// we need to send another byte because zero is represented as 00 ( 2 bytes )
ab.put1(MARKER_ORIGINAL_VALUE);
}
writeToChannel... | java | private static void putMarkerAndSend(AutoBuffer ab, ByteChannel channel, long data) throws IOException{
if(data == NUM_MARKER_NEXT_BYTE_FOLLOWS){
// we need to send another byte because zero is represented as 00 ( 2 bytes )
ab.put1(MARKER_ORIGINAL_VALUE);
}
writeToChannel... | [
"private",
"static",
"void",
"putMarkerAndSend",
"(",
"AutoBuffer",
"ab",
",",
"ByteChannel",
"channel",
",",
"long",
"data",
")",
"throws",
"IOException",
"{",
"if",
"(",
"data",
"==",
"NUM_MARKER_NEXT_BYTE_FOLLOWS",
")",
"{",
"// we need to send another byte because... | Sends another byte as a marker if it's needed and send the data | [
"Sends",
"another",
"byte",
"as",
"a",
"marker",
"if",
"it",
"s",
"needed",
"and",
"send",
"the",
"data"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/ExternalFrameUtils.java#L303-L309 |
131,355 | h2oai/h2o-3 | h2o-core/src/main/java/water/util/GetLogsFromNode.java | GetLogsFromNode.doIt | public void doIt() {
if (nodeidx == -1) {
GetLogsTask t = new GetLogsTask();
t.doIt();
bytes = t._bytes;
}
else {
H2ONode node = H2O.CLOUD._memary[nodeidx];
GetLogsTask t = new GetLogsTask();
Log.trace("GetLogsTask starting to node " + nodeidx + "...");
// Synchrono... | java | public void doIt() {
if (nodeidx == -1) {
GetLogsTask t = new GetLogsTask();
t.doIt();
bytes = t._bytes;
}
else {
H2ONode node = H2O.CLOUD._memary[nodeidx];
GetLogsTask t = new GetLogsTask();
Log.trace("GetLogsTask starting to node " + nodeidx + "...");
// Synchrono... | [
"public",
"void",
"doIt",
"(",
")",
"{",
"if",
"(",
"nodeidx",
"==",
"-",
"1",
")",
"{",
"GetLogsTask",
"t",
"=",
"new",
"GetLogsTask",
"(",
")",
";",
"t",
".",
"doIt",
"(",
")",
";",
"bytes",
"=",
"t",
".",
"_bytes",
";",
"}",
"else",
"{",
"... | Do the work. | [
"Do",
"the",
"work",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/util/GetLogsFromNode.java#L36-L51 |
131,356 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeSubgraph.java | SharedTreeSubgraph.makeRootNode | public SharedTreeNode makeRootNode() {
assert nodesArray.size() == 0;
SharedTreeNode n = new SharedTreeNode(0, null, subgraphNumber, 0);
n.setInclusiveNa(true);
nodesArray.add(n);
rootNode = n;
return n;
} | java | public SharedTreeNode makeRootNode() {
assert nodesArray.size() == 0;
SharedTreeNode n = new SharedTreeNode(0, null, subgraphNumber, 0);
n.setInclusiveNa(true);
nodesArray.add(n);
rootNode = n;
return n;
} | [
"public",
"SharedTreeNode",
"makeRootNode",
"(",
")",
"{",
"assert",
"nodesArray",
".",
"size",
"(",
")",
"==",
"0",
";",
"SharedTreeNode",
"n",
"=",
"new",
"SharedTreeNode",
"(",
"0",
",",
"null",
",",
"subgraphNumber",
",",
"0",
")",
";",
"n",
".",
"... | Make the root node in the tree.
@return The node | [
"Make",
"the",
"root",
"node",
"in",
"the",
"tree",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeSubgraph.java#L40-L47 |
131,357 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeSubgraph.java | SharedTreeSubgraph.makeLeftChildNode | public SharedTreeNode makeLeftChildNode(SharedTreeNode parent) {
SharedTreeNode child = new SharedTreeNode(nodesArray.size(), parent, subgraphNumber, parent.getDepth() + 1);
nodesArray.add(child);
makeLeftEdge(parent, child);
return child;
} | java | public SharedTreeNode makeLeftChildNode(SharedTreeNode parent) {
SharedTreeNode child = new SharedTreeNode(nodesArray.size(), parent, subgraphNumber, parent.getDepth() + 1);
nodesArray.add(child);
makeLeftEdge(parent, child);
return child;
} | [
"public",
"SharedTreeNode",
"makeLeftChildNode",
"(",
"SharedTreeNode",
"parent",
")",
"{",
"SharedTreeNode",
"child",
"=",
"new",
"SharedTreeNode",
"(",
"nodesArray",
".",
"size",
"(",
")",
",",
"parent",
",",
"subgraphNumber",
",",
"parent",
".",
"getDepth",
"... | Make the left child of a node.
@param parent Parent node
@return The new child node | [
"Make",
"the",
"left",
"child",
"of",
"a",
"node",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeSubgraph.java#L62-L67 |
131,358 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeSubgraph.java | SharedTreeSubgraph.makeRightChildNode | public SharedTreeNode makeRightChildNode(SharedTreeNode parent) {
SharedTreeNode child = new SharedTreeNode(nodesArray.size(), parent, subgraphNumber, parent.getDepth() + 1);
nodesArray.add(child);
makeRightEdge(parent, child);
return child;
} | java | public SharedTreeNode makeRightChildNode(SharedTreeNode parent) {
SharedTreeNode child = new SharedTreeNode(nodesArray.size(), parent, subgraphNumber, parent.getDepth() + 1);
nodesArray.add(child);
makeRightEdge(parent, child);
return child;
} | [
"public",
"SharedTreeNode",
"makeRightChildNode",
"(",
"SharedTreeNode",
"parent",
")",
"{",
"SharedTreeNode",
"child",
"=",
"new",
"SharedTreeNode",
"(",
"nodesArray",
".",
"size",
"(",
")",
",",
"parent",
",",
"subgraphNumber",
",",
"parent",
".",
"getDepth",
... | Make the right child of a node.
@param parent Parent node
@return The new child node | [
"Make",
"the",
"right",
"child",
"of",
"a",
"node",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeSubgraph.java#L74-L79 |
131,359 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/descriptor/JsonModelDescriptorReader.java | JsonModelDescriptorReader.extractTableFromJson | public static Table extractTableFromJson(final JsonObject modelJson, final String tablePath) {
Objects.requireNonNull(modelJson);
JsonElement potentialTableJson = findInJson(modelJson, tablePath);
if (potentialTableJson.isJsonNull()) {
System.out.println(String.format("Failed to extr... | java | public static Table extractTableFromJson(final JsonObject modelJson, final String tablePath) {
Objects.requireNonNull(modelJson);
JsonElement potentialTableJson = findInJson(modelJson, tablePath);
if (potentialTableJson.isJsonNull()) {
System.out.println(String.format("Failed to extr... | [
"public",
"static",
"Table",
"extractTableFromJson",
"(",
"final",
"JsonObject",
"modelJson",
",",
"final",
"String",
"tablePath",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"modelJson",
")",
";",
"JsonElement",
"potentialTableJson",
"=",
"findInJson",
"(",
... | Extracts a Table from H2O's model serialized into JSON.
@param modelJson Full JSON representation of a model
@param tablePath Path in the given JSON to the desired table. Levels are dot-separated.
@return An instance of {@link Table}, if there was a table found by following the given path. Otherwise null. | [
"Extracts",
"a",
"Table",
"from",
"H2O",
"s",
"model",
"serialized",
"into",
"JSON",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/descriptor/JsonModelDescriptorReader.java#L36-L90 |
131,360 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/descriptor/JsonModelDescriptorReader.java | JsonModelDescriptorReader.findInJson | private static JsonElement findInJson(JsonElement jsonElement, String jsonPath) {
final String[] route = JSON_PATH_PATTERN.split(jsonPath);
JsonElement result = jsonElement;
for (String key : route) {
key = key.trim();
if (key.isEmpty())
continue;
... | java | private static JsonElement findInJson(JsonElement jsonElement, String jsonPath) {
final String[] route = JSON_PATH_PATTERN.split(jsonPath);
JsonElement result = jsonElement;
for (String key : route) {
key = key.trim();
if (key.isEmpty())
continue;
... | [
"private",
"static",
"JsonElement",
"findInJson",
"(",
"JsonElement",
"jsonElement",
",",
"String",
"jsonPath",
")",
"{",
"final",
"String",
"[",
"]",
"route",
"=",
"JSON_PATH_PATTERN",
".",
"split",
"(",
"jsonPath",
")",
";",
"JsonElement",
"result",
"=",
"js... | Finds an element in GSON's JSON document representation
@param jsonElement A (potentially complex) element to search in
@param jsonPath Path in the given JSON to the desired table. Levels are dot-separated.
E.g. 'model._output.variable_importances'.
@return JsonElement, if found. Otherwise {@link JsonNull}. | [
"Finds",
"an",
"element",
"in",
"GSON",
"s",
"JSON",
"document",
"representation"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/descriptor/JsonModelDescriptorReader.java#L103-L127 |
131,361 | h2oai/h2o-3 | h2o-core/src/main/java/water/IcedUtils.java | IcedUtils.deepCopy | static public <T extends Iced> T deepCopy(T iced) {
if (iced == null) return null;
AutoBuffer ab = new AutoBuffer();
iced.write(ab);
ab.flipForReading();
// Create a new instance
return (T) TypeMap.newInstance(iced.frozenType()).read(ab);
} | java | static public <T extends Iced> T deepCopy(T iced) {
if (iced == null) return null;
AutoBuffer ab = new AutoBuffer();
iced.write(ab);
ab.flipForReading();
// Create a new instance
return (T) TypeMap.newInstance(iced.frozenType()).read(ab);
} | [
"static",
"public",
"<",
"T",
"extends",
"Iced",
">",
"T",
"deepCopy",
"(",
"T",
"iced",
")",
"{",
"if",
"(",
"iced",
"==",
"null",
")",
"return",
"null",
";",
"AutoBuffer",
"ab",
"=",
"new",
"AutoBuffer",
"(",
")",
";",
"iced",
".",
"write",
"(",
... | Deep-copy clone given iced object. | [
"Deep",
"-",
"copy",
"clone",
"given",
"iced",
"object",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/IcedUtils.java#L9-L16 |
131,362 | h2oai/h2o-3 | h2o-core/src/main/java/water/H2ONode.java | H2ONode.sendMessage | public final void sendMessage(ByteBuffer bb, byte msg_priority) {
UDP_TCP_SendThread sendThread = _sendThread;
if (sendThread == null) {
// Sending threads are created lazily.
// This is because we will intern all client nodes including the ones that have nothing to do with the cluster.
// By ... | java | public final void sendMessage(ByteBuffer bb, byte msg_priority) {
UDP_TCP_SendThread sendThread = _sendThread;
if (sendThread == null) {
// Sending threads are created lazily.
// This is because we will intern all client nodes including the ones that have nothing to do with the cluster.
// By ... | [
"public",
"final",
"void",
"sendMessage",
"(",
"ByteBuffer",
"bb",
",",
"byte",
"msg_priority",
")",
"{",
"UDP_TCP_SendThread",
"sendThread",
"=",
"_sendThread",
";",
"if",
"(",
"sendThread",
"==",
"null",
")",
"{",
"// Sending threads are created lazily.",
"// This... | null if Node was removed from cloud or we didn't need to communicate with it yet | [
"null",
"if",
"Node",
"was",
"removed",
"from",
"cloud",
"or",
"we",
"didn",
"t",
"need",
"to",
"communicate",
"with",
"it",
"yet"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/H2ONode.java#L417-L434 |
131,363 | h2oai/h2o-3 | h2o-core/src/main/java/water/H2ONode.java | H2ONode.record_task | RPC.RPCCall record_task( RPC.RPCCall rpc ) {
// Task removal (and roll-up) suffers from classic race-condition, which we
// fix by a classic Dekker's algo; a task# is always in either the _work
// HashMap, or rolled-up in the _removed_task_ids counter, or both (for
// short intervals during the handoff)... | java | RPC.RPCCall record_task( RPC.RPCCall rpc ) {
// Task removal (and roll-up) suffers from classic race-condition, which we
// fix by a classic Dekker's algo; a task# is always in either the _work
// HashMap, or rolled-up in the _removed_task_ids counter, or both (for
// short intervals during the handoff)... | [
"RPC",
".",
"RPCCall",
"record_task",
"(",
"RPC",
".",
"RPCCall",
"rpc",
")",
"{",
"// Task removal (and roll-up) suffers from classic race-condition, which we",
"// fix by a classic Dekker's algo; a task# is always in either the _work",
"// HashMap, or rolled-up in the _removed_task_ids c... | also ACKACK'd. | [
"also",
"ACKACK",
"d",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/H2ONode.java#L665-L683 |
131,364 | h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/PrimsService.java | PrimsService.getAllPrims | synchronized List<AstPrimitive> getAllPrims() {
List<AstPrimitive> prims = new ArrayList<>();
for (AstPrimitive prim : _loader) {
prims.add(prim);
}
return prims;
} | java | synchronized List<AstPrimitive> getAllPrims() {
List<AstPrimitive> prims = new ArrayList<>();
for (AstPrimitive prim : _loader) {
prims.add(prim);
}
return prims;
} | [
"synchronized",
"List",
"<",
"AstPrimitive",
">",
"getAllPrims",
"(",
")",
"{",
"List",
"<",
"AstPrimitive",
">",
"prims",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"AstPrimitive",
"prim",
":",
"_loader",
")",
"{",
"prims",
".",
"add",
... | Locates all available non-core primitives of the Rapid language.
@return list of Rapid primitives | [
"Locates",
"all",
"available",
"non",
"-",
"core",
"primitives",
"of",
"the",
"Rapid",
"language",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/PrimsService.java#L25-L31 |
131,365 | h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/Rapids.java | Rapids.parse | public static AstRoot parse(String rapids) {
Rapids r = new Rapids(rapids);
AstRoot res = r.parseNext();
if (r.skipWS() != ' ')
throw new IllegalASTException("Syntax error: illegal Rapids expression `" + rapids + "`");
return res;
} | java | public static AstRoot parse(String rapids) {
Rapids r = new Rapids(rapids);
AstRoot res = r.parseNext();
if (r.skipWS() != ' ')
throw new IllegalASTException("Syntax error: illegal Rapids expression `" + rapids + "`");
return res;
} | [
"public",
"static",
"AstRoot",
"parse",
"(",
"String",
"rapids",
")",
"{",
"Rapids",
"r",
"=",
"new",
"Rapids",
"(",
"rapids",
")",
";",
"AstRoot",
"res",
"=",
"r",
".",
"parseNext",
"(",
")",
";",
"if",
"(",
"r",
".",
"skipWS",
"(",
")",
"!=",
"... | Parse a Rapids expression string into an Abstract Syntax Tree object.
@param rapids expression to parse | [
"Parse",
"a",
"Rapids",
"expression",
"string",
"into",
"an",
"Abstract",
"Syntax",
"Tree",
"object",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/Rapids.java#L48-L54 |
131,366 | h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/Rapids.java | Rapids.exec | public static Val exec(String rapids) {
Session session = new Session();
try {
H2O.incrementActiveRapidsCounter();
AstRoot ast = Rapids.parse(rapids);
Val val = session.exec(ast, null);
// Any returned Frame has it's REFCNT raised by +1, and the end(val) call
// will account for th... | java | public static Val exec(String rapids) {
Session session = new Session();
try {
H2O.incrementActiveRapidsCounter();
AstRoot ast = Rapids.parse(rapids);
Val val = session.exec(ast, null);
// Any returned Frame has it's REFCNT raised by +1, and the end(val) call
// will account for th... | [
"public",
"static",
"Val",
"exec",
"(",
"String",
"rapids",
")",
"{",
"Session",
"session",
"=",
"new",
"Session",
"(",
")",
";",
"try",
"{",
"H2O",
".",
"incrementActiveRapidsCounter",
"(",
")",
";",
"AstRoot",
"ast",
"=",
"Rapids",
".",
"parse",
"(",
... | Execute a single rapids call in a short-lived session
@param rapids expression to parse | [
"Execute",
"a",
"single",
"rapids",
"call",
"in",
"a",
"short",
"-",
"lived",
"session"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/Rapids.java#L60-L76 |
131,367 | h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/Rapids.java | Rapids.parseStringList | private AstStrList parseStringList() {
ArrayList<String> strs = new ArrayList<>(10);
while (isQuote(skipWS())) {
strs.add(string());
if (skipWS() == ',') eatChar(',');
}
return new AstStrList(strs);
} | java | private AstStrList parseStringList() {
ArrayList<String> strs = new ArrayList<>(10);
while (isQuote(skipWS())) {
strs.add(string());
if (skipWS() == ',') eatChar(',');
}
return new AstStrList(strs);
} | [
"private",
"AstStrList",
"parseStringList",
"(",
")",
"{",
"ArrayList",
"<",
"String",
">",
"strs",
"=",
"new",
"ArrayList",
"<>",
"(",
"10",
")",
";",
"while",
"(",
"isQuote",
"(",
"skipWS",
"(",
")",
")",
")",
"{",
"strs",
".",
"add",
"(",
"string"... | Parse a list of strings. Strings can be either in single- or in double quotes. | [
"Parse",
"a",
"list",
"of",
"strings",
".",
"Strings",
"can",
"be",
"either",
"in",
"single",
"-",
"or",
"in",
"double",
"quotes",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/Rapids.java#L226-L233 |
131,368 | h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/Rapids.java | Rapids.skipWS | private char skipWS() {
char c = ' ';
while (_x < _str.length() && isWS(c = peek(0))) _x++;
return c;
} | java | private char skipWS() {
char c = ' ';
while (_x < _str.length() && isWS(c = peek(0))) _x++;
return c;
} | [
"private",
"char",
"skipWS",
"(",
")",
"{",
"char",
"c",
"=",
"'",
"'",
";",
"while",
"(",
"_x",
"<",
"_str",
".",
"length",
"(",
")",
"&&",
"isWS",
"(",
"c",
"=",
"peek",
"(",
"0",
")",
")",
")",
"_x",
"++",
";",
"return",
"c",
";",
"}"
] | Advance parse pointer to the first non-whitespace character, and return that character.
If such non-whitespace character cannot be found, then return ' '. | [
"Advance",
"parse",
"pointer",
"to",
"the",
"first",
"non",
"-",
"whitespace",
"character",
"and",
"return",
"that",
"character",
".",
"If",
"such",
"non",
"-",
"whitespace",
"character",
"cannot",
"be",
"found",
"then",
"return",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/Rapids.java#L309-L313 |
131,369 | h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/Rapids.java | Rapids.string | private String string() {
char quote = peek(0);
int start = ++_x;
boolean has_escapes = false;
while (_x < _str.length()) {
char c = peek(0);
if (c == '\\') {
has_escapes = true;
char cc = peek(1);
if (simpleEscapeSequences.containsKey(cc)) {
_x += 2;
... | java | private String string() {
char quote = peek(0);
int start = ++_x;
boolean has_escapes = false;
while (_x < _str.length()) {
char c = peek(0);
if (c == '\\') {
has_escapes = true;
char cc = peek(1);
if (simpleEscapeSequences.containsKey(cc)) {
_x += 2;
... | [
"private",
"String",
"string",
"(",
")",
"{",
"char",
"quote",
"=",
"peek",
"(",
"0",
")",
";",
"int",
"start",
"=",
"++",
"_x",
";",
"boolean",
"has_escapes",
"=",
"false",
";",
"while",
"(",
"_x",
"<",
"_str",
".",
"length",
"(",
")",
")",
"{",... | Parse a string from the token stream. | [
"Parse",
"a",
"string",
"from",
"the",
"token",
"stream",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/Rapids.java#L351-L406 |
131,370 | h2oai/h2o-3 | h2o-core/src/main/java/water/persist/Persist.java | Persist.key2Str_impl | private static String key2Str_impl(Key k) {
// check if we are system key
StringBuilder sb = new StringBuilder(k._kb.length / 2 + 4);
int i = 0;
if( k._kb[0] < 32 ) {
// System keys: hexalate all the leading non-ascii bytes
sb.append('%');
int j = k._kb.length - 1; // Backwards sca... | java | private static String key2Str_impl(Key k) {
// check if we are system key
StringBuilder sb = new StringBuilder(k._kb.length / 2 + 4);
int i = 0;
if( k._kb[0] < 32 ) {
// System keys: hexalate all the leading non-ascii bytes
sb.append('%');
int j = k._kb.length - 1; // Backwards sca... | [
"private",
"static",
"String",
"key2Str_impl",
"(",
"Key",
"k",
")",
"{",
"// check if we are system key",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"k",
".",
"_kb",
".",
"length",
"/",
"2",
"+",
"4",
")",
";",
"int",
"i",
"=",
"0",
";",
... | Convert a Key to a suitable filename string | [
"Convert",
"a",
"Key",
"to",
"a",
"suitable",
"filename",
"string"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/persist/Persist.java#L90-L112 |
131,371 | h2oai/h2o-3 | h2o-core/src/main/java/water/persist/Persist.java | Persist.str2Key_impl | private static Key str2Key_impl(String s) {
String key = s;
byte[] kb = new byte[(key.length() - 1) / 2];
int i = 0, j = 0;
if( (key.length() > 2) && (key.charAt(0) == '%') && (key.charAt(1) >= '0') && (key.charAt(1) <= '9') ) {
// Dehexalate until '%'
for( i = 1; i < key.length(); i += 2 ) ... | java | private static Key str2Key_impl(String s) {
String key = s;
byte[] kb = new byte[(key.length() - 1) / 2];
int i = 0, j = 0;
if( (key.length() > 2) && (key.charAt(0) == '%') && (key.charAt(1) >= '0') && (key.charAt(1) <= '9') ) {
// Dehexalate until '%'
for( i = 1; i < key.length(); i += 2 ) ... | [
"private",
"static",
"Key",
"str2Key_impl",
"(",
"String",
"s",
")",
"{",
"String",
"key",
"=",
"s",
";",
"byte",
"[",
"]",
"kb",
"=",
"new",
"byte",
"[",
"(",
"key",
".",
"length",
"(",
")",
"-",
"1",
")",
"/",
"2",
"]",
";",
"int",
"i",
"="... | Convert a filename string to a Key | [
"Convert",
"a",
"filename",
"string",
"to",
"a",
"Key"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/persist/Persist.java#L135-L174 |
131,372 | h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/ast/params/AstStrList.java | AstStrList.columns | @Override
public int[] columns(String[] names) {
int[] idxs = new int[_strs.length];
for (int i = 0; i < _strs.length; i++) {
int idx = idxs[i] = water.util.ArrayUtils.find(names, _strs[i]);
if (idx == -1) throw new IllegalArgumentException("Column " + _strs[i] + " not found");
}
return id... | java | @Override
public int[] columns(String[] names) {
int[] idxs = new int[_strs.length];
for (int i = 0; i < _strs.length; i++) {
int idx = idxs[i] = water.util.ArrayUtils.find(names, _strs[i]);
if (idx == -1) throw new IllegalArgumentException("Column " + _strs[i] + " not found");
}
return id... | [
"@",
"Override",
"public",
"int",
"[",
"]",
"columns",
"(",
"String",
"[",
"]",
"names",
")",
"{",
"int",
"[",
"]",
"idxs",
"=",
"new",
"int",
"[",
"_strs",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_strs",
".... | Select columns by number or String. | [
"Select",
"columns",
"by",
"number",
"or",
"String",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/ast/params/AstStrList.java#L38-L46 |
131,373 | h2oai/h2o-3 | h2o-algos/src/main/java/hex/deepwater/DeepWaterModel.java | DeepWaterModel.score0 | @Override protected double[] score0(double[] data, double[] preds) {
//allocate a big enough array for the model to be able to score with mini_batch
float[] f = new float[_parms._mini_batch_size * data.length];
for (int i=0; i<data.length; ++i) f[i] = (float)data[i]; //only fill the first observation
//... | java | @Override protected double[] score0(double[] data, double[] preds) {
//allocate a big enough array for the model to be able to score with mini_batch
float[] f = new float[_parms._mini_batch_size * data.length];
for (int i=0; i<data.length; ++i) f[i] = (float)data[i]; //only fill the first observation
//... | [
"@",
"Override",
"protected",
"double",
"[",
"]",
"score0",
"(",
"double",
"[",
"]",
"data",
",",
"double",
"[",
"]",
"preds",
")",
"{",
"//allocate a big enough array for the model to be able to score with mini_batch",
"float",
"[",
"]",
"f",
"=",
"new",
"float",... | Single-instance scoring - slow, not optimized for mini-batches - do not use unless you know what you're doing
@param data One single observation unrolled into a double[], with a length equal to the number of input neurons
@param preds Array to store the predictions in (nclasses+1)
@return vector of [0, p0, p1, p2, etc.... | [
"Single",
"-",
"instance",
"scoring",
"-",
"slow",
"not",
"optimized",
"for",
"mini",
"-",
"batches",
"-",
"do",
"not",
"use",
"unless",
"you",
"know",
"what",
"you",
"re",
"doing"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-algos/src/main/java/hex/deepwater/DeepWaterModel.java#L564-L576 |
131,374 | h2oai/h2o-3 | h2o-core/src/main/java/hex/ModelMetricsClustering.java | ModelMetricsClustering.createCentroidStatsTable | public TwoDimTable createCentroidStatsTable() {
if (_size == null || _withinss == null)
return null;
List<String> colHeaders = new ArrayList<>();
List<String> colTypes = new ArrayList<>();
List<String> colFormat = new ArrayList<>();
colHeaders.add("Centroid"); colTypes.add("long"); colFormat.... | java | public TwoDimTable createCentroidStatsTable() {
if (_size == null || _withinss == null)
return null;
List<String> colHeaders = new ArrayList<>();
List<String> colTypes = new ArrayList<>();
List<String> colFormat = new ArrayList<>();
colHeaders.add("Centroid"); colTypes.add("long"); colFormat.... | [
"public",
"TwoDimTable",
"createCentroidStatsTable",
"(",
")",
"{",
"if",
"(",
"_size",
"==",
"null",
"||",
"_withinss",
"==",
"null",
")",
"return",
"null",
";",
"List",
"<",
"String",
">",
"colHeaders",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Li... | Populate TwoDimTable from members _size and _withinss
@return TwoDimTable | [
"Populate",
"TwoDimTable",
"from",
"members",
"_size",
"and",
"_withinss"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/hex/ModelMetricsClustering.java#L50-L78 |
131,375 | h2oai/h2o-3 | h2o-extensions/xgboost/src/main/java/ml/dmlc/xgboost4j/java/XGBoostScoreTask.java | XGBoostScoreTask.createMetricsBuilder | private ModelMetrics.MetricBuilder createMetricsBuilder(final int responseClassesNum, final String[] responseDomain) {
switch (responseClassesNum) {
case 1:
return new ModelMetricsRegression.MetricBuilderRegression();
case 2:
return new ModelMetricsBinomia... | java | private ModelMetrics.MetricBuilder createMetricsBuilder(final int responseClassesNum, final String[] responseDomain) {
switch (responseClassesNum) {
case 1:
return new ModelMetricsRegression.MetricBuilderRegression();
case 2:
return new ModelMetricsBinomia... | [
"private",
"ModelMetrics",
".",
"MetricBuilder",
"createMetricsBuilder",
"(",
"final",
"int",
"responseClassesNum",
",",
"final",
"String",
"[",
"]",
"responseDomain",
")",
"{",
"switch",
"(",
"responseClassesNum",
")",
"{",
"case",
"1",
":",
"return",
"new",
"M... | Constructs a MetricBuilder for this XGBoostScoreTask based on parameters of response variable
@param responseClassesNum Number of classes found in response variable
@param responseDomain Specific domains in response variable
@return An instance of {@link hex.ModelMetrics.MetricBuilder} corresponding to given respo... | [
"Constructs",
"a",
"MetricBuilder",
"for",
"this",
"XGBoostScoreTask",
"based",
"on",
"parameters",
"of",
"response",
"variable"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-extensions/xgboost/src/main/java/ml/dmlc/xgboost4j/java/XGBoostScoreTask.java#L134-L143 |
131,376 | h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/Merge.java | Merge.sort | public static Frame sort(final Frame fr, int[] cols, int[] ascending) {
if( cols.length==0 ) // Empty key list
return fr; // Return original frame
for( int col : cols )
if( col < 0 || col >= fr.numCols() )
throw new IllegalArgumentException("Column "+col+" is out of ran... | java | public static Frame sort(final Frame fr, int[] cols, int[] ascending) {
if( cols.length==0 ) // Empty key list
return fr; // Return original frame
for( int col : cols )
if( col < 0 || col >= fr.numCols() )
throw new IllegalArgumentException("Column "+col+" is out of ran... | [
"public",
"static",
"Frame",
"sort",
"(",
"final",
"Frame",
"fr",
",",
"int",
"[",
"]",
"cols",
",",
"int",
"[",
"]",
"ascending",
")",
"{",
"if",
"(",
"cols",
".",
"length",
"==",
"0",
")",
"// Empty key list",
"return",
"fr",
";",
"// Return original... | It is not currently an in-place sort, so the data is doubled and a sorted copy is returned. | [
"It",
"is",
"not",
"currently",
"an",
"in",
"-",
"place",
"sort",
"so",
"the",
"data",
"is",
"doubled",
"and",
"a",
"sorted",
"copy",
"is",
"returned",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/Merge.java#L24-L42 |
131,377 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeNode.java | SharedTreeNode.findInclusiveNa | private boolean findInclusiveNa(int colIdToFind) {
if (parent == null) {
return true;
}
else if (parent.getColId() == colIdToFind) {
return inclusiveNa;
}
return parent.findInclusiveNa(colIdToFind);
} | java | private boolean findInclusiveNa(int colIdToFind) {
if (parent == null) {
return true;
}
else if (parent.getColId() == colIdToFind) {
return inclusiveNa;
}
return parent.findInclusiveNa(colIdToFind);
} | [
"private",
"boolean",
"findInclusiveNa",
"(",
"int",
"colIdToFind",
")",
"{",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"parent",
".",
"getColId",
"(",
")",
"==",
"colIdToFind",
")",
"{",
"return",
"inc... | Calculate whether the NA value for a particular colId can reach this node.
@param colIdToFind Column id to find
@return true if NA of colId reaches this node, false otherwise | [
"Calculate",
"whether",
"the",
"NA",
"value",
"for",
"a",
"particular",
"colId",
"can",
"reach",
"this",
"node",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeNode.java#L122-L130 |
131,378 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeNode.java | SharedTreeNode.calculateChildInclusiveLevels | private BitSet calculateChildInclusiveLevels(boolean includeAllLevels,
boolean discardAllLevels,
boolean nodeBitsetDoesContain) {
BitSet inheritedInclusiveLevels = findInclusiveLevels(colId);
BitSet childInclusiveLevel... | java | private BitSet calculateChildInclusiveLevels(boolean includeAllLevels,
boolean discardAllLevels,
boolean nodeBitsetDoesContain) {
BitSet inheritedInclusiveLevels = findInclusiveLevels(colId);
BitSet childInclusiveLevel... | [
"private",
"BitSet",
"calculateChildInclusiveLevels",
"(",
"boolean",
"includeAllLevels",
",",
"boolean",
"discardAllLevels",
",",
"boolean",
"nodeBitsetDoesContain",
")",
"{",
"BitSet",
"inheritedInclusiveLevels",
"=",
"findInclusiveLevels",
"(",
"colId",
")",
";",
"BitS... | Calculate the set of levels that flow through to a child.
@param includeAllLevels naVsRest dictates include all (inherited) levels
@param discardAllLevels naVsRest dictates discard all levels
@param nodeBitsetDoesContain true if the GenmodelBitset from the compressed_tree
@return Calculated set of levels | [
"Calculate",
"the",
"set",
"of",
"levels",
"that",
"flow",
"through",
"to",
"a",
"child",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeNode.java#L174-L200 |
131,379 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeNode.java | SharedTreeNode.printDotNodesAtLevel | void printDotNodesAtLevel(PrintStream os, int levelToPrint, boolean detail, PrintMojo.PrintTreeOptions treeOptions) {
if (getDepth() == levelToPrint) {
printDotNode(os, detail, treeOptions);
return;
}
assert (getDepth() < levelToPrint);
if (leftChild != null) {
leftChild.printDotNode... | java | void printDotNodesAtLevel(PrintStream os, int levelToPrint, boolean detail, PrintMojo.PrintTreeOptions treeOptions) {
if (getDepth() == levelToPrint) {
printDotNode(os, detail, treeOptions);
return;
}
assert (getDepth() < levelToPrint);
if (leftChild != null) {
leftChild.printDotNode... | [
"void",
"printDotNodesAtLevel",
"(",
"PrintStream",
"os",
",",
"int",
"levelToPrint",
",",
"boolean",
"detail",
",",
"PrintMojo",
".",
"PrintTreeOptions",
"treeOptions",
")",
"{",
"if",
"(",
"getDepth",
"(",
")",
"==",
"levelToPrint",
")",
"{",
"printDotNode",
... | Recursively print nodes at a particular depth level in the tree. Useful to group them so they render properly.
@param os output stream
@param levelToPrint level number
@param detail include additional node detail information | [
"Recursively",
"print",
"nodes",
"at",
"a",
"particular",
"depth",
"level",
"in",
"the",
"tree",
".",
"Useful",
"to",
"group",
"them",
"so",
"they",
"render",
"properly",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeNode.java#L344-L358 |
131,380 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeNode.java | SharedTreeNode.printDotEdges | void printDotEdges(PrintStream os, int maxLevelsToPrintPerEdge, float totalWeight, boolean detail,
PrintMojo.PrintTreeOptions treeOptions) {
assert (leftChild == null) == (rightChild == null);
if (leftChild != null) {
os.print("\"" + getDotName() + "\"" + " -> " + "\"" + leftChild.ge... | java | void printDotEdges(PrintStream os, int maxLevelsToPrintPerEdge, float totalWeight, boolean detail,
PrintMojo.PrintTreeOptions treeOptions) {
assert (leftChild == null) == (rightChild == null);
if (leftChild != null) {
os.print("\"" + getDotName() + "\"" + " -> " + "\"" + leftChild.ge... | [
"void",
"printDotEdges",
"(",
"PrintStream",
"os",
",",
"int",
"maxLevelsToPrintPerEdge",
",",
"float",
"totalWeight",
",",
"boolean",
"detail",
",",
"PrintMojo",
".",
"PrintTreeOptions",
"treeOptions",
")",
"{",
"assert",
"(",
"leftChild",
"==",
"null",
")",
"=... | Recursively print all edges in the tree.
@param os output stream
@param maxLevelsToPrintPerEdge Limit the number of individual categorical level names printed per edge
@param totalWeight total weight of all observations (used to determine edge thickness)
@param detail include additional edge detail information | [
"Recursively",
"print",
"all",
"edges",
"in",
"the",
"tree",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeNode.java#L403-L443 |
131,381 | h2oai/h2o-3 | h2o-extensions/xgboost/src/main/java/ml/dmlc/xgboost4j/java/XGBoostSetupTask.java | XGBoostSetupTask.findFrameNodes | public static FrameNodes findFrameNodes(Frame fr) {
// Count on how many nodes the data resides
boolean[] nodesHoldingFrame = new boolean[H2O.CLOUD.size()];
Vec vec = fr.anyVec();
for(int chunkNr = 0; chunkNr < vec.nChunks(); chunkNr++) {
int home = vec.chunkKey(chunkNr).home_node().index();
... | java | public static FrameNodes findFrameNodes(Frame fr) {
// Count on how many nodes the data resides
boolean[] nodesHoldingFrame = new boolean[H2O.CLOUD.size()];
Vec vec = fr.anyVec();
for(int chunkNr = 0; chunkNr < vec.nChunks(); chunkNr++) {
int home = vec.chunkKey(chunkNr).home_node().index();
... | [
"public",
"static",
"FrameNodes",
"findFrameNodes",
"(",
"Frame",
"fr",
")",
"{",
"// Count on how many nodes the data resides",
"boolean",
"[",
"]",
"nodesHoldingFrame",
"=",
"new",
"boolean",
"[",
"H2O",
".",
"CLOUD",
".",
"size",
"(",
")",
"]",
";",
"Vec",
... | Finds what nodes actually do carry some of data of a given Frame
@param fr frame to find nodes for
@return FrameNodes | [
"Finds",
"what",
"nodes",
"actually",
"do",
"carry",
"some",
"of",
"data",
"of",
"a",
"given",
"Frame"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-extensions/xgboost/src/main/java/ml/dmlc/xgboost4j/java/XGBoostSetupTask.java#L82-L92 |
131,382 | h2oai/h2o-3 | h2o-parsers/h2o-orc-parser/src/main/java/water/parser/orc/OrcUtil.java | OrcUtil.schemaToColumnType | public static byte schemaToColumnType(String s) {
switch (s.toLowerCase()) {
case "boolean":
case "smallint":
case "tinyint":
case "bigint": // FIXME: make sure this is fixed by Tomas.
case "int":
case "float":
case "double":
... | java | public static byte schemaToColumnType(String s) {
switch (s.toLowerCase()) {
case "boolean":
case "smallint":
case "tinyint":
case "bigint": // FIXME: make sure this is fixed by Tomas.
case "int":
case "float":
case "double":
... | [
"public",
"static",
"byte",
"schemaToColumnType",
"(",
"String",
"s",
")",
"{",
"switch",
"(",
"s",
".",
"toLowerCase",
"(",
")",
")",
"{",
"case",
"\"boolean\"",
":",
"case",
"\"smallint\"",
":",
"case",
"\"tinyint\"",
":",
"case",
"\"bigint\"",
":",
"// ... | Transform Orc column types into H2O type.
@param s Orc data type
@return a byte representing H2O column type
@throws IllegalArgumentException if schema is not supported | [
"Transform",
"Orc",
"column",
"types",
"into",
"H2O",
"type",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-parsers/h2o-orc-parser/src/main/java/water/parser/orc/OrcUtil.java#L47-L71 |
131,383 | h2oai/h2o-3 | h2o-core/src/main/java/water/parser/DecryptionTool.java | DecryptionTool.get | public static DecryptionTool get(Key<DecryptionTool> key) {
if (key == null)
return new NullDecryptionTool();
DecryptionTool decrypt = DKV.getGet(key);
return decrypt == null ? new NullDecryptionTool() : decrypt;
} | java | public static DecryptionTool get(Key<DecryptionTool> key) {
if (key == null)
return new NullDecryptionTool();
DecryptionTool decrypt = DKV.getGet(key);
return decrypt == null ? new NullDecryptionTool() : decrypt;
} | [
"public",
"static",
"DecryptionTool",
"get",
"(",
"Key",
"<",
"DecryptionTool",
">",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"return",
"new",
"NullDecryptionTool",
"(",
")",
";",
"DecryptionTool",
"decrypt",
"=",
"DKV",
".",
"getGet",
"(",
... | Retrieves a Decryption Tool from DKV using a given key.
@param key a valid DKV key or null
@return instance of Decryption Tool for a valid key, Null Decryption tool for a null key | [
"Retrieves",
"a",
"Decryption",
"Tool",
"from",
"DKV",
"using",
"a",
"given",
"key",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/parser/DecryptionTool.java#L51-L56 |
131,384 | h2oai/h2o-3 | h2o-core/src/main/java/water/parser/DecryptionTool.java | DecryptionTool.readSecretKey | static SecretKeySpec readSecretKey(DecryptionSetup ds) {
Keyed<?> ksObject = DKV.getGet(ds._keystore_id);
ByteVec ksVec = (ByteVec) (ksObject instanceof Frame ? ((Frame) ksObject).vec(0) : ksObject);
InputStream ksStream = ksVec.openStream(null /*job key*/);
try {
KeyStore keystore = KeyStore.getI... | java | static SecretKeySpec readSecretKey(DecryptionSetup ds) {
Keyed<?> ksObject = DKV.getGet(ds._keystore_id);
ByteVec ksVec = (ByteVec) (ksObject instanceof Frame ? ((Frame) ksObject).vec(0) : ksObject);
InputStream ksStream = ksVec.openStream(null /*job key*/);
try {
KeyStore keystore = KeyStore.getI... | [
"static",
"SecretKeySpec",
"readSecretKey",
"(",
"DecryptionSetup",
"ds",
")",
"{",
"Keyed",
"<",
"?",
">",
"ksObject",
"=",
"DKV",
".",
"getGet",
"(",
"ds",
".",
"_keystore_id",
")",
";",
"ByteVec",
"ksVec",
"=",
"(",
"ByteVec",
")",
"(",
"ksObject",
"i... | Retrieves a Secret Key using a given Decryption Setup.
@param ds decryption setup
@return SecretKey | [
"Retrieves",
"a",
"Secret",
"Key",
"using",
"a",
"given",
"Decryption",
"Setup",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/parser/DecryptionTool.java#L63-L82 |
131,385 | h2oai/h2o-3 | h2o-core/src/main/java/water/parser/DecryptionTool.java | DecryptionTool.make | public static DecryptionTool make(DecryptionSetup ds) {
if (ds._decrypt_tool_id == null)
ds._decrypt_tool_id = Key.make();
try {
Class<?> dtClass = DecryptionTool.class.getClassLoader().loadClass(ds._decrypt_impl);
if (! DecryptionTool.class.isAssignableFrom(dtClass)) {
throw new Illeg... | java | public static DecryptionTool make(DecryptionSetup ds) {
if (ds._decrypt_tool_id == null)
ds._decrypt_tool_id = Key.make();
try {
Class<?> dtClass = DecryptionTool.class.getClassLoader().loadClass(ds._decrypt_impl);
if (! DecryptionTool.class.isAssignableFrom(dtClass)) {
throw new Illeg... | [
"public",
"static",
"DecryptionTool",
"make",
"(",
"DecryptionSetup",
"ds",
")",
"{",
"if",
"(",
"ds",
".",
"_decrypt_tool_id",
"==",
"null",
")",
"ds",
".",
"_decrypt_tool_id",
"=",
"Key",
".",
"make",
"(",
")",
";",
"try",
"{",
"Class",
"<",
"?",
">"... | Instantiates a Decryption Tool using a given Decryption Setup and installs it in DKV.
@param ds decryption setup
@return instance of a Decryption Tool | [
"Instantiates",
"a",
"Decryption",
"Tool",
"using",
"a",
"given",
"Decryption",
"Setup",
"and",
"installs",
"it",
"in",
"DKV",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/parser/DecryptionTool.java#L89-L108 |
131,386 | h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/ast/prims/string/AstEntropy.java | AstEntropy.calcEntropy | private double calcEntropy(String str) {
HashMap<Character, Integer> freq = new HashMap<>();
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
Integer count = freq.get(c);
if (count == null) freq.put(c, 1);
else freq.put(c, count + 1);
}
double sume = 0;
int N... | java | private double calcEntropy(String str) {
HashMap<Character, Integer> freq = new HashMap<>();
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
Integer count = freq.get(c);
if (count == null) freq.put(c, 1);
else freq.put(c, count + 1);
}
double sume = 0;
int N... | [
"private",
"double",
"calcEntropy",
"(",
"String",
"str",
")",
"{",
"HashMap",
"<",
"Character",
",",
"Integer",
">",
"freq",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
"(",
... | Shannon's entropy | [
"Shannon",
"s",
"entropy"
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/ast/prims/string/AstEntropy.java#L104-L121 |
131,387 | h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/MojoModel.java | MojoModel.load | public static MojoModel load(String file) throws IOException {
File f = new File(file);
if (!f.exists())
throw new FileNotFoundException("File " + file + " cannot be found.");
MojoReaderBackend cr = f.isDirectory()? new FolderMojoReaderBackend(file)
: new Zipf... | java | public static MojoModel load(String file) throws IOException {
File f = new File(file);
if (!f.exists())
throw new FileNotFoundException("File " + file + " cannot be found.");
MojoReaderBackend cr = f.isDirectory()? new FolderMojoReaderBackend(file)
: new Zipf... | [
"public",
"static",
"MojoModel",
"load",
"(",
"String",
"file",
")",
"throws",
"IOException",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"file",
")",
";",
"if",
"(",
"!",
"f",
".",
"exists",
"(",
")",
")",
"throw",
"new",
"FileNotFoundException",
"(",
... | Primary factory method for constructing MojoModel instances.
@param file Name of the zip file (or folder) with the model's data. This should be the data retrieved via
the `GET /3/Models/{model_id}/mojo` endpoint.
@return New `MojoModel` object.
@throws IOException if `file` does not exist, or cannot be read, or does n... | [
"Primary",
"factory",
"method",
"for",
"constructing",
"MojoModel",
"instances",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/MojoModel.java#L32-L39 |
131,388 | h2oai/h2o-3 | h2o-core/src/main/java/hex/grid/HyperSpaceWalker.java | WalkerFactory.create | public static <MP extends Model.Parameters, C extends HyperSpaceSearchCriteria>
HyperSpaceWalker<MP, ? extends HyperSpaceSearchCriteria> create(MP params,
Map<String, Object[]> hyperParams,
... | java | public static <MP extends Model.Parameters, C extends HyperSpaceSearchCriteria>
HyperSpaceWalker<MP, ? extends HyperSpaceSearchCriteria> create(MP params,
Map<String, Object[]> hyperParams,
... | [
"public",
"static",
"<",
"MP",
"extends",
"Model",
".",
"Parameters",
",",
"C",
"extends",
"HyperSpaceSearchCriteria",
">",
"HyperSpaceWalker",
"<",
"MP",
",",
"?",
"extends",
"HyperSpaceSearchCriteria",
">",
"create",
"(",
"MP",
"params",
",",
"Map",
"<",
"St... | Factory method to create an instance based on the given HyperSpaceSearchCriteria instance. | [
"Factory",
"method",
"to",
"create",
"an",
"instance",
"based",
"on",
"the",
"given",
"HyperSpaceSearchCriteria",
"instance",
"."
] | 845eb49dfeaadf638b6e2f779d82fac996391fad | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/hex/grid/HyperSpaceWalker.java#L181-L195 |
131,389 | jwtk/jjwt | api/src/main/java/io/jsonwebtoken/lang/Strings.java | Strings.pathEquals | public static boolean pathEquals(String path1, String path2) {
return cleanPath(path1).equals(cleanPath(path2));
} | java | public static boolean pathEquals(String path1, String path2) {
return cleanPath(path1).equals(cleanPath(path2));
} | [
"public",
"static",
"boolean",
"pathEquals",
"(",
"String",
"path1",
",",
"String",
"path2",
")",
"{",
"return",
"cleanPath",
"(",
"path1",
")",
".",
"equals",
"(",
"cleanPath",
"(",
"path2",
")",
")",
";",
"}"
] | Compare two paths after normalization of them.
@param path1 first path for comparison
@param path2 second path for comparison
@return whether the two paths are equivalent after normalization | [
"Compare",
"two",
"paths",
"after",
"normalization",
"of",
"them",
"."
] | 86b6096946752cffcfbc9b0a5503f1ea195cc140 | https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Strings.java#L659-L661 |
131,390 | jwtk/jjwt | api/src/main/java/io/jsonwebtoken/lang/Strings.java | Strings.toStringArray | public static String[] toStringArray(Enumeration<String> enumeration) {
if (enumeration == null) {
return null;
}
List<String> list = java.util.Collections.list(enumeration);
return list.toArray(new String[list.size()]);
} | java | public static String[] toStringArray(Enumeration<String> enumeration) {
if (enumeration == null) {
return null;
}
List<String> list = java.util.Collections.list(enumeration);
return list.toArray(new String[list.size()]);
} | [
"public",
"static",
"String",
"[",
"]",
"toStringArray",
"(",
"Enumeration",
"<",
"String",
">",
"enumeration",
")",
"{",
"if",
"(",
"enumeration",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"List",
"<",
"String",
">",
"list",
"=",
"java",
"."... | Copy the given Enumeration into a String array.
The Enumeration must contain String elements only.
@param enumeration the Enumeration to copy
@return the String array (<code>null</code> if the passed-in
Enumeration was <code>null</code>) | [
"Copy",
"the",
"given",
"Enumeration",
"into",
"a",
"String",
"array",
".",
"The",
"Enumeration",
"must",
"contain",
"String",
"elements",
"only",
"."
] | 86b6096946752cffcfbc9b0a5503f1ea195cc140 | https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Strings.java#L815-L821 |
131,391 | jwtk/jjwt | api/src/main/java/io/jsonwebtoken/lang/Collections.java | Collections.toIterator | public static <E> Iterator<E> toIterator(Enumeration<E> enumeration) {
return new EnumerationIterator<E>(enumeration);
} | java | public static <E> Iterator<E> toIterator(Enumeration<E> enumeration) {
return new EnumerationIterator<E>(enumeration);
} | [
"public",
"static",
"<",
"E",
">",
"Iterator",
"<",
"E",
">",
"toIterator",
"(",
"Enumeration",
"<",
"E",
">",
"enumeration",
")",
"{",
"return",
"new",
"EnumerationIterator",
"<",
"E",
">",
"(",
"enumeration",
")",
";",
"}"
] | Adapt an enumeration to an iterator.
@param enumeration the enumeration
@return the iterator | [
"Adapt",
"an",
"enumeration",
"to",
"an",
"iterator",
"."
] | 86b6096946752cffcfbc9b0a5503f1ea195cc140 | https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Collections.java#L337-L339 |
131,392 | jwtk/jjwt | api/src/main/java/io/jsonwebtoken/security/Keys.java | Keys.hmacShaKeyFor | public static SecretKey hmacShaKeyFor(byte[] bytes) throws WeakKeyException {
if (bytes == null) {
throw new InvalidKeyException("SecretKey byte array cannot be null.");
}
int bitLength = bytes.length * 8;
for (SignatureAlgorithm alg : PREFERRED_HMAC_ALGS) {
if... | java | public static SecretKey hmacShaKeyFor(byte[] bytes) throws WeakKeyException {
if (bytes == null) {
throw new InvalidKeyException("SecretKey byte array cannot be null.");
}
int bitLength = bytes.length * 8;
for (SignatureAlgorithm alg : PREFERRED_HMAC_ALGS) {
if... | [
"public",
"static",
"SecretKey",
"hmacShaKeyFor",
"(",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"WeakKeyException",
"{",
"if",
"(",
"bytes",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidKeyException",
"(",
"\"SecretKey byte array cannot be null.\"",
")",
";",
... | Creates a new SecretKey instance for use with HMAC-SHA algorithms based on the specified key byte array.
@param bytes the key byte array
@return a new SecretKey instance for use with HMAC-SHA algorithms based on the specified key byte array.
@throws WeakKeyException if the key byte array length is less than 256 bits (... | [
"Creates",
"a",
"new",
"SecretKey",
"instance",
"for",
"use",
"with",
"HMAC",
"-",
"SHA",
"algorithms",
"based",
"on",
"the",
"specified",
"key",
"byte",
"array",
"."
] | 86b6096946752cffcfbc9b0a5503f1ea195cc140 | https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/security/Keys.java#L60-L82 |
131,393 | xetorthio/jedis | src/main/java/redis/clients/jedis/util/RedisInputStream.java | RedisInputStream.ensureFill | private void ensureFill() throws JedisConnectionException {
if (count >= limit) {
try {
limit = in.read(buf);
count = 0;
if (limit == -1) {
throw new JedisConnectionException("Unexpected end of stream.");
}
} catch (IOException e) {
throw new JedisConnec... | java | private void ensureFill() throws JedisConnectionException {
if (count >= limit) {
try {
limit = in.read(buf);
count = 0;
if (limit == -1) {
throw new JedisConnectionException("Unexpected end of stream.");
}
} catch (IOException e) {
throw new JedisConnec... | [
"private",
"void",
"ensureFill",
"(",
")",
"throws",
"JedisConnectionException",
"{",
"if",
"(",
"count",
">=",
"limit",
")",
"{",
"try",
"{",
"limit",
"=",
"in",
".",
"read",
"(",
"buf",
")",
";",
"count",
"=",
"0",
";",
"if",
"(",
"limit",
"==",
... | This methods assumes there are required bytes to be read. If we cannot read anymore bytes an
exception is thrown to quickly ascertain that the stream was smaller than expected. | [
"This",
"methods",
"assumes",
"there",
"are",
"required",
"bytes",
"to",
"be",
"read",
".",
"If",
"we",
"cannot",
"read",
"anymore",
"bytes",
"an",
"exception",
"is",
"thrown",
"to",
"quickly",
"ascertain",
"that",
"the",
"stream",
"was",
"smaller",
"than",
... | ef4ab403f9d8fd88bd05092fea96de2e9db0bede | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/util/RedisInputStream.java#L196-L208 |
131,394 | xetorthio/jedis | src/main/java/redis/clients/jedis/Pipeline.java | Pipeline.sync | public void sync() {
if (getPipelinedResponseLength() > 0) {
List<Object> unformatted = client.getMany(getPipelinedResponseLength());
for (Object o : unformatted) {
generateResponse(o);
}
}
} | java | public void sync() {
if (getPipelinedResponseLength() > 0) {
List<Object> unformatted = client.getMany(getPipelinedResponseLength());
for (Object o : unformatted) {
generateResponse(o);
}
}
} | [
"public",
"void",
"sync",
"(",
")",
"{",
"if",
"(",
"getPipelinedResponseLength",
"(",
")",
">",
"0",
")",
"{",
"List",
"<",
"Object",
">",
"unformatted",
"=",
"client",
".",
"getMany",
"(",
"getPipelinedResponseLength",
"(",
")",
")",
";",
"for",
"(",
... | Synchronize pipeline by reading all responses. This operation close the pipeline. In order to
get return values from pipelined commands, capture the different Response<?> of the
commands you execute. | [
"Synchronize",
"pipeline",
"by",
"reading",
"all",
"responses",
".",
"This",
"operation",
"close",
"the",
"pipeline",
".",
"In",
"order",
"to",
"get",
"return",
"values",
"from",
"pipelined",
"commands",
"capture",
"the",
"different",
"Response<",
";",
"?>",... | ef4ab403f9d8fd88bd05092fea96de2e9db0bede | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/Pipeline.java#L96-L103 |
131,395 | xetorthio/jedis | src/main/java/redis/clients/jedis/util/Sharded.java | Sharded.getKeyTag | public String getKeyTag(String key) {
if (tagPattern != null) {
Matcher m = tagPattern.matcher(key);
if (m.find()) return m.group(1);
}
return key;
} | java | public String getKeyTag(String key) {
if (tagPattern != null) {
Matcher m = tagPattern.matcher(key);
if (m.find()) return m.group(1);
}
return key;
} | [
"public",
"String",
"getKeyTag",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"tagPattern",
"!=",
"null",
")",
"{",
"Matcher",
"m",
"=",
"tagPattern",
".",
"matcher",
"(",
"key",
")",
";",
"if",
"(",
"m",
".",
"find",
"(",
")",
")",
"return",
"m",
... | A key tag is a special pattern inside a key that, if preset, is the only part of the key hashed
in order to select the server for this key.
@see <a href="http://redis.io/topics/partitioning">partitioning</a>
@param key
@return The tag if it exists, or the original key | [
"A",
"key",
"tag",
"is",
"a",
"special",
"pattern",
"inside",
"a",
"key",
"that",
"if",
"preset",
"is",
"the",
"only",
"part",
"of",
"the",
"key",
"hashed",
"in",
"order",
"to",
"select",
"the",
"server",
"for",
"this",
"key",
"."
] | ef4ab403f9d8fd88bd05092fea96de2e9db0bede | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/util/Sharded.java#L93-L99 |
131,396 | xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.quit | @Override
public String quit() {
checkIsInMultiOrPipeline();
client.quit();
String quitReturn = client.getStatusCodeReply();
client.disconnect();
return quitReturn;
} | java | @Override
public String quit() {
checkIsInMultiOrPipeline();
client.quit();
String quitReturn = client.getStatusCodeReply();
client.disconnect();
return quitReturn;
} | [
"@",
"Override",
"public",
"String",
"quit",
"(",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"quit",
"(",
")",
";",
"String",
"quitReturn",
"=",
"client",
".",
"getStatusCodeReply",
"(",
")",
";",
"client",
".",
"disconnect",
"(",
... | Ask the server to silently close the connection. | [
"Ask",
"the",
"server",
"to",
"silently",
"close",
"the",
"connection",
"."
] | ef4ab403f9d8fd88bd05092fea96de2e9db0bede | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L251-L258 |
131,397 | xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.select | @Override
public String select(final int index) {
checkIsInMultiOrPipeline();
client.select(index);
String statusCodeReply = client.getStatusCodeReply();
client.setDb(index);
return statusCodeReply;
} | java | @Override
public String select(final int index) {
checkIsInMultiOrPipeline();
client.select(index);
String statusCodeReply = client.getStatusCodeReply();
client.setDb(index);
return statusCodeReply;
} | [
"@",
"Override",
"public",
"String",
"select",
"(",
"final",
"int",
"index",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"select",
"(",
"index",
")",
";",
"String",
"statusCodeReply",
"=",
"client",
".",
"getStatusCodeReply",
"(",
")"... | Select the DB with having the specified zero-based numeric index. For default every new client
connection is automatically selected to DB 0.
@param index
@return Status code reply | [
"Select",
"the",
"DB",
"with",
"having",
"the",
"specified",
"zero",
"-",
"based",
"numeric",
"index",
".",
"For",
"default",
"every",
"new",
"client",
"connection",
"is",
"automatically",
"selected",
"to",
"DB",
"0",
"."
] | ef4ab403f9d8fd88bd05092fea96de2e9db0bede | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L554-L562 |
131,398 | xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.move | @Override
public Long move(final byte[] key, final int dbIndex) {
checkIsInMultiOrPipeline();
client.move(key, dbIndex);
return client.getIntegerReply();
} | java | @Override
public Long move(final byte[] key, final int dbIndex) {
checkIsInMultiOrPipeline();
client.move(key, dbIndex);
return client.getIntegerReply();
} | [
"@",
"Override",
"public",
"Long",
"move",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"int",
"dbIndex",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"move",
"(",
"key",
",",
"dbIndex",
")",
";",
"return",
"client",
".",... | Move the specified key from the currently selected DB to the specified destination DB. Note
that this command returns 1 only if the key was successfully moved, and 0 if the target key was
already there or if the source key was not found at all, so it is possible to use MOVE as a
locking primitive.
@param key
@param dbI... | [
"Move",
"the",
"specified",
"key",
"from",
"the",
"currently",
"selected",
"DB",
"to",
"the",
"specified",
"destination",
"DB",
".",
"Note",
"that",
"this",
"command",
"returns",
"1",
"only",
"if",
"the",
"key",
"was",
"successfully",
"moved",
"and",
"0",
... | ef4ab403f9d8fd88bd05092fea96de2e9db0bede | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L581-L586 |
131,399 | xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.sort | @Override
public Long sort(final byte[] key, final SortingParams sortingParameters, final byte[] dstkey) {
checkIsInMultiOrPipeline();
client.sort(key, sortingParameters, dstkey);
return client.getIntegerReply();
} | java | @Override
public Long sort(final byte[] key, final SortingParams sortingParameters, final byte[] dstkey) {
checkIsInMultiOrPipeline();
client.sort(key, sortingParameters, dstkey);
return client.getIntegerReply();
} | [
"@",
"Override",
"public",
"Long",
"sort",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"SortingParams",
"sortingParameters",
",",
"final",
"byte",
"[",
"]",
"dstkey",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"sort",
"(",... | Sort a Set or a List accordingly to the specified parameters and store the result at dstkey.
@see #sort(byte[], SortingParams)
@see #sort(byte[])
@see #sort(byte[], byte[])
@param key
@param sortingParameters
@param dstkey
@return The number of elements of the list at dstkey. | [
"Sort",
"a",
"Set",
"or",
"a",
"List",
"accordingly",
"to",
"the",
"specified",
"parameters",
"and",
"store",
"the",
"result",
"at",
"dstkey",
"."
] | ef4ab403f9d8fd88bd05092fea96de2e9db0bede | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L2091-L2096 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.