Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,12 @@ object DecisionTree extends Serializable with Logging {
val leftWeight = leftCount / totalCount.toDouble
val rightWeight = rightCount / totalCount.toDouble

val gain = impurity - leftWeight * leftImpurity - rightWeight * rightImpurity
val gainRatio = impurity - leftWeight * leftImpurity - rightWeight * rightImpurity
//calculate splitInfo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these lines don't match the project code style. Please read https://cwiki.apache.org/confluence/display/SPARK/Contributing+to+Spark

val splitInfo= -(scala.math.log(leftCount/totalCount.toDouble)
+scala.math.log(rightCount/totalCount.toDouble))/scala.math.log(2)
//C4.5 algorithm instead of ID3 algorithm
val gain=gainRatio/splitInfo

// if information gain doesn't satisfy minimum information gain,
// then this split is invalid, return invalid information gain stats.
Expand Down