Skip to content

Commit

Permalink
Clean files
Browse files Browse the repository at this point in the history
  • Loading branch information
argentea committed Apr 14, 2023
1 parent 5178a6b commit 536f36a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package org.apache.spark.examples.ml

// $example on$
import org.apache.spark.ml.clustering.KMeans
import org.apache.spark.ml.regression.LinearRegression
import org.apache.spark.ml.evaluation.ClusteringEvaluator
// $example off$
import org.apache.spark.sql.SparkSession
Expand Down Expand Up @@ -49,27 +48,21 @@ object KMeansExample {
dataset.cache()

// Trains a k-means model.
println("seem good0")
val kmeans = new KMeans().setK(2).setSeed(1L).setInitMode("random").setMaxIter(5)
val lr = new LinearRegression().setMaxIter(10).setRegParam(0.3).setElasticNetParam(0.8)
println("seem good1")
val lrModel = lr.fit(dataset)
println("seem good2")
val model = kmeans.fit(dataset)
println("seem good3")

// Make predictions
//val predictions = model.transform(dataset)
val predictions = model.transform(dataset)

// Evaluate clustering by computing Silhouette score
//val evaluator = new ClusteringEvaluator()
val evaluator = new ClusteringEvaluator()

//val silhouette = evaluator.evaluate(predictions)
println(s"Silhouette with squared euclidean distance = ")
val silhouette = evaluator.evaluate(predictions)
println(s"Silhouette with squared euclidean distance = $silhouette")

// Shows the result.
println("Cluster Centers: ")
//model.clusterCenters.foreach(println)
model.clusterCenters.foreach(println)
// $example off$

spark.stop()
Expand Down
7 changes: 1 addition & 6 deletions mllib-dal/src/main/java/com/intel/oap/mllib/LibLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ public static synchronized void loadLibraries() throws IOException {
if (isLoaded) {
return;
}
/*
if (!loadLibSYCL()) {
log.debug("SYCL libraries are not available, will load CPU libraries only.");
}
loadLibCCL();
*/

loadLibMLlibDAL();

isLoaded = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ class KMeans @Since("1.5.0") (

instr.logPipelineStage(this)
instr.logDataset(dataset)
System.exit(0)

instr.logParams(this, featuresCol, predictionCol, k, initMode, initSteps, distanceMeasure,
maxIter, seed, tol, weightCol)

Expand Down

0 comments on commit 536f36a

Please sign in to comment.