Search in sources :

Example 31 with JsonObject

use of dontweave.gson.JsonObject in project h2o-2 by h2oai.

the class Models method summarizeSpeeDRFModel.

/**
   * Summarize fields which are specific to hex.drf.DRF.SpeeDRFModel.
   */
private static void summarizeSpeeDRFModel(ModelSummary summary, hex.singlenoderf.SpeeDRFModel model) {
    // add generic fields such as column names
    summarizeModelCommonFields(summary, model);
    summary.model_algorithm = "Random Forest";
    JsonObject all_params = (model.get_params()).toJSON();
    summary.critical_parameters = whitelistJsonObject(all_params, SpeeDRF_critical_params);
    summary.secondary_parameters = whitelistJsonObject(all_params, SpeeDRF_secondary_params);
    summary.expert_parameters = whitelistJsonObject(all_params, SpeeDRF_expert_params);
}
Also used : JsonObject(dontweave.gson.JsonObject)

Example 32 with JsonObject

use of dontweave.gson.JsonObject in project h2o-2 by h2oai.

the class TestPoll method serve.

@Override
protected Response serve() {
    ++_counter;
    JsonObject resp = new JsonObject();
    resp.addProperty("hoho", _haha.value());
    resp.addProperty("counter", _counter);
    if (_counter == 10) {
        _counter = 0;
        return Response.done(resp);
    } else {
        return Response.poll(resp, _counter, 10);
    }
}
Also used : JsonObject(dontweave.gson.JsonObject)

Example 33 with JsonObject

use of dontweave.gson.JsonObject in project h2o-2 by h2oai.

the class TestRedirect method serve.

@Override
protected Response serve() {
    JsonObject resp = new JsonObject();
    resp.addProperty("hoho", "hehe");
    return Response.redirect(resp, TestPoll.class, resp);
}
Also used : JsonObject(dontweave.gson.JsonObject)

Example 34 with JsonObject

use of dontweave.gson.JsonObject in project h2o-2 by h2oai.

the class RequestStatics method jsonError.

protected static JsonObject jsonError(String error) {
    JsonObject result = new JsonObject();
    result.addProperty(ERROR, error);
    return result;
}
Also used : JsonObject(dontweave.gson.JsonObject)

Example 35 with JsonObject

use of dontweave.gson.JsonObject in project h2o-2 by h2oai.

the class PutValue method serve.

@Override
public Response serve() {
    JsonObject response = new JsonObject();
    Key k = Key.make(_key.value()._kb, (byte) (int) _rf.value());
    Value v = new Value(k, _value.value().getBytes());
    UKV.put(k, v);
    response.addProperty(KEY, k.toString());
    response.addProperty(REPLICATION_FACTOR, k.desired());
    response.addProperty(VALUE_SIZE, v._max);
    return Response.done(response);
}
Also used : Value(water.Value) JsonObject(dontweave.gson.JsonObject) Key(water.Key)

Aggregations

JsonObject (dontweave.gson.JsonObject)41 JsonElement (dontweave.gson.JsonElement)5 JsonParser (dontweave.gson.JsonParser)4 JsonArray (dontweave.gson.JsonArray)3 Frame (water.fvec.Frame)3 Job (water.Job)2 Value (water.Value)2 JsonPrimitive (dontweave.gson.JsonPrimitive)1 JsonWriter (dontweave.gson.stream.JsonWriter)1 FileWriter (java.io.FileWriter)1 InputStreamReader (java.io.InputStreamReader)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Date (java.util.Date)1 TimerTask (java.util.TimerTask)1 HttpClient (org.apache.commons.httpclient.HttpClient)1 GetMethod (org.apache.commons.httpclient.methods.GetMethod)1 Path (org.apache.hadoop.fs.Path)1 Key (water.Key)1 Timer (water.Timer)1 FrameSummary (water.api.Frames.FrameSummary)1