示例#1
0
 /// Marshals this model to a JSON DOM.
 JSONObject marshal() {
   JSONObject obj = new JSONObject();
   obj.put("model", model.marshal());
   obj.put("samples", samples.marshal());
   obj.put("contentment", contentment.marshal());
   obj.put("trainPos", trainPos);
   obj.put("trainSize", trainSize);
   obj.put("trainIters", trainIters);
   obj.put("learningRate", learningRate);
   return obj;
 }
示例#2
0
 /// Unmarshaling constructor
 ContentmentModel(JSONObject obj, Random r) {
   rand = r;
   model = new NeuralNet((JSONObject) obj.get("model"));
   samples = new Matrix((JSONObject) obj.get("samples"));
   contentment = new Matrix((JSONObject) obj.get("contentment"));
   trainPos = ((Long) obj.get("trainPos")).intValue();
   trainSize = ((Long) obj.get("trainSize")).intValue();
   trainIters = ((Long) obj.get("trainIters")).intValue();
   learningRate = (Double) obj.get("learningRate");
   targBuf = new double[1];
 }