Skip to content

Commit

Permalink
Some style improvements
Browse files Browse the repository at this point in the history
Also add `.idea` to `.gitignore`.
  • Loading branch information
mhamilton723 authored and mmlspark-bot committed Jul 13, 2017
1 parent cf4d479 commit 088c9b2
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

# Generic editors
.vscode
.idea

# Common things
*~
Expand Down
3 changes: 2 additions & 1 deletion src/core/test/base/src/main/scala/TestBase.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion src/find-best-model/src/main/scala/FindBestModel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

}
2 changes: 1 addition & 1 deletion src/train-regressor/src/main/scala/TrainRegressor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions src/train-regressor/src/test/scala/VerifyTrainRegressor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 088c9b2

Please sign in to comment.