Repository: incubator-hivemall
Updated Branches:
  refs/heads/master e88d74fa4 -> 6c4ec01a4


[HIVEMALL-192] Fix typos: graphvis -> graphviz

## What changes were proposed in this pull request?

Fix crucial typos.

## What type of PR is it?

Improvement

## What is the Jira issue?

https://issues.apache.org/jira/browse/HIVEMALL-192

## Checklist

- [x] Did you apply source code formatter, i.e., `mvn formatter:format`, for 
your commit?

Author: Takuya Kitazawa <[email protected]>

Closes #146 from takuti/HIVEMALL-192.


Project: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-hivemall/commit/6c4ec01a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/tree/6c4ec01a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/diff/6c4ec01a

Branch: refs/heads/master
Commit: 6c4ec01a477f9423b7fc824ada843807d47062f2
Parents: e88d74f
Author: Takuya Kitazawa <[email protected]>
Authored: Wed Apr 18 17:27:01 2018 +0900
Committer: Takuya Kitazawa <[email protected]>
Committed: Wed Apr 18 17:27:01 2018 +0900

----------------------------------------------------------------------
 .../java/hivemall/smile/tools/TreeExportUDF.java    | 15 ++++++++-------
 .../smile/classification/DecisionTreeTest.java      | 16 ++++++++--------
 .../smile/regression/RegressionTreeTest.java        |  6 +++---
 docs/gitbook/binaryclass/titanic_rf.md              |  8 ++++----
 docs/gitbook/multiclass/iris_randomforest.md        |  8 ++++----
 5 files changed, 27 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/6c4ec01a/core/src/main/java/hivemall/smile/tools/TreeExportUDF.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/hivemall/smile/tools/TreeExportUDF.java 
