haifengl / smile

Statistical Machine Intelligence & Learning Engine
https://haifengl.github.io
Other
6.02k stars 1.13k forks source link

CDH couldnt find smile/clustering/package$ #685

Closed davidzxc574 closed 3 years ago

davidzxc574 commented 3 years ago

Describe the bug I ran a jar in CDH to use xmeans and it said it couldnt find smile/clustering/package$

Expected behavior It should go through as I ran my codes in in my IDEA with scala 2.11.8 and created a jar which also went through.

Actual behavior Still the the jar did not go through in my CDH.

Code snippet In my idea

package SMILE

import smile.clustering.xmeans

object CLUS {
  def main(args: Array[String]): Unit = {
val arrXmea=Array(Array(...,...,...),Array(...,...,...),..}

    val fitX=xmeans(arrXmea,10)

    println("k:"+fitX.k)
    for(c<-0 to fitX.centroids.length-1) {
      println("centroids:" + fitX.centroids(c)(0)+"-"+fitX.centroids(c)(1)+"-"+fitX.centroids(c)(2))
    }
    println("distortion:"+fitX.distortion)
}}

Input data The sample data. The data does not matter here.


Array(Array(0.565755291175791,0.30837927422351,0.236663422549308),
  Array(0.0908863670362985,0.534987192725906,0.648389666746577),
  Array(0.242136296404339,0.449649682156543,0.570532044663666),
  Array(0.886694014667949,0.531378872451939,0.700894894213928),
  Array(0.247096573367038,0.0731859381580334,0.419300783305591),
  Array(0.0223569443994754,0.249517973320575,0.653560713637633),
  Array(0.573977581889646,0.476099757752661,0.0754153684946489),
  Array(0.650566813867638,0.616373008005604,0.621432073677164),
  Array(0.305118923468235,0.865340696074244,0.152161514752746),
  Array(0.416267330504256,0.137615132756343,0.254073775270852),
  Array(0.190134210995859,0.504552511864544,0.18686873082566),
  Array(0.299725513177783,0.303619581144199,0.439513143962625),
  Array(0.943937033224969,0.889537340124725,0.803714237460312),
  Array(0.87927116088624,0.998856417305787,0.731164230219834),
  Array(0.763288557996562,0.453428620940181,0.0871984314090164),....)

Additional context

Java 1.8 smile-core-2.4.0 smile-scala_2.11-2.4.0 scala 2.11.8.

The jar I created worked on my windows PC although with some warning, SLF4J: Class path contains multiple SLF4J bindings. Error StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

I created a jar with main class jar and library jars seperate in the same folder, with MANIFEST.MF showing class path. Even when I create a folder lib with smile jars within and
spark-submit --class SMILE.CLUS /root/upload/algo/jar/Gupeng.jar -- jars /lib/smile-core-2.4.0.jar,/lib/smile-data-2.4.0.jar,/lib/smile-scala_2.11-2.4.0.jar it failed again with the same error.

haifengl commented 3 years ago

It is clearly an environment setup issue, which is not a problem with smile.