-
Notifications
You must be signed in to change notification settings - Fork 1
/
Example.json
1 lines (1 loc) · 10.8 KB
/
Example.json
1
{"paragraphs":[{"text":"%sh curl \"https://raw.githubusercontent.com/mmatloka/machine-learning-by-example/master/abstracts.csv\" -o abstracts.csv","dateUpdated":"2016-10-14T18:21:18+0000","config":{"colWidth":12,"editorMode":"ace/mode/scala","graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{},"map":{"baseMapType":"Streets","isOnline":true,"pinCols":[]}},"enabled":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1476468863595_-325909425","id":"20161012-204218_760048740","dateCreated":"2016-10-14T18:14:23+0000","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"focus":true,"$$hashKey":"object:218","dateFinished":"2016-10-14T18:21:19+0000","dateStarted":"2016-10-14T18:21:18+0000"},{"text":"import org.apache.spark.sql.functions._\nimport org.apache.spark.ml._\nimport org.apache.spark.ml.feature._\nimport org.apache.spark.ml.classification._\nimport org.apache.spark.ml.evaluation._","dateUpdated":"2016-10-14T18:21:18+0000","config":{"colWidth":12,"editorMode":"ace/mode/scala","graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{},"map":{"baseMapType":"Streets","isOnline":true,"pinCols":[]}},"enabled":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1476468863595_-325909425","id":"20161012-204230_870345712","dateCreated":"2016-10-14T18:14:23+0000","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:219","dateFinished":"2016-10-14T18:21:22+0000","dateStarted":"2016-10-14T18:21:18+0000"},{"text":"val data = spark.read.option(\"header\",\"true\").option(\"delimiter\",\";\").csv(\"abstracts.csv\").cache\n\nz.show(data)","dateUpdated":"2016-10-14T18:21:59+0000","config":{"colWidth":12,"editorMode":"ace/mode/scala","helium":{},"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{},"map":{"baseMapType":"Streets","isOnline":true,"pinCols":[]}},"enabled":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1476468863595_-325909425","id":"20161012-204237_107838897","dateCreated":"2016-10-14T18:14:23+0000","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:220","dateFinished":"2016-10-14T18:22:01+0000","dateStarted":"2016-10-14T18:21:59+0000","focus":true},{"text":"val stringIndexer = new StringIndexer().setInputCol(\"label\").setOutputCol(\"indexedLabel\").fit(data)\n\nval indexed = stringIndexer.transform(data)\nz.show(indexed)","dateUpdated":"2016-10-14T18:21:18+0000","config":{"colWidth":12,"editorMode":"ace/mode/scala","graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{},"map":{"baseMapType":"Streets","isOnline":true,"pinCols":[]}},"enabled":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1476468863596_-327833169","id":"20161013-174102_674414389","dateCreated":"2016-10-14T18:14:23+0000","status":"ERROR","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:221","dateFinished":"2016-10-14T18:21:25+0000","dateStarted":"2016-10-14T18:21:22+0000"},{"text":"val indexToString = new IndexToString()\n.setInputCol(\"prediction\").setOutputCol(\"predictionLabel\")\n.setLabels(stringIndexer.labels)\n\nval sqlTransformer = new SQLTransformer().setStatement(\"SELECT *, concat(title, ' ' , text) AS titleAndText FROM __THIS__\")\n \nval transformed = sqlTransformer.transform(indexed)\nz.show(transformed)","dateUpdated":"2016-10-14T18:21:18+0000","config":{"colWidth":12,"editorMode":"ace/mode/scala","graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{},"map":{"baseMapType":"Streets","isOnline":true,"pinCols":[]}},"enabled":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1476468863596_-327833169","id":"20161013-174337_1823444878","dateCreated":"2016-10-14T18:14:23+0000","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:222","dateFinished":"2016-10-14T18:21:27+0000","dateStarted":"2016-10-14T18:21:24+0000"},{"text":"val regexTokenizer = new RegexTokenizer()\n.setInputCol(\"titleAndText\")\n.setOutputCol(\"words\")\n.setPattern(\"\\\\W+\")\n\nval words = regexTokenizer.transform(transformed)\nz.show(words)","dateUpdated":"2016-10-14T18:21:18+0000","config":{"colWidth":12,"editorMode":"ace/mode/scala","graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{},"map":{"baseMapType":"Streets","isOnline":true,"pinCols":[]}},"enabled":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1476468863596_-327833169","id":"20161013-174458_533107829","dateCreated":"2016-10-14T18:14:23+0000","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:223","dateFinished":"2016-10-14T18:21:29+0000","dateStarted":"2016-10-14T18:21:25+0000"},{"text":"val stopWordsRemover = new StopWordsRemover()\n.setInputCol(\"words\")\n.setOutputCol(\"filtered\")\n\nval filtered = stopWordsRemover.transform(words)\nz.show(filtered)","dateUpdated":"2016-10-14T18:21:18+0000","config":{"colWidth":12,"editorMode":"ace/mode/scala","graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{},"map":{"baseMapType":"Streets","isOnline":true,"pinCols":[]}},"enabled":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1476468863596_-327833169","id":"20161013-174807_1260838266","dateCreated":"2016-10-14T18:14:23+0000","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:224","dateFinished":"2016-10-14T18:21:32+0000","dateStarted":"2016-10-14T18:21:28+0000"},{"text":"val hashingTF = new HashingTF().setInputCol(\"filtered\")\n.setOutputCol(\"features\")\n.setNumFeatures(2048)\n\nval hashed = hashingTF.transform(filtered)\nz.show(hashed)","dateUpdated":"2016-10-14T18:21:18+0000","config":{"colWidth":12,"editorMode":"ace/mode/scala","graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{},"map":{"baseMapType":"Streets","isOnline":true,"pinCols":[]}},"enabled":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1476468863596_-327833169","id":"20161013-174935_820262313","dateCreated":"2016-10-14T18:14:23+0000","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:225","dateFinished":"2016-10-14T18:21:35+0000","dateStarted":"2016-10-14T18:21:30+0000"},{"text":"val naiveBayes = new NaiveBayes().setLabelCol(\"indexedLabel\")\n.setFeaturesCol(\"features\")\n\nval pipeline = new Pipeline().setStages(Array(stringIndexer, sqlTransformer, regexTokenizer, stopWordsRemover, hashingTF, naiveBayes, indexToString))\n\nval Array(trainData, testData) = data.randomSplit(Array(0.75, 0.25))\n\nval model = pipeline.fit(trainData)","dateUpdated":"2016-10-14T18:21:18+0000","config":{"colWidth":12,"editorMode":"ace/mode/scala","graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{},"map":{"baseMapType":"Streets","isOnline":true,"pinCols":[]}},"enabled":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1476468863596_-327833169","id":"20161013-175234_1983146891","dateCreated":"2016-10-14T18:14:23+0000","status":"ERROR","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:226","dateFinished":"2016-10-14T18:21:39+0000","dateStarted":"2016-10-14T18:21:33+0000"},{"text":"val trainPredictions = model.transform(trainData)\nval testPredictions = model.transform(testData)\n\nz.show(testPredictions)","dateUpdated":"2016-10-14T18:21:18+0000","config":{"colWidth":12,"editorMode":"ace/mode/scala","graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{},"map":{"baseMapType":"Streets","isOnline":true,"pinCols":[]}},"enabled":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1476468863596_-327833169","id":"20161013-175638_63185388","dateCreated":"2016-10-14T18:14:23+0000","status":"ERROR","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:227","dateFinished":"2016-10-14T18:21:41+0000","dateStarted":"2016-10-14T18:21:36+0000"},{"text":"val evaluator = new MulticlassClassificationEvaluator()\n.setLabelCol(\"indexedLabel\")\n.setPredictionCol(\"prediction\")\n.setMetricName(\"accuracy\")\n\nval trainAccuracy = evaluator.evaluate(trainPredictions)\nval testAccuracy = evaluator.evaluate(testPredictions)","dateUpdated":"2016-10-14T18:21:18+0000","config":{"colWidth":12,"editorMode":"ace/mode/scala","graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{},"map":{"baseMapType":"Streets","isOnline":true,"pinCols":[]}},"enabled":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1476468863596_-327833169","id":"20161013-175727_265682740","dateCreated":"2016-10-14T18:14:23+0000","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:228","dateFinished":"2016-10-14T18:21:44+0000","dateStarted":"2016-10-14T18:21:40+0000"},{"text":"val newObservations = spark.createDataFrame(Seq(\n (\"Machine learning by example\", \"I will present Spark...\"),\n (\"Docker in Java\", \"...\")\n )).toDF(\"title\",\"text\")\n \nz.show(model.transform(newObservations))","dateUpdated":"2016-10-14T18:21:18+0000","config":{"colWidth":12,"editorMode":"ace/mode/scala","graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{},"map":{"baseMapType":"Streets","isOnline":true,"pinCols":[]}},"enabled":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1476468863596_-327833169","id":"20161013-175926_416704734","dateCreated":"2016-10-14T18:14:23+0000","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:229","dateFinished":"2016-10-14T18:21:45+0000","dateStarted":"2016-10-14T18:21:41+0000"},{"text":"","dateUpdated":"2016-10-14T18:21:18+0000","config":{"colWidth":12,"editorMode":"ace/mode/scala","graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{},"map":{"baseMapType":"Streets","isOnline":true,"pinCols":[]}},"enabled":true},"settings":{"params":{},"forms":{}},"apps":[],"jobName":"paragraph_1476468863596_-327833169","id":"20161013-180111_87146992","dateCreated":"2016-10-14T18:14:23+0000","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:230","dateFinished":"2016-10-14T18:21:45+0000","dateStarted":"2016-10-14T18:21:44+0000"}],"name":"JUG","id":"2BXU9JYH3","angularObjects":{"2BYCPHCEP:shared_process":[],"2BZW27V7Q:shared_process":[],"2BY21FN1G:shared_process":[],"2BZ398E8W:shared_process":[],"2BX22K7JG:shared_process":[],"2BZM92RUN:shared_process":[],"2BXM5RHU4:shared_process":[],"2BXDVZKHG:shared_process":[],"2BXCT99S1:shared_process":[]},"config":{"looknfeel":"default"},"info":{}}