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 ...