EclairJS / eclairjs-nashorn

JavaScript API for Apache Spark
Apache License 2.0
94 stars 11 forks source link

StringIndexer.labels() result can't be jsonified #274

Open doronrosenberg opened 8 years ago

doronrosenberg commented 8 years ago
var StringIndexer = require(EclairJS_Globals.NAMESPACE + '/ml/feature/StringIndexer');
var stringIndexer1 = new StringIndexer();

var SparkContext = require(EclairJS_Globals.NAMESPACE + '/SparkContext');
var jsc = new SparkContext("local[*]", "test");

var SQLContext = require(EclairJS_Globals.NAMESPACE + '/sql/SQLContext');
var sqlcontext1 = new SQLContext(jsc);

var data = sqlcontext1
  .read()
  .format("libsvm")
  .load("/Users/doronrosenberg/mystuff/ibm/eclairjs/git/eclairjs-nashorn/examples/data/mllib/sample_libsvm_data.txt");

var labelIndexer = new StringIndexer()
  .setInputCol("label")
  .setOutputCol("indexedLabel")
  .fit(data);

running JSON.stringify(labelIndexer.labels()) === undefined shows true.