[ML-3775] Add "benchmarkId" to BenchmarkResult (#146)

Add "benchmarkId" to BenchmarkResult, which is based on the benchmark name and a hashed value of params.
This commit is contained in:
ludatabricks 2018-06-04 14:13:45 -07:00 committed by Xiangrui Meng
parent f1139fc742
commit 93626c11b4
2 changed files with 14 additions and 4 deletions

View File

@ -95,13 +95,16 @@ class MLPipelineStageBenchmarkable(
}
val mlMetrics = Array(metricTrainingTime, metricTraining, metricTestTime, metricTest)
val paramsMap = params.toMap
val benchmarkId = name.split('.').last + "_" + paramsMap.hashCode.abs
BenchmarkResult(
name = name,
mode = executionMode.toString,
parameters = params.toMap,
parameters = paramsMap,
executionTime = Some(trainingTime.toMillis),
mlResult = Some(mlMetrics))
mlResult = Some(mlMetrics),
benchmarkId = Some(benchmarkId))
} catch {
case e: Exception =>
BenchmarkResult(

View File

@ -67,6 +67,12 @@ case class BenchmarkConfiguration(
* For example, it can be the number of rows generated by this query or
* the sum of hash values of rows generated by this query.
* @param breakDown The breakdown results of the query plan tree.
* @param queryExecution The query execution plan.
* @param failure The failure message.
* @param mlResult The result metrics specific to MLlib.
* @param benchmarkId An optional ID to identify a series of benchmark runs.
* In ML, this is generated based on the benchmark name and
* the hash value of params.
*/
case class BenchmarkResult(
name: String,
@ -83,7 +89,8 @@ case class BenchmarkResult(
breakDown: Seq[BreakdownResult] = Nil,
queryExecution: Option[String] = None,
failure: Option[Failure] = None,
mlResult: Option[Array[MLMetric]] = None)
mlResult: Option[Array[MLMetric]] = None,
benchmarkId: Option[String] = None)
/**
* The execution time of a subtree of the query plan tree of a specific query.
@ -240,4 +247,4 @@ case class MLMetric(
object MLMetric {
val Invalid = MLMetric("Invalid", 0.0, false)
}
}