Dl4j Scala quickstart

Hi Community

I am very new to Dl4j and has setup the environment with Scala in IntelliJ Idea.
While following the quickstart Dl4j Tutorial, Idea is showing a bunch of red lines. Dl4j_Scala|486x500

I would appreciate any help provided regarding a fix or workaround for this.

Thanks and Regards

It looks like your problem is in line 61. Instead of assigning the built config to your variable, you are assigning just the builder. All of the errors that follow are because of that.

Thanks Treo!

I’ve been able to remove all red lines now, but am getting build error - “value stats is not a member of Nothing”.

Please help fix this as well.

Similar error is thrown on using accuracy(), precision(), etc.
Even if I remove stats() from the lines please let me know how to view different evaluation results.

There you run into a peculiarity with Scala, it fails to infer the return type of evaluate and thinks it is Nothing while it actually is Evaluation. You should be able to replace it with evaluate[Evaluation] and evaluateROC[ROC] and things should work fine then.

Hi Treo

org.deeplearning4j.eval.Evaluation and ROC are showing depreciated.

Below is my build.sbt

name := “LearnDl4j”

version := “0.1”

scalaVersion := “2.13.1”

libraryDependencies ++= Seq(
“org.deeplearning4j” % “deeplearning4j-cuda-10.0” % “1.0.0-beta6”,
“org.nd4j” % “nd4j-native-platform” % “1.0.0-beta6”

I think it might be something to do with library versions.

Yes. We’ve moved those classes into ND4J, so if you import those classes from there, it will be just fine.

The deprecated classes have been left for compatibility with older versions.

1 Like

Hi Treo

A heartful thanks for the helping hand and pulling me to the world of DL4J. Now I’ve been able to remove all build and runtime errors and succeeded to take the first step in learning DL4J. Looking forward to the learning.