Skip to content

Instantly share code, notes, and snippets.

@a-agmon
Last active February 26, 2023 12:18
Show Gist options
  • Save a-agmon/ab0cb1366f530248e6986b55a0147d49 to your computer and use it in GitHub Desktop.
Save a-agmon/ab0cb1366f530248e6986b55a0147d49 to your computer and use it in GitHub Desktop.
private def getForecastDatasets(app_id: String,
recordsIterator: Seq[FeaturesRecord]):
Try[(Seq[FeaturesRecord], Seq[FeaturesRecord])] = Try {
val dataPoints = recordsIterator.sortBy(_.ts.getTime)
// ignoring the last observation as it might be be partial
val trainSeq = dataPoints.slice(0, dataPoints.length - 3)
val actualValSeq = dataPoints.slice(dataPoints.length - 3, dataPoints.length - 1)
(trainSeq, actualValSeq)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment