Skip to content

Commit ba1ec1f

Browse files
Merge pull request #7 from aosama/master
Merge upstream changes
2 parents f26cb78 + 428efc3 commit ba1ec1f

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@
4040

4141
<dependencies>
4242

43+
<!-- https://mvnrepository.com/artifact/org.vegas-viz/vegas -->
44+
<dependency>
45+
<groupId>org.vegas-viz</groupId>
46+
<artifactId>vegas_2.11</artifactId>
47+
<version>0.3.11</version>
48+
</dependency>
49+
50+
<!-- https://mvnrepository.com/artifact/org.vegas-viz/vegas-spark -->
51+
<dependency>
52+
<groupId>org.vegas-viz</groupId>
53+
<artifactId>vegas-spark_2.11</artifactId>
54+
<version>0.3.11</version>
55+
</dependency>
56+
4357
<!-- https://mvnrepository.com/artifact/com.crealytics/spark-excel -->
4458
<dependency>
4559
<groupId>com.crealytics</groupId>

src/main/scala/org/ibrahim/ezmachinelearning/DTCensusIncomeExample.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ import org.apache.spark.ml.evaluation.MulticlassClassificationEvaluator
66
import org.apache.spark.ml.feature.{IndexToString, StringIndexer, VectorAssembler}
77
import org.apache.spark.mllib.evaluation.MulticlassMetrics
88
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._
915

1016
object DTCensusIncomeExample extends SharedSparkContext {
1117

@@ -38,6 +44,15 @@ object DTCensusIncomeExample extends SharedSparkContext {
3844
trainingData = formatData(trainingData, fields, continuousFieldIndexes)
3945
testData = formatData(testData, fields, continuousFieldIndexes)
4046

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+
4156
// Create object to convert categorical values to index values
4257
val categoricalIndexerArray =
4358
for (i <- categoricalFieldIndexes)

0 commit comments

Comments
 (0)