Permalink
Browse files

Some style improvements

Also add `.idea` to `.gitignore`.
  • Loading branch information...
mhamilton723 authored and mmlspark-bot committed Jul 13, 2017
1 parent cf4d479 commit 088c9b2ab092a9f2444af8f5bc2d237bfb288e19
View
@@ -21,6 +21,7 @@
# Generic editors
.vscode
.idea
# Common things
*~
@@ -42,6 +42,7 @@ abstract class TestBase extends FunSuite with BeforeAndAfterEachTestData with Be
protected lazy val sc: SparkContext = session.sparkContext
protected lazy val dir = SparkSessionFactory.workingDir
protected def normalizePath(path: String) = SparkSessionFactory.customNormalize(path)
// Timing info
@@ -117,7 +118,7 @@ abstract class TestBase extends FunSuite with BeforeAndAfterEachTestData with Be
val df = Seq(
(0, "guitars", "drums"),
(1, "piano", "trumpet"),
(2, "bass", "cymbals")).toDF("numbers","words", "more")
(2, "bass", "cymbals")).toDF("numbers", "words", "more")
df
}
@@ -135,7 +135,7 @@ class FindBestModel(override val uid: String) extends Estimator[BestModel] with
case _ => throw new Exception("Model type not supported for evaluation")
}
}
parameters += getModelParams(model).toSeq.map { case pv => s"${pv.param.name}: ${pv.value}" }.mkString(", ")
parameters += getModelParams(model).toSeq.map(pv => s"${pv.param.name}: ${pv.value}").mkString(", ")
if (bestMetric.isNaN || operator(currentMetric, bestMetric)) {
bestMetric = currentMetric
selectedModel = model
@@ -83,4 +83,5 @@ class TextFeaturizerSpec extends EstimatorFuzzingTest {
override def getEstimator(): Estimator[_] = new TextFeaturizer()
override def schemaForDataset: StructType = new StructType(Array(StructField(inputCol, StringType, false)))
}
@@ -64,7 +64,7 @@ class TrainRegressor(override val uid: String) extends Estimator[TrainedRegresso
.setLabelCol(labelColumn)
.setFeaturesCol(featuresColumn).asInstanceOf[Estimator[_ <: PipelineStage]]
}
case default @ defaultType if defaultType.isInstanceOf[Estimator[_ <: PipelineStage]] => {
case default@defaultType if defaultType.isInstanceOf[Estimator[_ <: PipelineStage]] => {
// assume label col and features col already set
default
}
@@ -142,7 +142,7 @@ class VerifyTrainRegressor extends EstimatorFuzzingTest {
/** Test helper methods for Train Regressor module. */
object TrainRegressorTestUtilities {
def createLinearRegressor(labelColumn: String): Estimator[TrainedRegressorModel] = {
def createLinearRegressor(labelColumn: String): TrainRegressor = {
val linearRegressor = new LinearRegression()
.setRegParam(0.3)
.setElasticNetParam(0.8)
@@ -152,7 +152,7 @@ object TrainRegressorTestUtilities {
.set(trainRegressor.labelCol, labelColumn)
}
def createRandomForestRegressor(labelColumn: String): Estimator[TrainedRegressorModel] = {
def createRandomForestRegressor(labelColumn: String): TrainRegressor = {
val linearRegressor = new RandomForestRegressor()
.setFeatureSubsetStrategy("auto")
.setMaxBins(32)

0 comments on commit 088c9b2

Please sign in to comment.