Search in sources :

Example 6 with Value

use of water.Value in project h2o-2 by h2oai.

the class RemoveAck method serve.

@Override
protected Response serve() {
    Value v = _key.value();
    String key = v._key.toString();
    JsonObject response = new JsonObject();
    response.addProperty(RequestStatics.KEY, key);
    Response r = Response.done(new JsonObject());
    r.addHeader(//
    "" + "<div class='alert alert-error'>Are you sure you want to delete key <strong>" + key + //
    "</strong>?<br/>" + //
    "There is no way back!" + //
    "</div>" + //
    "<div style='text-align:center'>" + //
    "<a href='javascript:history.back()'><button class='btn btn-primary'>No, go back</button></a>" + //
    "&nbsp;&nbsp;&nbsp;" + "<a href='Remove.html?" + KEY + "=" + key + //
    "'><button class='btn btn-danger'>Yes!</button></a>" + "</div>");
    return r;
}
Also used : Value(water.Value) JsonObject(dontweave.gson.JsonObject)

Example 7 with Value

use of water.Value in project h2o-2 by h2oai.

the class VecChunkDemo method frame_001.

@Test
public void frame_001() {
    String fileName = "../smalldata/iris/iris.csv";
    File file = new File(fileName);
    Key fkey = NFSFileVec.make(file);
    Key okey = Key.make("iris.hex");
    Frame fr;
    fr = ParseDataset2.parse(okey, new Key[] { fkey });
    Value v = DKV.get(okey);
    Frame f = v.get();
    Log.info("frame              : " + f);
    int len = f.numCols();
    for (int i = 0; i < len; i++) {
        Log.info("vector                        :" + i);
        // looping through the vectors of a frame and printing specifics
        Vec vv = f.vec(i);
        Log.info("vector     summary                :" + vv);
        Log.info("vector     length                 :" + vv.length());
        Log.info("vector     group                  :" + vv.group());
        Log.info("vector     na count               :" + vv.naCnt());
        // null if not enum
        Log.info("vector     domain null if not enum:" + vv.domain());
        int cardinality = vv.cardinality();
        Log.info("vector     cardianlity            :" + vv.cardinality());
        if (cardinality != -1) {
            for (int j = 0; j < cardinality; j++) Log.info("labels                    :" + vv.domain(j));
        }
        //gives the element at that row; count starts from 0.
        Log.info("vector value at row 50            :" + vv.at(51));
        int chunk_count = vv.nChunks();
        Log.info("chunk     count                   :" + chunk_count);
        Chunk c = vv.chunkForRow(100);
        Log.info("chunk     for row 100             :" + c);
    }
}
Also used : Frame(water.fvec.Frame) Vec(water.fvec.Vec) NFSFileVec(water.fvec.NFSFileVec) Value(water.Value) Chunk(water.fvec.Chunk) File(java.io.File) Key(water.Key) Test(org.junit.Test)

Example 8 with Value

use of water.Value in project h2o-2 by h2oai.

the class GapStatisticProgressPage method toHTML.

@Override
public boolean toHTML(StringBuilder sb) {
    Job jjob = Job.findJob(job_key);
    if (jjob == null)
        return true;
    Value v = DKV.get(jjob.dest());
    if (v != null) {
        GapStatisticModel m = v.get();
        m.generateHTML("Gap Statistic", sb);
    } else
        sb.append("<b>No model yet.</b>");
    return true;
}
Also used : Value(water.Value) Job(water.Job)

Example 9 with Value

use of water.Value in project h2o-3 by h2oai.

the class AstRm method apply.

@Override
public ValNum apply(Env env, Env.StackHelp stk, AstRoot[] asts) {
    Key id = Key.make(env.expand(asts[1].str()));
    Value val = DKV.get(id);
    if (val == null)
        return new ValNum(0);
    if (val.isFrame())
        // Remove unshared Vecs
        env._ses.remove(val.<Frame>get());
    else
        // Normal (e.g. Model) remove
        Keyed.remove(id);
    return new ValNum(1);
}
Also used : Frame(water.fvec.Frame) Value(water.Value) ValNum(water.rapids.vals.ValNum) Key(water.Key)

Example 10 with Value

use of water.Value in project h2o-3 by h2oai.

the class AstTmpAssign method apply.

@Override
public ValFrame apply(Env env, Env.StackHelp stk, AstRoot[] asts) {
    // Note: non-standard evaluation of the first argument! Instead of being
    // executed, it is stringified. This, for example, allows us to write an
    // expression as
    //     (tmp= newid (* frame 3))
    // instead of
    //     (tmp= "newid" (* frame 3))
    // On the other hand, this makes us unable to create dynamic identifiers
    // in Rapids, for example this is invalid:
    //     (tmp= (+ "id" 3) (* frame 3))
    // Right now there is no need for dynamically generated identifiers, since
    // we don't even have proper variables or loops or control structures yet.
    //
    Key<Frame> id = Key.make(env.expand(asts[1].str()));
    Val srcVal = stk.track(asts[2].exec(env));
    Frame srcFrame = srcVal.getFrame();
    Value v = DKV.get(id);
    if (v != null) {
        if (v.get().equals(srcFrame))
            return (ValFrame) srcVal;
        else
            throw new IllegalArgumentException("Temp ID " + id + " already exists");
    }
    Frame dst = new Frame(id, srcFrame._names, srcFrame.vecs());
    // Track new session-wide ID
    return new ValFrame(env._ses.track_tmp(dst));
}
Also used : Val(water.rapids.Val) ValFrame(water.rapids.vals.ValFrame) ValFrame(water.rapids.vals.ValFrame) Frame(water.fvec.Frame) Value(water.Value)

Aggregations

Value (water.Value)10 Job (water.Job)3 Key (water.Key)3 Frame (water.fvec.Frame)3 JsonObject (dontweave.gson.JsonObject)2 File (java.io.File)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Test (org.junit.Test)1 Chunk (water.fvec.Chunk)1 NFSFileVec (water.fvec.NFSFileVec)1 Vec (water.fvec.Vec)1 Val (water.rapids.Val)1 ValFrame (water.rapids.vals.ValFrame)1 ValNum (water.rapids.vals.ValNum)1