Skip to content

Commit

Permalink
[HEX-2014] Generated model provides UUID call.
Browse files Browse the repository at this point in the history
The common interface `IGeneratedModel` now provides
the method 'getUUID' providing a string derived
from model's UniqueId#id.
  • Loading branch information
mmalohlava committed Feb 25, 2015
1 parent c0c176f commit 903f229
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/main/java/water/Model.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
package water;

import static water.util.JCodeGen.toStaticVar;
import hex.ConfusionMatrix;
import hex.VarImp;

import java.util.*;

import javassist.*;
import water.api.*;
import water.api.Request.API;
import water.fvec.Chunk;
import water.fvec.Frame;
import water.fvec.TransfVec;
import water.fvec.Vec;
import water.fvec.*;
import water.serial.AutoBufferSerializer;
import water.util.*;
import water.util.Log.Tag.Sys;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;

import static water.util.JCodeGen.toStaticVar;
import static water.util.Utils.contains;

/**
* A Model models reality (hopefully).
* A model can be used to 'score' a row, or a collection of rows on any
Expand Down Expand Up @@ -658,6 +651,9 @@ protected SB toJavaSuper( SB sb ) {
sb.ii(1);
sb.i().p("public String[] getNames() { return NAMES; } ").nl();
sb.i().p("public String[][] getDomainValues() { return DOMAINS; }").nl();
String uuid = this.uniqueId != null ? this.uniqueId.getId() : this._key.toString();
sb.i().p("public String getUUID() { return ").ps(uuid).p("; }").nl();

return sb;
}
private SB toJavaNAMES( SB sb ) { return JCodeGen.toStaticVar(sb, "NAMES", _names, "Names of columns used by model."); }
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/water/genmodel/IGeneratedModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
* A generic interface to access generated models.
*/
public interface IGeneratedModel {
/** Returns model's unique identifier. */
public String getUUID();

/** Returns number of columns used as input for training (i.e., exclude response column). */
public int getNumCols();

Expand Down

0 comments on commit 903f229

Please sign in to comment.