no normalization

This commit is contained in:
Timothy Hunter 2016-06-27 13:32:38 -07:00
parent 87dc42a466
commit 5c1990e4ff
3 changed files with 8 additions and 2 deletions

View File

@ -30,6 +30,10 @@ trait BenchmarkAlgorithm extends Logging {
ctx: MLBenchContext,
trainingSet: DataFrame): Transformer
/**
* The unnormalized score of the training procedure on a dataset. The normalization is
* performed by the caller.
*/
@throws[Exception]("if scoring fails")
def score(
ctx: MLBenchContext,

View File

@ -16,6 +16,7 @@ class MLTransformerBenchmarkable(
private var testData: DataFrame = null
private var trainingData: DataFrame = null
private var testDataCount: Option[Long] = None
private val param = MLBenchContext(params, sqlContext)
override val name = test.name
@ -27,7 +28,7 @@ class MLTransformerBenchmarkable(
try {
testData = test.testDataSet(param)
testData.cache()
testData.count()
testDataCount = Some(testData.count())
trainingData = test.trainingDataSet(param)
trainingData.cache()
trainingData.count()
@ -57,7 +58,7 @@ class MLTransformerBenchmarkable(
trainingTime = Some(trainingTime.toMillis),
trainingMetric = Some(scoreTraining),
testTime = Some(scoreTestTime.toMillis),
testMetric = Some(scoreTest))
testMetric = Some(scoreTest / testDataCount.get))
BenchmarkResult(
name = name,

View File

@ -38,6 +38,7 @@ object LogisticRegression extends BenchmarkAlgorithm
import ctx.params._
val lr = new ml.classification.LogisticRegression()
.setTol(tol)
.setMaxIter(maxIter)
.setRegParam(regParam)
lr.fit(trainingSet)
}