[jvm-packages] fix errors in example (#3719)
* add back train method but mark as deprecated * fix scalastyle error * add back train method but mark as deprecated * add back train method but mark as deprecated * add back train method but mark as deprecated * fix scalastyle error * fix scalastyle error * fix scalastyle error * instrumentation * use log console * better measurement * fix erros in example * update histmaker
This commit is contained in:
parent
3b5a1f389a
commit
79d854c695
@ -31,7 +31,7 @@ object SparkMLlibPipeline {
|
|||||||
|
|
||||||
def main(args: Array[String]): Unit = {
|
def main(args: Array[String]): Unit = {
|
||||||
|
|
||||||
if (args.length != 1) {
|
if (args.length != 3) {
|
||||||
println("Usage: SparkMLlibPipeline input_path native_model_path pipeline_model_path")
|
println("Usage: SparkMLlibPipeline input_path native_model_path pipeline_model_path")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
}
|
}
|
||||||
@ -79,6 +79,8 @@ object SparkMLlibPipeline {
|
|||||||
"num_workers" -> 2
|
"num_workers" -> 2
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
booster.setFeaturesCol("features")
|
||||||
|
booster.setLabelCol("classIndex")
|
||||||
val labelConverter = new IndexToString()
|
val labelConverter = new IndexToString()
|
||||||
.setInputCol("prediction")
|
.setInputCol("prediction")
|
||||||
.setOutputCol("realLabel")
|
.setOutputCol("realLabel")
|
||||||
@ -94,6 +96,8 @@ object SparkMLlibPipeline {
|
|||||||
|
|
||||||
// Model evaluation
|
// Model evaluation
|
||||||
val evaluator = new MulticlassClassificationEvaluator()
|
val evaluator = new MulticlassClassificationEvaluator()
|
||||||
|
evaluator.setLabelCol("classIndex")
|
||||||
|
evaluator.setPredictionCol("prediction")
|
||||||
val accuracy = evaluator.evaluate(prediction)
|
val accuracy = evaluator.evaluate(prediction)
|
||||||
println("The model accuracy is : " + accuracy)
|
println("The model accuracy is : " + accuracy)
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class HistMaker: public BaseMaker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/*! \brief a single histogram */
|
/*! \brief a single histogram */
|
||||||
struct HistUnit {
|
struct HistUnit {
|
||||||
/*! \brief cutting point of histogram, contains maximum point */
|
/*! \brief cutting point of histogram, contains maximum point */
|
||||||
const bst_float *cut;
|
const bst_float *cut;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user