Skip to content

Instantly share code, notes, and snippets.

@ldacosta
Last active August 29, 2015 14:22
Show Gist options
  • Save ldacosta/173a3be8bc1ec9580ad9 to your computer and use it in GitHub Desktop.
Save ldacosta/173a3be8bc1ec9580ad9 to your computer and use it in GitHub Desktop.
I am not sure how to get the `R` out of the way
case class BrainRecommender[R[_], Path, C[_], CleanedData, KPI, T](actorSystem: ActorSystem,
modelsLocation: R[Path],
readModels: Path => C[Model[Continuous[T]]],
rec: Seq[Continuous[T]] => Recommendation[T])
(implicit opts: Optimizable[Continuous[T]], mR: Monad[R], rC: Read[R, Path, C, Model[Continuous[T]]], fC: Functor[C]) {
def issueRecommendation(): C[BrainRecommendation] = {
val models = mR.map(modelsLocation)(p => fC.map(readModels(p))(m => m))
val RCollOfOptimal = mR.map(models)(collOfModels => fC.map(collOfModels)(m => opts.optimize(m, x => Set.empty)))
mR.map(RCollOfOptimal)(collOfOptimal => fC.map(collOfOptimal)(o => rec(o)))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment