Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues related to code execution #21

Open
X-j-s opened this issue Oct 1, 2023 · 1 comment
Open

Issues related to code execution #21

X-j-s opened this issue Oct 1, 2023 · 1 comment

Comments

@X-j-s
Copy link

X-j-s commented Oct 1, 2023

I would like to ask why my code reported an error:Exception in thread "main" java.lang.AbstractMethodError

object FSTest01 {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setAppName("FS test")
    val sc = new SparkContext(conf)
    val raw = MLUtils.loadLibSVMFile(sc, "a2a.libsvm")
    val data: RDD[LabeledPoint] = raw.map({ case LabeledPoint(label, values) => LabeledPoint(label, Vectors.dense(values.toArray)) })

    val criterion: InfoThCriterionFactory = new InfoThCriterionFactory("mrmr")
    val nToSelect = 5
    val nPartitions = 10

    val featureSelector = new InfoThSelector(criterion, nToSelect, nPartitions).fit(data)

    val redData = data.map { lp =>
      LabeledPoint(lp.label, featureSelector.transform(lp.features))
    }

    println(redData.first().toString())
  }
}

Error reported on the fit line of the code

@X-j-s
Copy link
Author

X-j-s commented Oct 2, 2023

I have solved it because of the Spark version issue. I am using version 2.4.0 and only need to download the source code to change the dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant