@@ -6,6 +6,12 @@ import org.apache.spark.ml.evaluation.MulticlassClassificationEvaluator
6
6
import org .apache .spark .ml .feature .{IndexToString , StringIndexer , VectorAssembler }
7
7
import org .apache .spark .mllib .evaluation .MulticlassMetrics
8
8
import org .apache .spark .sql .{DataFrame , functions }
9
+ import vegas .sparkExt ._
10
+ import vegas .spec .Spec .Bin
11
+ import vegas .{Line , Quantitative , Vegas }
12
+ import vegas .DSL .SpecBuilder
13
+ import vegas ._
14
+ import vegas .data .External ._
9
15
10
16
object DTCensusIncomeExample extends SharedSparkContext {
11
17
@@ -38,6 +44,15 @@ object DTCensusIncomeExample extends SharedSparkContext {
38
44
trainingData = formatData(trainingData, fields, continuousFieldIndexes)
39
45
testData = formatData(testData, fields, continuousFieldIndexes)
40
46
47
+ trainingData.printSchema()
48
+
49
+ val plot = Vegas (" Age and Income" , width= Option .apply(800d ), height= Option .apply(600d )).
50
+ withDataFrame(trainingData).
51
+ mark(Line ).
52
+ encodeX(" age" , Quantitative , bin= Bin (step= Option .apply(1.0d ) , maxbins= Option .apply(1.0d ) )).
53
+ encodeY(" capital-gain" )
54
+ .show
55
+
41
56
// Create object to convert categorical values to index values
42
57
val categoricalIndexerArray =
43
58
for (i <- categoricalFieldIndexes)
0 commit comments