Skip to content

Commit

Permalink
implementing code style suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
manishamde committed Mar 25, 2014
1 parent 62dc723 commit e1dd86f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ object DecisionTree extends Serializable with Logging {
new DecisionTree(strategy).train(input: RDD[LabeledPoint])
}

val InvalidBinIndex = -1
private val InvalidBinIndex = -1

/**
* Returns an array of optimal splits for all nodes at a given level
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.spark.mllib.tree.impurity

import javax.naming.OperationNotSupportedException
import java.lang.UnsupportedOperationException

/**
* Class for calculating [[http://en.wikipedia.org/wiki/Binary_entropy_function entropy]] during
Expand Down Expand Up @@ -45,5 +45,5 @@ object Entropy extends Impurity {
}

def calculate(count: Double, sum: Double, sumSquares: Double): Double =
throw new OperationNotSupportedException("Entropy.calculate")
throw new UnsupportedOperationException("Entropy.calculate")
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

package org.apache.spark.mllib.tree.impurity

import javax.naming.OperationNotSupportedException
import java.lang.UnsupportedOperationException

/**
* Class for calculating the [[http://en.wikipedia.org/wiki/Gini_coefficient Gini
* coefficent]] during binary classification
* Class for calculating the [[http://en.wikipedia
* .org/wiki/Decision_tree_learning#Gini_impurity]] during binary classification
*/
object Gini extends Impurity {

Expand All @@ -43,6 +43,6 @@ object Gini extends Impurity {
}

def calculate(count: Double, sum: Double, sumSquares: Double): Double =
throw new OperationNotSupportedException("Gini.calculate")
throw new UnsupportedOperationException("Gini.calculate")

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@

package org.apache.spark.mllib.tree.impurity

import javax.naming.OperationNotSupportedException
import org.apache.spark.Logging
import java.lang.UnsupportedOperationException

/**
* Class for calculating variance during regression
*/
object Variance extends Impurity with Logging {
object Variance extends Impurity {
def calculate(c0: Double, c1: Double): Double
= throw new OperationNotSupportedException("Variance.calculate")
= throw new UnsupportedOperationException("Variance.calculate")

/**
* variance calculation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.spark.mllib.tree.model

import org.apache.spark.Logging
import org.apache.spark.mllib.regression.LabeledPoint
import org.apache.spark.mllib.tree.configuration.FeatureType._

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,15 @@

package org.apache.spark.mllib.tree

import scala.util.Random

import org.scalatest.BeforeAndAfterAll
import org.scalatest.FunSuite

import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._

import org.jblas._
import org.apache.spark.rdd.RDD
import org.apache.spark.mllib.regression.LabeledPoint
import org.apache.spark.mllib.tree.impurity.{Entropy, Gini, Variance}
import org.apache.spark.mllib.tree.model.Filter
import org.apache.spark.mllib.tree.configuration.Strategy
import org.apache.spark.mllib.tree.configuration.Algo._
import scala.collection.mutable
import org.apache.spark.mllib.tree.configuration.FeatureType._

class DecisionTreeSuite extends FunSuite with BeforeAndAfterAll {
Expand Down

0 comments on commit e1dd86f

Please sign in to comment.