Search in sources :

Example 6 with JsonObject

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

the class Models method summarizeGLMModel.

/**
   * Summarize fields which are specific to hex.glm.GLMModel.
   */
private static void summarizeGLMModel(ModelSummary summary, hex.glm.GLMModel model) {
    // add generic fields such as column names
    summarizeModelCommonFields(summary, model);
    summary.model_algorithm = "GLM";
    JsonObject all_params = (model.get_params()).toJSON();
    summary.critical_parameters = whitelistJsonObject(all_params, GLM_critical_params);
    summary.secondary_parameters = whitelistJsonObject(all_params, GLM_secondary_params);
    summary.expert_parameters = whitelistJsonObject(all_params, GLM_expert_params);
}
Also used : JsonObject(dontweave.gson.JsonObject)

Example 7 with JsonObject

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

the class Models method summarizeDRFModel.

/**
   * Summarize fields which are specific to hex.drf.DRF.DRFModel.
   */
private static void summarizeDRFModel(ModelSummary summary, hex.drf.DRF.DRFModel model) {
    // add generic fields such as column names
    summarizeModelCommonFields(summary, model);
    summary.model_algorithm = "BigData RF";
    JsonObject all_params = (model.get_params()).toJSON();
    summary.critical_parameters = whitelistJsonObject(all_params, DRF_critical_params);
    summary.secondary_parameters = whitelistJsonObject(all_params, DRF_secondary_params);
    summary.expert_parameters = whitelistJsonObject(all_params, DRF_expert_params);
}
Also used : JsonObject(dontweave.gson.JsonObject)

Example 8 with JsonObject

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

the class Models method summarizeGBMModel.

/**
   * Summarize fields which are specific to hex.gbm.GBM.GBMModel.
   */
private static void summarizeGBMModel(ModelSummary summary, hex.gbm.GBM.GBMModel model) {
    // add generic fields such as column names
    summarizeModelCommonFields(summary, model);
    summary.model_algorithm = "GBM";
    JsonObject all_params = (model.get_params()).toJSON();
    summary.critical_parameters = whitelistJsonObject(all_params, GBM_critical_params);
    summary.secondary_parameters = whitelistJsonObject(all_params, GBM_secondary_params);
    summary.expert_parameters = whitelistJsonObject(all_params, GBM_expert_params);
}
Also used : JsonObject(dontweave.gson.JsonObject)

Example 9 with JsonObject

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

the class RemoveAll method serve.

@Override
protected Response serve() {
    try {
        Log.info("Removing all keys for the cluster");
        // First cancel all jobs and wait for them to be done.
        Log.info("Cancelling all jobs...");
        for (Job job : Job.all()) {
            job.cancel();
            Job.waitUntilJobEnded(job.self());
        }
        Log.info("Finished cancelling all jobs");
        RemoveAllKeysTask collector = new RemoveAllKeysTask();
        collector.invokeOnAllNodes();
        Log.info("Finished removing keys");
    } catch (Throwable e) {
        return Response.error(e);
    }
    JsonObject response = new JsonObject();
    return Response.done(response);
}
Also used : RemoveAllKeysTask(water.util.RemoveAllKeysTask) JsonObject(dontweave.gson.JsonObject) Job(water.Job)

Example 10 with JsonObject

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

the class AutoBuffer2JSONTest method testDoubleFromRequest.

// ---- Only Request1 tests for correct JSON
@Test
public void testDoubleFromRequest() {
    JsonObject o = new JsonObject();
    o.addProperty("d1", Double.NaN);
    o.addProperty("d2", Double.POSITIVE_INFINITY);
    o.addProperty("d3", Double.NEGATIVE_INFINITY);
    o.addProperty("d4", 3.141527);
    o = JsonUtil.escape(o);
    Assert.assertEquals("{\"d1\":\"NaN\",\"d2\":\"Infinity\",\"d3\":\"-Infinity\",\"d4\":3.141527}", o.toString());
}
Also used : JsonObject(dontweave.gson.JsonObject)

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