- Scala Machine Learning Projects
- Md. Rezaul Karim
- 276字
- 2025-02-14 21:30:16
Project structure
The wrapped up Scala web ML app has the following directory structure:

In the preceding structure, bitcoin_ml folder has all the backend and frontend codes. The models folder has all the trained models. An example-trained model is given in the gbt_22_binary_classes_32660767 folder. Finally, database files and traces are there in the DataBase.mv.db and DataBase.trace.db files respectively.
Then let us see the sub-folder structure of the bitcoin_ml folder that contains the actual codes:

In the preceding figure, the conf folder has the Scala web app configuration file, application.conf containing necessary configurations (as shown already). All the dependencies are defined in the build.sbt file shown as follows:
libraryDependencies ++= Seq(jdbc, evolutions,
"com.typesafe.play" %% "anorm" % "2.5.1",
cache, ws, specs2 % Test, ws)
unmanagedResourceDirectories in Test <+= baseDirectory(_ / "target/web/public/test")
resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases"
resolvers ++= Seq(
"apache-snapshots" at "http://repository.apache.org/snapshots/")
routesGenerator := InjectedRoutesGenerator
val sparkVersion = "2.2.0"
libraryDependencies += "org.apache.spark" %% "spark-mllib" % sparkVersion
libraryDependencies += "org.apache.hadoop" % "hadoop-mapreduce-client-core" % "2.7.2"
libraryDependencies += "org.apache.hadoop" % "hadoop-common" % "2.7.2"
libraryDependencies += "commons-io" % "commons-io" % "2.4"
libraryDependencies += "org.codehaus.janino" % "janino" % "3.0.7" //fixing "java.lang.ClassNotFoundException: de.unkrig.jdisasm.Disassembler" exception
libraryDependencies ++= Seq(
"com.typesafe.slick" %% "slick" % "3.1.1",
"org.slf4j" % "slf4j-nop" % "1.6.4"
)
To be frank, at the beginning of writing, I did not think of wrapping up this application as a Scala Play web app. Therefore, things went a bit unstructured. However, do not worry to know more about backend as well frontend, refer to the options trading application in Chapter 7, Options Trading Using Q-Learning and Scala Play Framework.