本文整理了Java中water.Job.remove()
方法的一些代码示例,展示了Job.remove()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Job.remove()
方法的具体详情如下:
包路径:water.Job
类名称:Job
方法名:remove
[英]Marks job as finished and records job end time.
[中]将作业标记为已完成并记录作业结束时间。
代码示例来源:origin: h2oai/h2o-2
@Override public void remove() {
super.remove();
UKV.remove(_progress);
}
代码示例来源:origin: h2oai/h2o-2
@Override public void remove() {
DKV.remove(_progress);
super.remove();
}
代码示例来源:origin: h2oai/h2o-2
/** Blocks and get result of this job.
* <p>
* The call blocks on working task which was passed via {@link #start(H2OCountedCompleter)} method
* and returns the result which is fetched from UKV based on job destination key.
* </p>
* @return result of this job fetched from UKV by destination key.
* @see #start(H2OCountedCompleter)
* @see UKV
*/
public <T> T get() {
_fjtask.join(); // Block until top-level job is done
T ans = (T) UKV.get(destination_key);
remove(); // Remove self-job
return ans;
}
代码示例来源:origin: h2oai/h2o-2
void done() {
NeuralNet.running = false;
_instances.remove(_key);
UKV.remove(_key);
if( _job != null ) {
Job job = Job.findJob(_job);
if( job != null ) {
H2OCountedCompleter task = job._fjtask;
if( task != null )
task.tryComplete();
job.remove();
}
}
}
}
代码示例来源:origin: h2oai/h2o-2
@Override public void invoke() {
init();
start(new H2OEmptyCompleter()); // mark job started
exec(); // execute the implementation
remove(); // remove the job
}
代码示例来源:origin: h2oai/h2o-2
@Override public void compute2() {
try {
try {
// Exec always waits till the end of computation
Job.this.exec();
Job.this.remove();
} catch (Throwable t) {
if(!(t instanceof ExpectedExceptionForDebug))
Log.err(t);
Job.this.cancel(t);
}
} finally {
tryComplete();
}
}
};
代码示例来源:origin: h2oai/h2o-3
@Test public void testIris() {
ExampleModel emm = null;
Frame fr = null;
try {
long start = System.currentTimeMillis();
System.out.println("Start Parse");
fr = parse_test_file("smalldata/iris/iris_wheader.csv");
System.out.println("Done Parse: "+(System.currentTimeMillis()-start));
ExampleModel.ExampleParameters parms = new ExampleModel.ExampleParameters();
parms._train = fr._key;
parms._max_iterations = 10;
parms._response_column = "class";
Job<ExampleModel> job = new Example(parms).trainModel();
emm = job.get();
job.remove();
} finally {
if( fr != null ) fr .remove();
if( emm != null ) emm.delete();
}
}
}
代码示例来源:origin: h2oai/h2o-3
/**
* Compute quantile-based threshold (in reconstruction error) to find outliers
* @param mse Vector containing reconstruction errors
* @param quantile Quantile for cut-off
* @return Threshold in MSE value for a point to be above the quantile
*/
public double calcOutlierThreshold(Vec mse, double quantile) {
Frame mse_frame = new Frame(Key.<Frame>make(), new String[]{"Reconstruction.MSE"}, new Vec[]{mse});
DKV.put(mse_frame._key, mse_frame);
QuantileModel.QuantileParameters parms = new QuantileModel.QuantileParameters();
parms._train = mse_frame._key;
parms._probs = new double[]{quantile};
Job<QuantileModel> job = new Quantile(parms).trainModel();
QuantileModel kmm = job.get();
job.remove();
double q = kmm._output._quantiles[0][0];
kmm.delete();
DKV.remove(mse_frame._key);
return q;
}
代码示例来源:origin: h2oai/h2o-3
@Test public void testInterpolateWideRange() {
QuantileModel kmm = null;
Frame fr = null;
try {
double[][] d = new double[][]{{1e-100}, {1e-10}, {1e-4}, {1e-2}, {1e-1}, {1}};
fr = ArrayUtils.frame(new String[]{"x"}, d);
QuantileModel.QuantileParameters parms = new QuantileModel.QuantileParameters();
parms._train = fr._key;
parms._probs = new double[]{0,0.25,0.5,0.75,1};
Job<QuantileModel> job = new Quantile(parms).trainModel();
kmm = job.get();
job.remove();
double[] exp = new double[]{1e-100,2.5e-5,5.05e-3,7.75e-2,1};
double[] act = kmm._output._quantiles[0];
for (int i=0;i<exp.length; ++i)
Assert.assertTrue("Got " + act[i] + " but expected " + exp[i], Math.abs(act[i] - exp[i])/exp[i] < 1e-5);
} finally {
if( fr != null ) fr .remove();
if( kmm != null ) kmm.delete();
}
}
@Test public void testInterpolateWideRangeWeighted2() {
代码示例来源:origin: h2oai/h2o-3
@Test public void testInterpolateHighWeighted4() {
QuantileModel kmm = null;
Frame fr = null;
try {
double[][] d = new double[][]{{1, 1.005}, {2, 1}, {3, 1}};
fr = ArrayUtils.frame(new String[]{"x","weights"}, d);
QuantileModel.QuantileParameters parms = new QuantileModel.QuantileParameters();
parms._train = fr._key;
parms._weights_column = "weights";
parms._probs = new double[]{0.71};
Job<QuantileModel> job = new Quantile(parms).trainModel();
kmm = job.get();
job.remove();
Assert.assertTrue("Got: " + kmm._output._quantiles[0][0], Math.abs(kmm._output._quantiles[0][0] - 2.42355)<1e-10);
} finally {
if( fr != null ) fr .remove();
if( kmm != null ) kmm.delete();
}
}
@Test public void testInterpolateHighWeighted5() {
代码示例来源:origin: h2oai/h2o-3
@Test public void testInterpolateHighWeighted8() {
QuantileModel kmm = null;
Frame fr = null;
try {
double[][] d = new double[][]{{1, 2}, {2, 2}, {3, 2}};
fr = ArrayUtils.frame(new String[]{"x","weights"}, d);
QuantileModel.QuantileParameters parms = new QuantileModel.QuantileParameters();
parms._train = fr._key;
parms._weights_column = "weights";
parms._probs = new double[]{0,0.25,0.5,0.75,1};
Job<QuantileModel> job = new Quantile(parms).trainModel();
kmm = job.get();
job.remove();
Assert.assertTrue(Arrays.equals(kmm._output._quantiles[0], new double[]{1,1.25,2,2.75,3}));
} finally {
if( fr != null ) fr .remove();
if( kmm != null ) kmm.delete();
}
}
@Test public void testInterpolateWideRangeWeighted() {
代码示例来源:origin: h2oai/h2o-3
@Test public void testInts() {
QuantileModel kmm = null;
Frame fr = null;
try {
fr = ArrayUtils.frame(new double[][]{{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1},
{2}, {2}, {2}, {2}, {2}, {2}, {2}, {2}, {2}, {2}});
QuantileModel.QuantileParameters parms = new QuantileModel.QuantileParameters();
parms._train = fr._key;
Job<QuantileModel> job = new Quantile(parms).trainModel();
kmm = job.get();
job.remove();
} finally {
if( fr != null ) fr .remove();
if( kmm != null ) kmm.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test public void test50pct() {
QuantileModel kmm = null;
Frame fr = null;
try {
double[][] d = new double[][]{{1.56386606237}, {0.812834256224}, {3.68417563302}, {3.12702210880}, {5.51277746586}};
fr = ArrayUtils.frame(d);
QuantileModel.QuantileParameters parms = new QuantileModel.QuantileParameters();
parms._train = fr._key;
Job<QuantileModel> job = new Quantile(parms).trainModel();
kmm = job.get();
job.remove();
Assert.assertTrue(kmm._output._quantiles[0][5] == d[3][0]);
} finally {
if( fr != null ) fr .remove();
if( kmm != null ) kmm.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test public void testInterpolate2() {
QuantileModel kmm = null;
Frame fr = null;
try {
double[][] d = new double[][]{{1}, {1}, {3}, {2}};
fr = ArrayUtils.frame(d);
QuantileModel.QuantileParameters parms = new QuantileModel.QuantileParameters();
parms._train = fr._key;
parms._probs = new double[]{0.5};
Job<QuantileModel> job = new Quantile(parms).trainModel();
kmm = job.get();
job.remove();
Assert.assertTrue(kmm._output._quantiles[0][0] == 1.5);
} finally {
if( fr != null ) fr .remove();
if( kmm != null ) kmm.delete();
}
}
@Test public void testInterpolateLow() {
代码示例来源:origin: h2oai/h2o-3
@Test public void testInterpolate1() {
QuantileModel kmm = null;
Frame fr = null;
try {
double[][] d = new double[][]{{1}, {1}, {2}, {2}};
fr = ArrayUtils.frame(d);
QuantileModel.QuantileParameters parms = new QuantileModel.QuantileParameters();
parms._train = fr._key;
parms._probs = new double[]{0.5};
Job<QuantileModel> job = new Quantile(parms).trainModel();
kmm = job.get();
job.remove();
Assert.assertTrue(kmm._output._quantiles[0][0] == 1.5);
} finally {
if( fr != null ) fr .remove();
if( kmm != null ) kmm.delete();
}
}
@Test public void testInterpolate2() {
代码示例来源:origin: h2oai/h2o-3
@Test public void testInterpolateHigh() {
QuantileModel kmm = null;
Frame fr = null;
try {
double[][] d = new double[][]{{1}, {2}, {3}};
fr = ArrayUtils.frame(d);
QuantileModel.QuantileParameters parms = new QuantileModel.QuantileParameters();
parms._train = fr._key;
parms._probs = new double[]{0.51};
Job<QuantileModel> job = new Quantile(parms).trainModel();
kmm = job.get();
job.remove();
Assert.assertTrue(kmm._output._quantiles[0][0] == 2.02);
} finally {
if( fr != null ) fr .remove();
if( kmm != null ) kmm.delete();
}
}
@Test public void testInterpolateHighWeighted() {
代码示例来源:origin: h2oai/h2o-3
@Test public void testDirectMatch() {
QuantileModel kmm = null;
Frame fr = null;
try {
double[][] d = new double[][]{{1}, {1}, {1}, {2}};
fr = ArrayUtils.frame(d);
QuantileModel.QuantileParameters parms = new QuantileModel.QuantileParameters();
parms._train = fr._key;
parms._probs = new double[]{0.5};
Job<QuantileModel> job = new Quantile(parms).trainModel();
kmm = job.get();
job.remove();
Assert.assertTrue(kmm._output._quantiles[0][0] == 1);
} finally {
if( fr != null ) fr .remove();
if( kmm != null ) kmm.delete();
}
}
@Test public void testInterpolate1() {
代码示例来源:origin: h2oai/h2o-3
@Test public void testInterpolateLow() {
QuantileModel kmm = null;
Frame fr = null;
try {
double[][] d = new double[][]{{1}, {2}, {3}};
fr = ArrayUtils.frame(d);
QuantileModel.QuantileParameters parms = new QuantileModel.QuantileParameters();
parms._train = fr._key;
parms._probs = new double[]{0.49};
Job<QuantileModel> job = new Quantile(parms).trainModel();
kmm = job.get();
job.remove();
Assert.assertTrue(kmm._output._quantiles[0][0] == 1.98);
} finally {
if( fr != null ) fr .remove();
if( kmm != null ) kmm.delete();
}
}
@Test public void testInterpolateHigh() {
代码示例来源:origin: h2oai/h2o-3
@Test public void testInterpolateHighWeighted2() {
QuantileModel kmm = null;
Frame fr = null;
try {
double[][] d = new double[][]{{1, 2}, {2, 1}, {3, 1}};
fr = ArrayUtils.frame(new String[]{"x","weights"}, d);
QuantileModel.QuantileParameters parms = new QuantileModel.QuantileParameters();
parms._train = fr._key;
parms._weights_column = "weights";
parms._probs = new double[]{0.43};
Job<QuantileModel> job = new Quantile(parms).trainModel();
kmm = job.get();
job.remove();
Assert.assertTrue(kmm._output._quantiles[0][0] == 1.29);
} finally {
if( fr != null ) fr .remove();
if( kmm != null ) kmm.delete();
}
}
@Test public void testInterpolateHighWeighted3() {
代码示例来源:origin: h2oai/h2o-3
@Test public void testInterpolateHighWeighted6() {
QuantileModel kmm = null;
Frame fr = null;
try {
double[][] d = new double[][]{{1, 2}, {2, 2}, {3, 2}};
fr = ArrayUtils.frame(new String[]{"x","weights"}, d);
QuantileModel.QuantileParameters parms = new QuantileModel.QuantileParameters();
parms._train = fr._key;
parms._weights_column = "weights";
parms._probs = new double[]{0.33};
Job<QuantileModel> job = new Quantile(parms).trainModel();
kmm = job.get();
job.remove();
Assert.assertTrue(kmm._output._quantiles[0][0] == 1.65);
} finally {
if( fr != null ) fr .remove();
if( kmm != null ) kmm.delete();
}
}
@Test public void testInterpolateHighWeighted7() {
内容来源于网络,如有侵权,请联系作者删除!