Ejemplo n.º 1
0
 public void toHTML(StringBuilder sb) {
   sb.append("<li><a href='");
   sb.append(_request.href() + _request.hrefType()._suffix);
   sb.append("'>");
   sb.append(_name);
   sb.append("</a></li>");
 }
Ejemplo n.º 2
0
 public final void print() {
   StringBuilder sb = new StringBuilder();
   sb.append("I: ").append(_iteration).append("[");
   double[][] c = clusters();
   for (int i = 0; i < c.length; i++) sb.append(c[i][2]).append(",");
   sb.append("]");
   Log.debug(Sys.KMEAN, sb);
 }
Ejemplo n.º 3
0
 /**
  * Print a summary table
  *
  * @return String containing ASCII version of summary table
  */
 @Override
 public String toString() {
   StringBuilder sb = new StringBuilder();
   if (get_params()._diagnostics && !get_params()._quiet_mode) {
     if (get_params()._sparsity_beta > 0) {
       for (int k = 0; k < get_params()._hidden.length; k++) {
         sb.append("Average activation in hidden layer ")
             .append(k)
             .append(" is  ")
             .append(mean_a[k])
             .append(" \n");
       }
     }
     createSummaryTable();
     sb.append(summaryTable.toString(1));
   }
   return sb.toString();
 }
Ejemplo n.º 4
0
 @Override
 protected void generateModelDescription(StringBuilder sb) {
   DocGen.HTML.paragraph(
       sb, "mtries: " + mtries + ", Sample rate: " + sample_rate + ", Seed: " + seed);
   if (testKey == null && sample_rate == 1f) {
     sb.append(
         "<div class=\"alert alert-danger\">There are now OOB data to report out-of-bag error, since sampling rate is 100%!</div>");
   }
 }
Ejemplo n.º 5
0
 /**
  * Annotate the used and ignored columns in the job parameter JSON For both the used and the
  * ignored columns, the following rules apply: If the number of columns is less or equal than
  * 100, a dense list of used columns is reported. If the number of columns is greater than 100,
  * the number of columns is reported. If the number of columns is 0, a "N/A" is reported.
  *
  * @return JsonObject annotated with used/ignored columns
  */
 @Override
 public JsonObject toJSON() {
   JsonObject jo = super.toJSON();
   if (!jo.has("source") || source == null) return jo;
   HashMap<String, int[]> map = new HashMap<String, int[]>();
   map.put("used_cols", cols);
   map.put("ignored_cols", ignored_cols);
   for (String key : map.keySet()) {
     int[] val = map.get(key);
     if (val != null) {
       if (val.length > 100) jo.getAsJsonObject("source").addProperty("num_" + key, val.length);
       else if (val.length > 0) {
         StringBuilder sb = new StringBuilder();
         for (int c : val) sb.append(c + ",");
         jo.getAsJsonObject("source")
             .addProperty(key, sb.toString().substring(0, sb.length() - 1));
       } else {
         jo.getAsJsonObject("source").add(key, JsonNull.INSTANCE);
       }
     }
   }
   return jo;
 }
Ejemplo n.º 6
0
 public static void initializeNavBar() {
   StringBuilder sb = new StringBuilder();
   for (String s : _navbarOrdering) {
     ArrayList<MenuItem> arl = _navbar.get(s);
     if ((arl.size() == 1) && arl.get(0)._name.equals(s)) {
       arl.get(0).toHTML(sb);
     } else {
       sb.append("<li class='dropdown'>");
       sb.append("<a href='#' class='dropdown-toggle' data-toggle='dropdown'>");
       sb.append(s);
       sb.append("<b class='caret'></b>");
       sb.append("</a>");
       sb.append("<ul class='dropdown-menu'>");
       for (MenuItem i : arl) i.toHTML(sb);
       sb.append("</ul></li>");
     }
   }
   RString str = new RString(_htmlTemplate);
   str.replace("NAVBAR", sb.toString());
   str.replace("CONTENTS", "%CONTENTS");
   _htmlTemplate = str.toString();
 }
Ejemplo n.º 7
0
  /**
   * Debugging printout
   *
   * @return String with useful info
   */
  public String toStringAll() {
    StringBuilder sb = new StringBuilder();
    sb.append(toString());

    for (int i = 0; i < units.length - 1; ++i)
      sb.append("\nweights[")
          .append(i)
          .append("][]=")
          .append(Arrays.toString(get_weights(i).raw()));
    for (int i = 0; i < units.length - 1; ++i) {
      sb.append("\nbiases[").append(i).append("][]=").append(Arrays.toString(get_biases(i).raw()));
    }
    if (has_momenta()) {
      for (int i = 0; i < units.length - 1; ++i)
        sb.append("\nweights_momenta[")
            .append(i)
            .append("][]=")
            .append(Arrays.toString(get_weights_momenta(i).raw()));
    }
    if (biases_momenta != null) {
      for (int i = 0; i < units.length - 1; ++i) {
        sb.append("\nbiases_momenta[")
            .append(i)
            .append("][]=")
            .append(Arrays.toString(biases_momenta[i].raw()));
      }
    }
    sb.append("\nunits[]=").append(Arrays.toString(units));
    sb.append("\nprocessed global: ").append(get_processed_global());
    sb.append("\nprocessed local:  ").append(get_processed_local());
    sb.append("\nprocessed total:  ").append(get_processed_total());
    sb.append("\n");
    return sb.toString();
  }