本文整理了Java中water.fvec.Frame.deepCopy()
方法的一些代码示例,展示了Frame.deepCopy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Frame.deepCopy()
方法的具体详情如下:
包路径:water.fvec.Frame
类名称:Frame
方法名:deepCopy
暂无
代码示例来源:origin: h2oai/h2o-3
Frame groupingIgnoringFordColumn(String foldColumnName, Frame targetEncodingMap, String teColumnName) {
if (foldColumnName != null) {
int teColumnIndex = targetEncodingMap.find(teColumnName);
Frame newTargetEncodingMap = groupByTEColumnAndAggregate(targetEncodingMap, teColumnIndex);
renameColumn(newTargetEncodingMap, "sum_numerator", "numerator");
renameColumn(newTargetEncodingMap, "sum_denominator", "denominator");
return newTargetEncodingMap;
} else {
Frame targetEncodingMapCopy = targetEncodingMap.deepCopy(Key.make().toString());
DKV.put(targetEncodingMapCopy);
return targetEncodingMapCopy;
}
}
代码示例来源:origin: h2oai/h2o-3
.build();
Frame accFrame = fr.deepCopy(Key.make().toString());;
DKV.put(accFrame);
accFrame = withAppendedFrame.deepCopy(Key.make().toString());
DKV.put(accFrame);
withAppendedFrame.delete();
代码示例来源:origin: h2oai/h2o-3
public static class SubtractCurrentRowForLeaveOneOutTask extends MRTask<SubtractCurrentRowForLeaveOneOutTask> {
private int _numeratorIdx;
private int _denominatorIdx;
private int _targetIdx;
public SubtractCurrentRowForLeaveOneOutTask(int numeratorIdx, int denominatorIdx, int targetIdx) {
_numeratorIdx = numeratorIdx;
_denominatorIdx = denominatorIdx;
_targetIdx = targetIdx;
}
@Override
public void map(Chunk cs[]) {
Chunk num = cs[_numeratorIdx];
Chunk den = cs[_denominatorIdx];
Chunk target = cs[_targetIdx];
for (int i = 0; i < num._len; i++) {
if (!target.isNA(i)) {
num.set(i, num.atd(i) - target.atd(i));
den.set(i, den.atd(i) - 1);
}
}
}
}
代码示例来源:origin: h2oai/h2o-3
try {
double expected_deviance = 26000;
covtype_copy = _covtype.deepCopy("covtype_copy");
DKV.put(covtype_copy);
Vec.Writer w = covtype_copy.vec(54).open();
代码示例来源:origin: h2oai/h2o-3
@Test
public void deepCopyTest() {
fr = new TestFrameBuilder()
.withName("trainingFrame")
.withColNames("colA")
.withVecTypes(Vec.T_STR)
.withDataForCol(0, ar("a", "b", "c"))
.build();
Frame trainCopy = fr.deepCopy(Key.make().toString());
DKV.put(trainCopy);
assertTrue(isBitIdentical(fr, trainCopy));
trainCopy.vec(0).set(0, "d");
assertFalse(isBitIdentical(fr, trainCopy));
trainCopy.delete();
}
代码示例来源:origin: h2oai/h2o-3
@Test // Test that we are not introducing keys leakage when we reassign within if-statement
public void ifStatementsWithFramesTest() {
Scope.enter();
try {
fr = new TestFrameBuilder()
.withName("testFrame")
.withColNames("ColA", "ColB")
.withVecTypes(Vec.T_CAT, Vec.T_CAT)
.withDataForCol(0, ar("a", "b"))
.withDataForCol(1, ar("yes", "no"))
.build();
boolean flag = false;
String[] teColumns = {""};
TargetEncoder tec = new TargetEncoder(teColumns);
Frame dataWithAllEncodings = null ;
if(flag) {
Frame dataWithEncodedTarget = tec.ensureTargetColumnIsBinaryCategorical(fr, "ColB");
dataWithAllEncodings = dataWithEncodedTarget.deepCopy(Key.make().toString());
DKV.put(dataWithAllEncodings);
assertVecEquals(dataWithAllEncodings.vec("ColB"), vec(1, 0), 1E-5);
}
else {
dataWithAllEncodings = fr;
}
dataWithAllEncodings.delete();
} finally {
Scope.exit();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test
public void ensureImmutabilityOfTheOriginalDatasetDuringApplicationOfTE() {
String teColumnName = "ColA";
String targetColumnName = "ColC";
String foldColumn = "fold_column";
Frame training = new TestFrameBuilder()
.withName("trainingFrame")
.withColNames(teColumnName, targetColumnName, foldColumn)
.withVecTypes(Vec.T_CAT, Vec.T_CAT, Vec.T_NUM)
.withDataForCol(0, ar("a", "b", "c", "d", "e", "b", "b"))
.withDataForCol(1, ar("2", "6", "6", "6", "6", "2", "2"))
.withDataForCol(2, ar(1, 2, 2, 3, 1, 2, 1))
.build();
String[] teColumns = {teColumnName};
TargetEncoder tec = new TargetEncoder(teColumns);
Map<String, Frame> targetEncodingMap = tec.prepareEncodingMap(training, targetColumnName, foldColumn);
Frame trainCopy = training.deepCopy(Key.make().toString());
DKV.put(trainCopy);
Frame resultWithEncoding = tec.applyTargetEncoding(training, targetColumnName, targetEncodingMap, TargetEncoder.DataLeakageHandlingStrategy.KFold, foldColumn, false, 0, false, 1234);
assertTrue(isBitIdentical(training, trainCopy));
training.delete();
trainCopy.delete();
encodingMapCleanUp(targetEncodingMap);
resultWithEncoding.delete();
}
代码示例来源:origin: ai.h2o/h2o-automl
Frame groupingIgnoringFordColumn(String foldColumnName, Frame targetEncodingMap, String teColumnName) {
if (foldColumnName != null) {
int teColumnIndex = targetEncodingMap.find(teColumnName);
Frame newTargetEncodingMap = groupByTEColumnAndAggregate(targetEncodingMap, teColumnIndex);
renameColumn(newTargetEncodingMap, "sum_numerator", "numerator");
renameColumn(newTargetEncodingMap, "sum_denominator", "denominator");
return newTargetEncodingMap;
} else {
Frame targetEncodingMapCopy = targetEncodingMap.deepCopy(Key.make().toString());
DKV.put(targetEncodingMapCopy);
return targetEncodingMapCopy;
}
}
代码示例来源:origin: ai.h2o/h2o-automl
public static class SubtractCurrentRowForLeaveOneOutTask extends MRTask<SubtractCurrentRowForLeaveOneOutTask> {
private int _numeratorIdx;
private int _denominatorIdx;
private int _targetIdx;
public SubtractCurrentRowForLeaveOneOutTask(int numeratorIdx, int denominatorIdx, int targetIdx) {
_numeratorIdx = numeratorIdx;
_denominatorIdx = denominatorIdx;
_targetIdx = targetIdx;
}
@Override
public void map(Chunk cs[]) {
Chunk num = cs[_numeratorIdx];
Chunk den = cs[_denominatorIdx];
Chunk target = cs[_targetIdx];
for (int i = 0; i < num._len; i++) {
if (!target.isNA(i)) {
num.set(i, num.atd(i) - target.atd(i));
den.set(i, den.atd(i) - 1);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!