O'Reilly logo

Scala Machine Learning Projects by Md. Rezaul Karim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The backend

In the backend, I encapsulated the preceding Q-learning implementation and additionally created a Scala controller that controls the model behavior from the frontend. The structure is given here:

import java.nio.file.Pathsimport org.codehaus.janino.Javaimport ml.stats.TSeries.{normalize, zipWithShift}import ml.workflow.data.DataSourceimport ml.trading.OptionModelimport ml.Predef.{DblPair, DblVec}import ml.reinforcement.qlearning.{QLConfig, QLModel, QLearning}import scala.util.{Failure, Success, Try}import play.api._import play.api.data.Formimport play.api.libs.json._import play.api.mvc._import scala.util.{Failure, Success, Try}class API extends Controller {    protected val name: String = "Q-learning"    private var sPath = Paths.get((s"${"public/data/IBM.csv"}")).toAbsolutePath.toString ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required