Skip to content

Commit

Permalink
Upgrade Tablesaw example to use Smile 2.0 (#8217)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Feb 7, 2020
1 parent 5551792 commit 5fef5e9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions doc/groovy/Tablesaw.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"outputs": [],
"source": [
"%%classpath add mvn\n",
"tech.tablesaw tablesaw-beakerx 0.35.0\n",
"com.jimmoores quandl-tablesaw 2.0.0\n",
"com.github.haifengl smile-core 1.5.2"
"tech.tablesaw tablesaw-beakerx 0.37.0\n",
"com.jimmoores quandl-tablesaw 2.1.0\n",
"com.github.haifengl smile-core 2.0.0"
]
},
{
Expand All @@ -33,6 +33,7 @@
"%import tech.tablesaw.api.*\n",
"%import tech.tablesaw.columns.*\n",
"%import smile.clustering.*\n",
"%import smile.data.formula.Formula\n",
"%import smile.regression.*\n",
"\n",
"// display Tablesaw tables with BeakerX table display widget\n",
Expand Down Expand Up @@ -188,7 +189,7 @@
"metadata": {},
"outputs": [],
"source": [
"kMeans = new KMeans(whiskeyData.as().doubleMatrix(\"Body\", \"Sweetness\", \"Smoky\", \"Medicinal\", \"Tobacco\", \"Honey\", \"Spicy\", \"Winey\", \"Nutty\", \"Malty\", \"Fruity\", \"Floral\"), 5)"
"kMeans = KMeans.fit(whiskeyData.as().doubleMatrix(\"Body\", \"Sweetness\", \"Smoky\", \"Medicinal\", \"Tobacco\", \"Honey\", \"Spicy\", \"Winey\", \"Nutty\", \"Malty\", \"Fruity\", \"Floral\"), 5)"
]
},
{
Expand All @@ -197,7 +198,7 @@
"metadata": {},
"outputs": [],
"source": [
"Table whiskeyClusters = Table.create(\"Clusters\", whiskeyData.stringColumn(\"Distillery\"), DoubleColumn.create(\"Cluster\", kMeans.getClusterLabel()));\n",
"Table whiskeyClusters = Table.create(\"Clusters\", whiskeyData.stringColumn(\"Distillery\"), DoubleColumn.create(\"Cluster\", kMeans.y));\n",
"whiskeyClusters = whiskeyClusters.sortAscendingOn(\"Cluster\", \"Distillery\");"
]
},
Expand Down Expand Up @@ -236,7 +237,7 @@
"metadata": {},
"outputs": [],
"source": [
"winsModel = new OLS(moneyball.select(\"W\", \"RD\").smile().numericDataset(\"RD\"));"
"winsModel = OLS.fit(Formula.lhs(\"RD\"), moneyball.select(\"W\", \"RD\").smile().toDataFrame());"
]
},
{
Expand All @@ -245,7 +246,7 @@
"metadata": {},
"outputs": [],
"source": [
"runsScored = new OLS(moneyball.select(\"OBP\", \"SLG\", \"RS\").smile().numericDataset(\"RS\"));"
"runsScored = OLS.fit(Formula.lhs(\"RS\"), moneyball.select(\"OBP\", \"SLG\", \"RS\").smile().toDataFrame());"
]
},
{
Expand Down

0 comments on commit 5fef5e9

Please sign in to comment.