apache spark (in java) machine learning com.github.fommil.netlib.F2jBLAS.dscal(F2jBLAS.java:176) errorIs Java “pass-by-reference” or “pass-by-value”?Does a finally block always get executed in Java?“implements Runnable” vs “extends Thread” in JavaHow to get an enum value from a string value in Java?How do I determine whether an array contains a particular value in Java?How do I convert a String to an int in Java?Creating a memory leak with JavaWhat exactly is Apache Camel?Build order of Maven multimodule project?Migrating existing jersey postgres app to spring boot
Why should I use a big powerstone instead of smaller ones?
Why did the United States not resort to nuclear weapons in Vietnam?
How do I respond appropriately to an overseas company that obtained a visa for me without hiring me?
mv Command Deleted Files In Source Directory and Target Directory
If I buy and download a game through second Nintendo account do I own it on my main account too?
Best Ergonomic Design for a handheld ranged weapon
Security measures that could plausibly last 150+ years?
How to trick a fairly simplistic kill-counter?
Is this mechanically safe?
A coworker mumbles to herself when working. How can I ask her to stop?
Can the additional attack from a Samurai fighter's Rapid Strike feature be made at advantage?
What is my clock telling me to do?
What is the most 'environmentally friendly' way to learn to fly?
Is this popular optical illusion made of a grey-scale image with coloured lines?
How does Asimov's second law deal with contradictory orders from different people?
A game of red and black
Skipping same old introductions
PI 4 screen rotation from the terminal
How do I find SFDX CLI default installation folder on Mac?
How does one get a visa to go to Saudi Arabia?
Reasons for using monsters as bioweapons
The grades of the students in a class
"DDoouubbllee ssppeeaakk!!"
Is it moral to remove/hide certain parts of a photo, as a photographer?
apache spark (in java) machine learning com.github.fommil.netlib.F2jBLAS.dscal(F2jBLAS.java:176) error
Is Java “pass-by-reference” or “pass-by-value”?Does a finally block always get executed in Java?“implements Runnable” vs “extends Thread” in JavaHow to get an enum value from a string value in Java?How do I determine whether an array contains a particular value in Java?How do I convert a String to an int in Java?Creating a memory leak with JavaWhat exactly is Apache Camel?Build order of Maven multimodule project?Migrating existing jersey postgres app to spring boot
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
In java, I want to use the apache spark machine learning library and used sample code from https://spark.apache.org/docs/2.2.0/ml-pipeline.html to use a classifier to fit/ train data and predict on testing data.
But I cannot fit the classifier without a class def not found error.
SparkSession spk = SparkSession.builder().appName("dectreetennis").getOrCreate();
List<Row> dataTraining = Arrays.asList(
RowFactory.create(1.0, Vectors.dense(0.0, 1.1, 0.1)),
RowFactory.create(0.0, Vectors.dense(2.0, 1.0, -1.0)),
RowFactory.create(0.0, Vectors.dense(2.0, 1.3, 1.0)),
RowFactory.create(1.0, Vectors.dense(0.0, 1.2, -0.5))
);
StructType schema = new StructType(new StructField[]
new StructField("activity", DataTypes.DoubleType, false, Metadata.empty()),
new StructField("features", new VectorUDT(), false, Metadata.empty())
);
Dataset<Row> training1 = spk.createDataFrame(dataTraining, schema);
LogisticRegression lr = new LogisticRegression();
System.out.println("LogisticRegression parameters:n" + lr.explainParams() + "n");
lr.setMaxIter(10).setRegParam(0.01);
LogisticRegressionModel model1 = lr.fit(training1);
Here is the contents of the pom file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>javaspark</groupId>
<artifactId>javaspark</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.github.fommil.netlib</groupId>
<artifactId>all</artifactId>
<version>1.1.2</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
I get the following:
Exception in thread "main" java.lang.NoClassDefFoundError: org/netlib/blas/Dscal
at com.github.fommil.netlib.F2jBLAS.dscal(F2jBLAS.java:176)
at org.apache.spark.ml.linalg.BLAS$.scal(BLAS.scala:223)
at org.apache.spark.ml.classification.LogisticAggregator.gradient(LogisticRegression.scala:1069)
java apache-spark apache-spark-sql apache-spark-mllib
add a comment |
In java, I want to use the apache spark machine learning library and used sample code from https://spark.apache.org/docs/2.2.0/ml-pipeline.html to use a classifier to fit/ train data and predict on testing data.
But I cannot fit the classifier without a class def not found error.
SparkSession spk = SparkSession.builder().appName("dectreetennis").getOrCreate();
List<Row> dataTraining = Arrays.asList(
RowFactory.create(1.0, Vectors.dense(0.0, 1.1, 0.1)),
RowFactory.create(0.0, Vectors.dense(2.0, 1.0, -1.0)),
RowFactory.create(0.0, Vectors.dense(2.0, 1.3, 1.0)),
RowFactory.create(1.0, Vectors.dense(0.0, 1.2, -0.5))
);
StructType schema = new StructType(new StructField[]
new StructField("activity", DataTypes.DoubleType, false, Metadata.empty()),
new StructField("features", new VectorUDT(), false, Metadata.empty())
);
Dataset<Row> training1 = spk.createDataFrame(dataTraining, schema);
LogisticRegression lr = new LogisticRegression();
System.out.println("LogisticRegression parameters:n" + lr.explainParams() + "n");
lr.setMaxIter(10).setRegParam(0.01);
LogisticRegressionModel model1 = lr.fit(training1);
Here is the contents of the pom file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>javaspark</groupId>
<artifactId>javaspark</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.github.fommil.netlib</groupId>
<artifactId>all</artifactId>
<version>1.1.2</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
I get the following:
Exception in thread "main" java.lang.NoClassDefFoundError: org/netlib/blas/Dscal
at com.github.fommil.netlib.F2jBLAS.dscal(F2jBLAS.java:176)
at org.apache.spark.ml.linalg.BLAS$.scal(BLAS.scala:223)
at org.apache.spark.ml.classification.LogisticAggregator.gradient(LogisticRegression.scala:1069)
java apache-spark apache-spark-sql apache-spark-mllib
You might need to define f2j dependency as well asnetlib
is declared pom-only
– ollik1
Mar 27 at 6:25
add a comment |
In java, I want to use the apache spark machine learning library and used sample code from https://spark.apache.org/docs/2.2.0/ml-pipeline.html to use a classifier to fit/ train data and predict on testing data.
But I cannot fit the classifier without a class def not found error.
SparkSession spk = SparkSession.builder().appName("dectreetennis").getOrCreate();
List<Row> dataTraining = Arrays.asList(
RowFactory.create(1.0, Vectors.dense(0.0, 1.1, 0.1)),
RowFactory.create(0.0, Vectors.dense(2.0, 1.0, -1.0)),
RowFactory.create(0.0, Vectors.dense(2.0, 1.3, 1.0)),
RowFactory.create(1.0, Vectors.dense(0.0, 1.2, -0.5))
);
StructType schema = new StructType(new StructField[]
new StructField("activity", DataTypes.DoubleType, false, Metadata.empty()),
new StructField("features", new VectorUDT(), false, Metadata.empty())
);
Dataset<Row> training1 = spk.createDataFrame(dataTraining, schema);
LogisticRegression lr = new LogisticRegression();
System.out.println("LogisticRegression parameters:n" + lr.explainParams() + "n");
lr.setMaxIter(10).setRegParam(0.01);
LogisticRegressionModel model1 = lr.fit(training1);
Here is the contents of the pom file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>javaspark</groupId>
<artifactId>javaspark</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.github.fommil.netlib</groupId>
<artifactId>all</artifactId>
<version>1.1.2</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
I get the following:
Exception in thread "main" java.lang.NoClassDefFoundError: org/netlib/blas/Dscal
at com.github.fommil.netlib.F2jBLAS.dscal(F2jBLAS.java:176)
at org.apache.spark.ml.linalg.BLAS$.scal(BLAS.scala:223)
at org.apache.spark.ml.classification.LogisticAggregator.gradient(LogisticRegression.scala:1069)
java apache-spark apache-spark-sql apache-spark-mllib
In java, I want to use the apache spark machine learning library and used sample code from https://spark.apache.org/docs/2.2.0/ml-pipeline.html to use a classifier to fit/ train data and predict on testing data.
But I cannot fit the classifier without a class def not found error.
SparkSession spk = SparkSession.builder().appName("dectreetennis").getOrCreate();
List<Row> dataTraining = Arrays.asList(
RowFactory.create(1.0, Vectors.dense(0.0, 1.1, 0.1)),
RowFactory.create(0.0, Vectors.dense(2.0, 1.0, -1.0)),
RowFactory.create(0.0, Vectors.dense(2.0, 1.3, 1.0)),
RowFactory.create(1.0, Vectors.dense(0.0, 1.2, -0.5))
);
StructType schema = new StructType(new StructField[]
new StructField("activity", DataTypes.DoubleType, false, Metadata.empty()),
new StructField("features", new VectorUDT(), false, Metadata.empty())
);
Dataset<Row> training1 = spk.createDataFrame(dataTraining, schema);
LogisticRegression lr = new LogisticRegression();
System.out.println("LogisticRegression parameters:n" + lr.explainParams() + "n");
lr.setMaxIter(10).setRegParam(0.01);
LogisticRegressionModel model1 = lr.fit(training1);
Here is the contents of the pom file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>javaspark</groupId>
<artifactId>javaspark</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.github.fommil.netlib</groupId>
<artifactId>all</artifactId>
<version>1.1.2</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
I get the following:
Exception in thread "main" java.lang.NoClassDefFoundError: org/netlib/blas/Dscal
at com.github.fommil.netlib.F2jBLAS.dscal(F2jBLAS.java:176)
at org.apache.spark.ml.linalg.BLAS$.scal(BLAS.scala:223)
at org.apache.spark.ml.classification.LogisticAggregator.gradient(LogisticRegression.scala:1069)
java apache-spark apache-spark-sql apache-spark-mllib
java apache-spark apache-spark-sql apache-spark-mllib
edited Mar 28 at 20:41
Sian Yuan
asked Mar 26 at 23:40
Sian YuanSian Yuan
11 bronze badge
11 bronze badge
You might need to define f2j dependency as well asnetlib
is declared pom-only
– ollik1
Mar 27 at 6:25
add a comment |
You might need to define f2j dependency as well asnetlib
is declared pom-only
– ollik1
Mar 27 at 6:25
You might need to define f2j dependency as well as
netlib
is declared pom-only– ollik1
Mar 27 at 6:25
You might need to define f2j dependency as well as
netlib
is declared pom-only– ollik1
Mar 27 at 6:25
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55367722%2fapache-spark-in-java-machine-learning-com-github-fommil-netlib-f2jblas-dscalf%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55367722%2fapache-spark-in-java-machine-learning-com-github-fommil-netlib-f2jblas-dscalf%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You might need to define f2j dependency as well as
netlib
is declared pom-only– ollik1
Mar 27 at 6:25