本文整理了Java中water.fvec.Frame.subframe()
方法的一些代码示例,展示了Frame.subframe()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Frame.subframe()
方法的具体详情如下:
包路径:water.fvec.Frame
类名称:Frame
方法名:subframe
[英]Create a subframe from given interval of columns.
[中]从给定的列间隔创建子帧。
代码示例来源:origin: h2oai/h2o-2
/** Returns a subframe of this frame containing only vectors with desired names.
*
* @param names list of vector names
* @return a new frame which collects vectors from this frame with desired names.
* @throws IllegalArgumentException if there is no vector with desired name in this frame.
*/
public Frame subframe(String[] names) { return subframe(names, false, 0)[0]; }
/** Returns a new frame composed of vectors of this frame selected by given names.
代码示例来源:origin: h2oai/h2o-2
/** Returns a new frame composed of vectors of this frame selected by given names.
* The method replaces missing vectors by a constant column filled by given value.
* @param names names of vector to compose a subframe
* @param c value to fill missing columns.
* @return two frames, the first contains subframe, the second contains newly created constant vectors or null
*/
public Frame[] subframe(String[] names, double c) { return subframe(names, true, c); }
/** Create a subframe from this frame based on desired names.
代码示例来源:origin: h2oai/h2o-2
public Frame extractFrame(int startIdx, int endIdx) {
Frame f = subframe(startIdx, endIdx);
remove(startIdx, endIdx);
return f;
}
代码示例来源:origin: h2oai/h2o-3
/**
* Prepare a "level one" frame for a given set of models and actuals.
* Used for preparing validation frames for the metalearning step, and could also be used for bulk predictions for a StackedEnsemble.
*/
private Frame prepareLevelOneFrame(String levelOneKey, Key<Model>[] baseModelKeys, Frame actuals, boolean isTraining) {
List<Model> baseModels = new ArrayList<>();
List<Frame> baseModelPredictions = new ArrayList<>();
for (Key<Model> k : baseModelKeys) {
Model aModel = DKV.getGet(k);
if (null == aModel)
throw new H2OIllegalArgumentException("Failed to find base model: " + k);
Frame predictions = getPredictionsForBaseModel(aModel, actuals, isTraining);
baseModels.add(aModel);
if (!aModel._output.isMultinomialClassifier()) {
baseModelPredictions.add(predictions);
} else {
List<String> predColNames = new ArrayList<>(Arrays.asList(predictions.names()));
predColNames.remove("predict");
String[] multClassNames = predColNames.toArray(new String[0]);
baseModelPredictions.add(predictions.subframe(multClassNames));
}
}
return prepareLevelOneFrame(levelOneKey, baseModels.toArray(new Model[0]), baseModelPredictions.toArray(new Frame[0]), actuals);
}
代码示例来源:origin: h2oai/h2o-3
static Vec makeStrataVec(Frame f, String[] stratifyBy, IcedHashMap<AstGroup.G, IcedInt> mapping) {
final Frame sf = f.subframe(stratifyBy);
return new StrataTask(mapping).doAll(Vec.T_NUM, sf).outputFrame().anyVec();
}
代码示例来源:origin: h2oai/h2o-3
static Frame stratifyTime(Frame f, double[] time, String[] stratifyBy, IcedHashMap<AstGroup.G, IcedInt> mapping,
Vec startVec, Vec stopVec) {
final Frame sf = f.subframe(stratifyBy);
final boolean hasStartColumn = startVec != null;
if (hasStartColumn)
sf.add("__startVec", startVec);
sf.add("__stopVec", stopVec);
return new StrataTask(mapping, time, hasStartColumn).doAll(hasStartColumn ? 3 : 2, Vec.T_NUM, sf).outputFrame();
}
代码示例来源:origin: h2oai/h2o-3
static void setupStrataMapping(Frame f, String[] stratifyBy, IcedHashMap<AstGroup.G, IcedInt> outMapping) {
final Frame sf = f.subframe(stratifyBy);
int[] idxs = MemoryManager.malloc4(stratifyBy.length);
for (int i = 0; i < idxs.length; i++)
idxs[i] = i;
IcedHashMap<AstGroup.G, String> groups = AstGroup.doGroups(sf, idxs, AstGroup.aggNRows());
groups: for (AstGroup.G g : groups.keySet()) {
for (double val : g._gs)
if (Double.isNaN(val))
continue groups;
outMapping.put(g, new IcedInt(outMapping.size()));
}
}
代码示例来源:origin: h2oai/h2o-2
Frame [] subVfr;
subVfr = vfr.subframe(names, missingColumnsType());
vfr = subVfr[0]; // extract only subframe but keep the rest for delete later
Vec[] frvecs = vfr.vecs();
代码示例来源:origin: h2oai/h2o-3
public void recoverSVD(GLRMModel model, DataInfo xinfo, DataInfo dinfo) {
GramTask dgram = new GramTask(_job._key, dinfo).doAll(dinfo._adaptedFrame.subframe(0, _ncolA));
Cholesky xxchol = regularizedCholesky(xgram._gram);
long nobs = xgram._nobs;
代码示例来源:origin: h2oai/h2o-2
private Frame getSubframe() {
final boolean use_start_column = (start_column != null);
final boolean use_weights_column = (weights_column != null);
final int x_ncol = x_columns.length;
final int offset_ncol = offset_columns == null ? 0 : offset_columns.length;
int ncol = x_ncol + offset_ncol + 2;
if (use_weights_column)
ncol++;
if (use_start_column)
ncol++;
final String[] names = new String[ncol];
for (int j = 0; j < x_ncol; ++j)
names[j] = source.names()[x_columns[j]];
for (int j = 0; j < offset_ncol; ++j)
names[x_ncol + j] = source.names()[offset_columns[j]];
if (use_weights_column)
names[x_ncol + offset_ncol] = source.names()[source.find(weights_column)];
if (use_start_column)
names[ncol - 3] = source.names()[source.find(start_column)];
names[ncol - 2] = source.names()[source.find(stop_column)];
names[ncol - 1] = source.names()[source.find(event_column)];
return source.subframe(names);
}
代码示例来源:origin: h2oai/h2o-2
Vec response = train.subframe(new String[] {ARGS.response}).vecs()[0];
train = train.subframe(cs);
if( test != null ) test = test.subframe(cs);
Vec vs[] = train.vecs();
for( Vec v : vs ) v.min(); // Do rollups
代码示例来源:origin: h2oai/h2o-3
tfr = inF1.subframe(cols); // Just the columns to train on
vfr = inF2.subframe(cols);
代码示例来源:origin: h2oai/h2o-3
for (int i = 0; i < _parms._nv; i++)
ayqfrm.add("qcol_" + i, ayqfrm.anyVec().makeZero());
Frame ayfrm = ayqfrm.subframe(0, ncolA + _parms._nv); // [A,Y]
Frame aqfrm = ayqfrm.subframe(0, ncolA);
aqfrm.add(ayqfrm.subframe(ncolA + _parms._nv, ayqfrm.numCols())); // [A,Q]
yqfrm = ayqfrm.subframe(ncolA, ayqfrm.numCols()); // [Y,Q]
xx = MemoryManager.malloc8d(_parms._nv, _parms._nv);
LinearAlgebraUtils.computeQ(_job._key, yinfo, yqfrm, xx);
代码示例来源:origin: h2oai/h2o-3
xwF.add(xwF2);
new DMatrix.TransposeTsk(frTA).doAll(dinfo._adaptedFrame.subframe(0, _ncolA)); // store T(A)
代码示例来源:origin: h2oai/h2o-3
try {
frA = parse_test_file(Key.make("a.hex"), "smalldata/airlines/allyears2k_headers.zip");
fr = frA.subframe(keepColumns);
代码示例来源:origin: h2oai/h2o-3
Scope.enter();
Frame fr = Scope.track(parse_test_file(Key.make("a.hex"), "smalldata/airlines/allyears2k_headers.zip"));
Frame sfr = fr.subframe(new String[]{"Origin", "Distance"});
Model.InteractionSpec interactionSpec = Model.InteractionSpec.create(
new String[]{"Origin", "Distance"}, null, new String[] {"Distance"});
代码示例来源:origin: h2oai/h2o-3
Scope.enter();
Frame fr = Scope.track(parse_test_file(Key.make("a.hex"), "smalldata/airlines/allyears2k_headers.zip"));
Frame sfr = fr.subframe(new String[]{"Origin", "Distance", "IsDepDelayed"});
Model.InteractionSpec interactionSpec = Model.InteractionSpec.create(
new String[]{"Origin", "Distance"}, null, new String[]{"Origin"});
代码示例来源:origin: h2oai/h2o-2
@Test public void testTimeParse1() {
Frame fr = parseFrame(null,"smalldata/test/test_time.csv");
Frame fr2 = fr.subframe(new String[]{"click_time","query_time"});
double[][] exp = new double[][] {
d(1314945892533L, 1314945839752L ),
d(1315250737042L, 1315250701187L ),
d(1314215818091L, 1314215713012L ),
d(1319552294722L, 1319552211759L ),
d(1319552391697L, 1319552211759L ),
d(1315436087956L, 1315436004353L ),
d(1316974022603L, 1316973926996L ),
d(1316806820871L, 1316806814845L ),
d(1314650252903L, 1314650003249L ),
d(1319608558683L, 1319608485926L ),
d(1315770524139L, 1315770378466L ),
d(1318983693919L, 1318983686057L ),
d(1315158920427L, 1315158910874L ),
d(1319844389203L, 1319844380358L ),
d(1318232126858L, 1318232070708L ),
d(1316841248965L, 1316841217043L ),
d(1315681493645L, 1315681470805L ),
d(1319395475074L, 1319395407011L ),
d(1319395524416L, 1319395407011L ),
};
ParserTest2.testParsed(fr2,exp,exp.length);
fr.delete();
}
代码示例来源:origin: h2oai/h2o-3
Scope.enter();
Frame fr = Scope.track(parse_test_file(Key.make("a.hex"), "smalldata/airlines/allyears2k_headers.zip"));
Frame sfr = fr.subframe(new String[]{"Origin", "Distance", "IsDepDelayed"});
Model.InteractionSpec interactionSpec = Model.InteractionSpec.create(
new String[]{"Origin", "Distance"}, null, new String[]{"Origin"});
代码示例来源:origin: h2oai/h2o-3
final DataInfo dinfoNoResp = makeDataInfo(fr.subframe(new String[]{"ColA", "ColB", "ColC"}), 0);
内容来源于网络,如有侵权,请联系作者删除!