This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Miss Bell | |
Lars Hupel | |
John DeGoes | |
Tony Morris | |
Emily Pilmore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class IO[A](unsafePerformIO: () => A) { | |
def map[B](ab: A => B): IO[B] = IO(() => ab(unsafePerformIO())) | |
def flatMap[B](afb: A => IO[B]): IO[B] =IO(() => afb(unsafePerformIO()).unsafePerformIO()) | |
def tryIO(ta: Throwable => A): IO[A] = | |
val attempt = IO(() => IO.tryIO(unsafePerformIO()) // lift IO[A] to IO[Either[Throwable,A]] | |
attempt.unsafePerformIO() match { | |
case Left(t) => ta(t) | |
case Right(a) => a | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import javax.inject._ | |
import play.api._ | |
import play.api.mvc._ | |
import play.api.libs.json._ | |
import play.api.libs.functional.syntax._ | |
import JsonFormats._ | |
/** | |
* This controller creates an `Action` to handle HTTP requests to the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IndexProcess private (config: Config) { | |
// e.g. | |
// index { | |
// entities { | |
// slide { | |
// products: {to: many, is: product} | |
// sites: {to: many, is: site} | |
// } | |
// site: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val formattedPredictions: List[Option[String]] = predictions.map(_.classPredictions.headOption.map(_.prediction)) | |
val formattedLabels: List[Option[String]] = data.map(_.label) | |
val (guesses, truths): (List[String], List[String]) = ( | |
for { | |
(guess, truth) <- formattedPredictions zip formattedLabels | |
realGuess <- guess | |
realTruth <- truth | |
}yield(realGuess, realTruth) | |
).unzip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package algorithmia.TechSupport | |
import algorithmia.TechSupport.Classes.DataPoint | |
import argonaut.Argonaut._ | |
import argonaut.CodecJson | |
import argonaut._ | |
/** | |
* Created by james on 05/01/17. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Input { | |
implicit def inputCodec: CodecJson[Input] = { | |
def encoder(data: Input): Json = | |
data match { | |
case train: Train => Train.trainCodec.encode(train) | |
case predict: Predict => Predict.predictCodec.encode(predict) | |
} | |
def decoder(json: HCursor): DecodeResult[Input] = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package algorithmia.TechSupport | |
import algorithmia.TechSupport.Classes.DataPoint | |
import argonaut.Argonaut._ | |
import argonaut.CodecJson | |
/** | |
* Created by james on 05/01/17. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//converts any serializable class into json using shapeless | |
def write[A](input: A)(implicit encoder: EncodeJson[A]): Json = { | |
val json = encoder(input) | |
json | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def apply(input: String): String = { | |
val output = | |
Utils.read[SealedTraitParent](input) match { | |
case Some(predict: Predict) => | |
println(predict) | |
predict.process(client) | |
case Some(train: Training) => | |
println(train) | |
train.process(client) | |
case None => |
NewerOlder