本文整理了Java中water.fvec.Frame.unlock()
方法的一些代码示例,展示了Frame.unlock()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Frame.unlock()
方法的具体详情如下:
包路径:water.fvec.Frame
类名称:Frame
方法名:unlock
暂无
代码示例来源:origin: h2oai/h2o-2
@Override public void onCompletion(CountedCompleter caller) {
boolean exceptional = workersExceptions!=null;
dataset.unlock(jobKey);
if (splits!=null) {
for (Frame s : splits) {
if (s!=null) {
if (!exceptional) {
s.update(jobKey);
s.unlock(jobKey);
} else { // Have to unlock and delete here
s.unlock(jobKey);
s.delete(jobKey, 3.14f); // delete all splits
}
}
}
}
}
代码示例来源:origin: h2oai/h2o-2
@Override public void onCompletion(CountedCompleter caller) {
boolean exceptional = workersExceptions!=null;
dataset.unlock(jobKey);
if (splits!=null) {
for (Frame s : splits) {
if (s!=null) {
if (!exceptional) {
s.update(jobKey);
s.unlock(jobKey);
} else { // Have to unlock and delete here
s.unlock(jobKey);
s.delete(jobKey, 3.14f); // delete all splits
}
}
}
}
}
代码示例来源:origin: h2oai/h2o-2
@Override
public void onCompletion(CountedCompleter caller) {
_target.update(_job);
_target.unlock(_job);
}
代码示例来源:origin: h2oai/h2o-2
@Override public void onCompletion(CountedCompleter caller){
_out.update(_job);
_out.unlock(_job);
}
代码示例来源:origin: h2oai/h2o-2
/**
* Release the lock for the input datasets
*/
private void unlock_data() {
source.unlock(self());
if( validation != null && source._key != null && validation._key != null && !source._key.equals(validation._key) )
validation.unlock(self());
}
代码示例来源:origin: h2oai/h2o-2
@Override public void onCompletion(CountedCompleter caller){
assert _out.numRows() == _in.numRows();
_out.update(_jobKey);
_out.unlock(_jobKey);
}
@Override public boolean onExceptionalCompletion(Throwable t, CountedCompleter caller){
代码示例来源:origin: h2oai/h2o-2
@Override public void cancel(){
_cancelled = true;
for(GLM2 g:_jobs)
g.cancel();
source.unlock(self());
DKV.remove(destination_key);
super.cancel();
}
@Override
代码示例来源:origin: h2oai/h2o-2
@Override
public void callback(ParallelGLMs parallelGLMs) {
_glm2._done = true;
// we're gonna get success-callback after cancelling forked tasks since forked glms do not propagate exception if part of grid search
if(!_cancelled) {
source.unlock(self());
Lockable.unlock_lockable(destination_key, self());
remove();
}
}
@Override public boolean onExceptionalCompletion(Throwable t, CountedCompleter cmp){
代码示例来源:origin: h2oai/h2o-2
private GapStatisticModel initModel() {
try {
source.read_lock(self());
int ks = k_max;
double[] wks = new double[ks];
double[] wkbs = new double[ks];
double[] sk = new double[ks];
return new GapStatisticModel(destination_key, source._key, source, k_max, wks, wkbs, sk, k_max, b_max, 1, 0);
}
finally {
source.unlock(self());
}
}
代码示例来源:origin: h2oai/h2o-3
private double computeSigmaU(DataInfo dinfo, SVDModel model, int k, double[][] ivv_sum, Vec[] uvecs, double[] vresult) {
double[] ivv_vk = ArrayUtils.multArrVec(ivv_sum, model._output._v[k], vresult);
CalcSigmaU ctsk = new CalcSigmaU(_job._key, dinfo, ivv_vk).doAll(Vec.T_NUM, dinfo._adaptedFrame);
model._output._d[k] = ctsk._sval;
assert ctsk._nobs == model._output._nobs : "Processed " + ctsk._nobs + " rows but expected " + model._output._nobs; // Check same number of skipped rows as Gram
Frame tmp = ctsk.outputFrame();
uvecs[k] = tmp.vec(0); // Save output column of U
tmp.unlock(_job);
return model._output._d[k];
}
代码示例来源:origin: h2oai/h2o-2
protected void cleanUp(Frame fr, Timer t_build) {
//super.cleanUp(fr, t_build);
Log.info(logTag(),"Modeling done in "+t_build);
// Remove temp vectors; cleanup the Frame
while( fr.numCols() > _ncols+1/*Do not delete the response vector*/ )
UKV.remove(fr.remove(fr.numCols()-1)._key);
// Unlock the input datasets against deletes
source.unlock(self());
if( validation != null && !source._key.equals(validation._key) )
validation.unlock(self());
}
代码示例来源:origin: h2oai/h2o-2
public static Key make(FileStatus f, Futures fs) {
long size = f.getLen();
String fname = f.getPath().toString();
Key k = Key.make(fname);
Key k2 = Vec.newKey(k);
new Frame(k).delete_and_lock(null);
// Insert the top-level FileVec key into the store
Vec v = new HdfsFileVec(k2,size);
DKV.put(k2, v, fs);
Frame fr = new Frame(k,new String[]{fname},new Vec[]{v});
fr.update(null);
fr.unlock(null);
return k;
}
private HdfsFileVec(Key key, long len) {super(key,len,Value.HDFS);}
代码示例来源:origin: h2oai/h2o-2
@Override
protected final void execImpl() {
if (dl_model == null) throw new IllegalArgumentException("Deep Learning Model must be specified.");
DeepLearningModel dlm = UKV.get(dl_model);
if (dlm == null) throw new IllegalArgumentException("Deep Learning Model not found.");
StringBuilder sb = new StringBuilder();
if (layer < -1 || layer > dlm.get_params().hidden.length-1) throw new IllegalArgumentException("Layer must be either -1 or between 0 and " + (dlm.get_params().hidden.length-1));
if (layer == -1) layer = dlm.get_params().hidden.length-1;
int features = dlm.get_params().hidden[layer];
sb.append("\nTransforming frame '" + source._key.toString() + "' with " + source.numCols() + " into " + features + " features with model '" + dl_model + "'\n");
Frame df = dlm.scoreDeepFeatures(source, layer);
sb.append("Storing the new features under: " + dest() + ".\n");
Frame output = new Frame(dest(), df.names(), df.vecs());
output.delete_and_lock(null);
output.unlock(null);
}
代码示例来源:origin: h2oai/h2o-2
@Override protected void execImpl() {
Frame fr = source;
new Frame(destination_key,fr._names.clone(),fr.vecs().clone()).delete_and_lock(null).unlock(null);
}
代码示例来源:origin: h2oai/h2o-2
@Override protected void execImpl() {
// Note: Source data MUST contain all features (matched by name) used to build PCA model!
// If additional columns exist in source, they are automatically ignored in scoring
new Frame(destination_key, new String[0], new Vec[0]).delete_and_lock(self());
Frame fr = model.adapt(source, true)[0];
int nfeat = model._names.length;
DataInfo dinfo = new DataInfo(fr, 0, false, false, model.normSub, model.normMul, DataInfo.TransformType.STANDARDIZE, null, null);
PCAScoreTask tsk = new PCAScoreTask(this, dinfo, nfeat, num_pc, model.eigVec);
tsk.doAll(num_pc, dinfo._adaptedFrame);
String[] names = new String[num_pc];
String[][] domains = new String[num_pc][];
for(int i = 0; i < num_pc; i++) {
names[i] = "PC" + i;
domains[i] = null;
}
tsk.outputFrame(destination_key, names, domains).unlock(self());
}
代码示例来源:origin: h2oai/h2o-2
public static Key make(String serverUri, ClientFileInfo tf, Futures fs) {
String fname = tf.getPath(); // Always return absolute path /dir/filename
long size = tf.getLength();
Key k = Key.make(PersistTachyon.PREFIX + serverUri + fname);
Key k2 = Vec.newKey(k);
new Frame(k).delete_and_lock(null);
// Insert the top-level FileVec key into the store
Vec v = new TachyonFileVec(k2,size);
DKV.put(k2, v, fs);
Frame fr = new Frame(k,new String[] {fname}, new Vec[] {v});
fr.update(null);
fr.unlock(null);
return k;
}
private TachyonFileVec(Key key, long len) {super(key,len,Value.TACHYON);}
代码示例来源:origin: h2oai/h2o-2
@Override public void cancel(String msg){
if(!_grid) {
source.unlock(self());
}
DKV.remove(_progressKey);
Value v = DKV.get(destination_key);
if(v != null){
GLMModel m = v.get();
Key [] xvals = m.xvalModels();
if(xvals != null)
for(Key k:xvals)
DKV.remove(k);
DKV.remove(destination_key);
}
DKV.remove(destination_key);
super.cancel(msg);
}
代码示例来源:origin: h2oai/h2o-2
@Override protected Response serve() {
try {
if( model == null )
throw new IllegalArgumentException("Model is required to perform validation!");
final Key predictionKey = ( prediction == null )?Key.make("__Prediction_" + Key.make()):prediction;
GLMModel m = new GLMModel.GetScoringModelTask(null, model,lambda).invokeTask()._res;
// Create a new random key
if ( prediction == null )
prediction = Key.make("__Prediction_" + Key.make());
Frame fr = new Frame(prediction,new String[0],new Vec[0]).delete_and_lock(null);
fr = m.score(data);
fr = new Frame(prediction,fr._names,fr.vecs()); // Jam in the frame key
fr.unlock(null);
return Inspect2.redirect(this, prediction.toString());
} catch( Throwable t ) {
return Response.error(t);
}
}
}
代码示例来源:origin: h2oai/h2o-2
@Override protected Response serve() {
try {
Frame fr = new Frame(destination_key,source._names.clone(),source.vecs().clone()).delete_and_lock(null);
fr.remove(ignored_cols);
Frame oneHotFrame = hex.OneHot.expandDataset(fr,destination_key);
for (int i : ignored_cols) oneHotFrame.add(source._names[i], source.vecs()[i]);
oneHotFrame.unlock(null);
} catch( Throwable t ) {
return Response.error(t);
}
return Inspect2.redirect(this, destination_key.toString());
}
}
代码示例来源:origin: h2oai/h2o-2
public static Key make(S3ObjectSummary obj, Futures fs) {
String fname = obj.getKey();
Key k = Key.make("s3://" + obj.getBucketName() + "/" + fname);
long size = obj.getSize();
Key k2 = Vec.newKey(k);
new Frame(k).delete_and_lock(null);
// Insert the top-level FileVec key into the store
Vec v = new S3FileVec(k2,size);
DKV.put(k2, v, fs);
Frame fr = new Frame(k,new String[]{fname},new Vec[]{v});
fr.update(null);
fr.unlock(null);
return k;
}
private S3FileVec(Key key, long len) {super(key,len,Value.S3);}
内容来源于网络,如有侵权,请联系作者删除!