b/core/src/main/java/hivemall/smile/tools/TreeExportUDF.java
index 7d509ad..1d085e3 100644
--- a/core/src/main/java/hivemall/smile/tools/TreeExportUDF.java
+++ b/core/src/main/java/hivemall/smile/tools/TreeExportUDF.java
@@ -62,7 +62,7 @@ public final class TreeExportUDF extends UDFWithOptions {
     protected Options getOptions() {
         Options opts = new Options();
         opts.addOption("t", "type", true,
-            "Type of output [default: js, javascript/js, graphvis/dot");
+            "Type of output [default: js, javascript/js, graphviz/dot");
         opts.addOption("r", "regression", false, "Is regression tree or not");
         opts.addOption("output_name", "outputName", true, "output name 
[default: predicted]");
         return opts;
@@ -141,17 +141,18 @@ public final class TreeExportUDF extends UDFWithOptions {
     }
 
     public enum OutputType {
-        javascript, graphvis;
+        javascript, graphviz;
 
         @Nonnull
         public static OutputType resolve(@Nonnull String name) throws 
UDFArgumentException {
             if ("js".equalsIgnoreCase(name) || 
"javascript".equalsIgnoreCase(name)) {
                 return javascript;
-            } else if ("dot".equalsIgnoreCase(name) || 
"graphvis".equalsIgnoreCase(name)) {
-                return graphvis;
+            } else if ("dot".equalsIgnoreCase(name) || 
"graphviz".equalsIgnoreCase(name)
+                    || "graphvis".equalsIgnoreCase(name)) { // "graphvis" for 
backward compatibility (HIVEMALL-192)
+                return graphviz;
             } else {
                 throw new UDFArgumentException(
-                    "Please provide a valid `-type` option from [javascript, 
graphvis]: " + name);
+                    "Please provide a valid `-type` option from [javascript, 
graphviz]: " + name);
             }
         }
     }
@@ -198,7 +199,7 @@ public final class TreeExportUDF extends UDFWithOptions {
                     node.exportJavascript(buf, featureNames, classNames, 0);
                     break;
                 }
-                case graphvis: {
+                case graphviz: {
                     buf.append("digraph Tree {\n node [shape=box, 
style=\"filled, rounded\", color=\"black\", fontname=helvetica];\n edge 
[fontname=helvetica];\n");
                     double[] colorBrew = (classNames == null) ? null
                             : SmileExtUtils.getColorBrew(classNames.length);
@@ -224,7 +225,7 @@ public final class TreeExportUDF extends UDFWithOptions {
                     node.exportJavascript(buf, featureNames, 0);
                     break;
                 }
-                case graphvis: {
+                case graphviz: {
                     buf.append("digraph Tree {\n node [shape=box, 
style=\"filled, rounded\", color=\"black\", fontname=helvetica];\n edge 
[fontname=helvetica];\n");
                     node.exportGraphviz(buf, featureNames, outputName, new 
MutableInt(0), 0);
                     buf.append("}");

http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/6c4ec01a/core/src/test/java/hivemall/smile/classification/DecisionTreeTest.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/hivemall/smile/classification/DecisionTreeTest.java 
b/core/src/test/java/hivemall/smile/classification/DecisionTreeTest.java
index 897da0c..f24dd58 100644
--- a/core/src/test/java/hivemall/smile/classification/DecisionTreeTest.java
+++ b/core/src/test/java/hivemall/smile/classification/DecisionTreeTest.java
@@ -111,7 +111,7 @@ public class DecisionTreeTest {
     }
 
     @Test
-    public void testGraphvisOutputIris() throws IOException, ParseException, 
HiveException {
+    public void testGraphvizOutputIris() throws IOException, ParseException, 
HiveException {
         String datasetUrl = 
"https://gist.githubusercontent.com/myui/143fa9d05bd6e7db0114/raw/500f178316b802f1cade6e3bf8dc814a96e84b1e/iris.arff";;
         int responseIndex = 4;
         int numLeafs = 4;
@@ -121,18 +121,18 @@ public class DecisionTreeTest {
                 "petalwidth"};
         String[] classNames = new String[] {"setosa", "versicolor", 
"virginica"};
 
-        debugPrint(graphvisOutput(datasetUrl, responseIndex, numLeafs, dense, 
featureNames,
+        debugPrint(graphvizOutput(datasetUrl, responseIndex, numLeafs, dense, 
featureNames,
             classNames, outputName));
 
         featureNames = null;
         classNames = null;
         outputName = null;
-        debugPrint(graphvisOutput(datasetUrl, responseIndex, numLeafs, dense, 
featureNames,
+        debugPrint(graphvizOutput(datasetUrl, responseIndex, numLeafs, dense, 
featureNames,
             classNames, outputName));
     }
 
     @Test
-    public void testGraphvisOutputWeather() throws IOException, 
ParseException, HiveException {
+    public void testGraphvizOutputWeather() throws IOException, 
ParseException, HiveException {
         String datasetUrl = 
"https://gist.githubusercontent.com/myui/2c9df50db3de93a71b92/raw/3f6b4ecfd4045008059e1a2d1c4064fb8a3d372a/weather.nominal.arff";;
         int responseIndex = 4;
         int numLeafs = 3;
@@ -141,16 +141,16 @@ public class DecisionTreeTest {
         String[] classNames = new String[] {"yes", "no"};
         String outputName = "play";
 
-        debugPrint(graphvisOutput(datasetUrl, responseIndex, numLeafs, dense, 
featureNames,
+        debugPrint(graphvizOutput(datasetUrl, responseIndex, numLeafs, dense, 
featureNames,
             classNames, outputName));
 
         featureNames = null;
         classNames = null;
-        debugPrint(graphvisOutput(datasetUrl, responseIndex, numLeafs, dense, 
featureNames,
+        debugPrint(graphvizOutput(datasetUrl, responseIndex, numLeafs, dense, 
featureNames,
             classNames, outputName));
     }
 
-    private static String graphvisOutput(String datasetUrl, int responseIndex, 
int numLeafs,
+    private static String graphvizOutput(String datasetUrl, int responseIndex, 
int numLeafs,
             boolean dense, String[] featureNames, String[] classNames, String 
outputName)
             throws IOException, HiveException, ParseException {
         URL url = new URL(datasetUrl);
@@ -169,7 +169,7 @@ public class DecisionTreeTest {
 
         Text model = new Text(Base91.encode(tree.serialize(true)));
 
-        Evaluator eval = new Evaluator(OutputType.graphvis, outputName, false);
+        Evaluator eval = new Evaluator(OutputType.graphviz, outputName, false);
         Text exported = eval.export(model, featureNames, classNames);
 
         return exported.toString();

http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/6c4ec01a/core/src/test/java/hivemall/smile/regression/RegressionTreeTest.java
----------------------------------------------------------------------
diff --git 
a/core/src/test/java/hivemall/smile/regression/RegressionTreeTest.java 
b/core/src/test/java/hivemall/smile/regression/RegressionTreeTest.java
index 2a0612b..ae45d5f 100644
--- a/core/src/test/java/hivemall/smile/regression/RegressionTreeTest.java
+++ b/core/src/test/java/hivemall/smile/regression/RegressionTreeTest.java
@@ -200,10 +200,10 @@ public class RegressionTreeTest {
         double[] y = {83.0, 88.5, 88.2, 89.5, 96.2, 98.1, 99.0, 100.0, 101.2, 
104.6, 108.4, 110.8,
                 112.6, 114.2, 115.7, 116.9};
 
-        debugPrint(graphvisOutput(x, y, maxLeafs, true, null, outputName));
+        debugPrint(graphvizOutput(x, y, maxLeafs, true, null, outputName));
     }
 
-    private static String graphvisOutput(double[][] x, double[] y, int 
maxLeafs, boolean dense,
+    private static String graphvizOutput(double[][] x, double[] y, int 
maxLeafs, boolean dense,
             String[] featureNames, String outputName) throws IOException, 
HiveException,
             ParseException {
         Attribute[] attrs = new Attribute[x[0].length];
@@ -212,7 +212,7 @@ public class RegressionTreeTest {
 
         Text model = new Text(Base91.encode(tree.serialize(true)));
 
-        Evaluator eval = new Evaluator(OutputType.graphvis, outputName, true);
+        Evaluator eval = new Evaluator(OutputType.graphviz, outputName, true);
         Text exported = eval.export(model, featureNames, null);
 
         return exported.toString();

http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/6c4ec01a/docs/gitbook/binaryclass/titanic_rf.md
----------------------------------------------------------------------
diff --git a/docs/gitbook/binaryclass/titanic_rf.md 
b/docs/gitbook/binaryclass/titanic_rf.md
index 3d51fa8..9e06094 100644
--- a/docs/gitbook/binaryclass/titanic_rf.md
+++ b/docs/gitbook/binaryclass/titanic_rf.md
@@ -247,7 +247,7 @@ sed -i -e "1i PassengerId,Survived" predicted_rf_submit.csv
 
 Accuracy would gives `0.76555` for a Kaggle submission.
 
-# Graphvis export
+# Graphviz export
 
 > #### Note
 > `tree_export` feature is supported from Hivemall v0.5.0 or later.
@@ -266,7 +266,7 @@ usage: tree_export(string model, const string options, 
optional
  -output_name,--outputName <arg>   output name [default: predicted]
  -r,--regression                   Is regression tree or not
  -t,--type <arg>                   Type of output [default: js,
-                                   javascript/js, graphvis/dot
+                                   javascript/js, graphviz/dot
 ```
 
 ```sql
@@ -276,14 +276,14 @@ AS
 select
   model_id,
   tree_export(model, "-type javascript -output_name survived", 
array('pclass','name','sex','age','sibsp','parch','ticket','fare','cabin','embarked'),
 array('no','yes')) as js,
-  tree_export(model, "-type graphvis -output_name survived", 
array('pclass','name','sex','age','sibsp','parch','ticket','fare','cabin','embarked'),
 array('no','yes')) as dot
+  tree_export(model, "-type graphviz -output_name survived", 
array('pclass','name','sex','age','sibsp','parch','ticket','fare','cabin','embarked'),
 array('no','yes')) as dot
 from
   model_rf
 -- limit 1
 ;
 ```
 
-[Here is an 
example](https://gist.github.com/myui/a83ba3795bad9b278cf8bcc59f946e2c#file-titanic-dot)
 plotting a decision tree using Graphvis or [Vis.js](http://viz-js.com/).
+[Here is an 
example](https://gist.github.com/myui/a83ba3795bad9b278cf8bcc59f946e2c#file-titanic-dot)
 plotting a decision tree using Graphviz or [Vis.js](http://viz-js.com/).
 
 ---
 

http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/6c4ec01a/docs/gitbook/multiclass/iris_randomforest.md
----------------------------------------------------------------------
diff --git a/docs/gitbook/multiclass/iris_randomforest.md 
b/docs/gitbook/multiclass/iris_randomforest.md
index 73ea4a3..c173db2 100644
--- a/docs/gitbook/multiclass/iris_randomforest.md
+++ b/docs/gitbook/multiclass/iris_randomforest.md
@@ -319,7 +319,7 @@ WHERE
 ```
 > 0.98
 
-# Graphvis export
+# Graphviz export
 
 > #### Note
 > `tree_export` feature is supported from Hivemall v0.5.0 or later.
@@ -338,7 +338,7 @@ usage: tree_export(string model, const string options, 
optional
  -output_name,--outputName <arg>   output name [default: predicted]
  -r,--regression                   Is regression tree or not
  -t,--type <arg>                   Type of output [default: js,
-                                   javascript/js, graphvis/dot
+                                   javascript/js, graphviz/dot
 ```
 
 ```sql
@@ -348,7 +348,7 @@ AS
 select
   model_id,
   tree_export(model, "-type javascript", 
array('sepal_length','sepal_width','petal_length','petak_width'), 
array('Setosa','Versicolour','Virginica')) as js,
-  tree_export(model, "-type graphvis", 
array('sepal_length','sepal_width','petal_length','petak_width'), 
array('Setosa','Versicolour','Virginica')) as dot
+  tree_export(model, "-type graphviz", 
array('sepal_length','sepal_width','petal_length','petak_width'), 
array('Setosa','Versicolour','Virginica')) as dot
 from
   model
 -- limit 1
@@ -387,6 +387,6 @@ digraph Tree {
 }
 ```
 
-<img src="../resources/images/iris.png" alt="Iris Graphvis output"/>
+<img src="../resources/images/iris.png" alt="Iris Graphviz output"/>
 
 You can draw a graph by `dot -Tpng iris.dot -o iris.png` or using 
[Viz.js](http://viz-js.com/).

Reply via email to