@Override public boolean toHTML(StringBuilder sb) { if (classification) { DocGen.HTML.section(sb, "Confusion Matrix"); if (cm == null) return true; printConfusionMatrix(sb, cm, domain, true); } else { DocGen.HTML.section(sb, "Mean Squared Error"); if (mse == Double.NaN) return true; DocGen.HTML.arrayHead(sb); sb.append("<tr class='warning'><td>" + mse + "</td></tr>"); DocGen.HTML.arrayTail(sb); } return true; }
@Override public boolean toHTML(StringBuilder sb) { if (jobs != null) { DocGen.HTML.arrayHead(sb); sb.append("<tr class='warning'>"); ArrayList<Argument> args = jobs[0].arguments(); // Filter some keys to simplify UI args = (ArrayList<Argument>) args.clone(); filter( args, "destination_key", "source", "cols", "ignored_cols_by_name", "response", "classification", "validation"); for (int i = 0; i < args.size(); i++) sb.append("<td><b>").append(args.get(i)._name).append("</b></td>"); sb.append("<td><b>").append("run time").append("</b></td>"); String perf = jobs[0].speedDescription(); if (perf != null) sb.append("<td><b>").append(perf).append("</b></td>"); sb.append("<td><b>").append("model key").append("</b></td>"); sb.append("<td><b>").append("prediction error").append("</b></td>"); sb.append("<td><b>").append("F1 score").append("</b></td>"); sb.append("</tr>"); ArrayList<JobInfo> infos = new ArrayList<JobInfo>(); for (Job job : jobs) { JobInfo info = new JobInfo(); info._job = job; Object value = UKV.get(job.destination_key); info._model = value instanceof Model ? (Model) value : null; if (info._model != null) info._cm = info._model.cm(); if (info._cm != null) info._error = info._cm.err(); infos.add(info); } Collections.sort( infos, new Comparator<JobInfo>() { @Override public int compare(JobInfo a, JobInfo b) { return Double.compare(a._error, b._error); } }); for (JobInfo info : infos) { sb.append("<tr>"); for (Argument a : args) { try { Object value = a._field.get(info._job); String s; if (value instanceof int[]) s = Utils.sampleToString((int[]) value, 20); else s = "" + value; sb.append("<td>").append(s).append("</td>"); } catch (Exception e) { throw new RuntimeException(e); } } String runTime = "Pending", speed = ""; if (info._job.start_time != 0) { runTime = PrettyPrint.msecs(info._job.runTimeMs(), true); speed = perf != null ? PrettyPrint.msecs(info._job.speedValue(), true) : ""; } sb.append("<td>").append(runTime).append("</td>"); if (perf != null) sb.append("<td>").append(speed).append("</td>"); String link = info._job.destination_key.toString(); if (info._job.start_time != 0 && DKV.get(info._job.destination_key) != null) { if (info._model instanceof GBMModel) link = GBMModelView.link(link, info._job.destination_key); else if (info._model instanceof NeuralNetModel) link = NeuralNetProgress.link(info._job.self(), info._job.destination_key, link); if (info._model instanceof KMeans2Model) link = KMeans2ModelView.link(link, info._job.destination_key); else link = Inspect.link(link, info._job.destination_key); } sb.append("<td>").append(link).append("</td>"); String pct = "", f1 = ""; if (info._cm != null) { pct = String.format("%.2f", 100 * info._error) + "%"; if (info._cm._arr.length == 2) f1 = String.format("%.2f", info._cm.precisionAndRecall()); } sb.append("<td><b>").append(pct).append("</b></td>"); sb.append("<td><b>").append(f1).append("</b></td>"); sb.append("</tr>"); } DocGen.HTML.arrayTail(sb); } return true; }