Skip to content

Commit

Permalink
minor: fixed scalastyle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
manishamde committed Jul 14, 2014
1 parent b2ae41f commit 4e85f2c
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,8 @@ object DecisionTree extends Serializable with Logging {
logDebug("isMulticlassClassification = " + isMulticlassClassification)
val isMulticlassClassificationWithCategoricalFeatures
= strategy.isMulticlassWithCategoricalFeatures
logDebug("isMultiClassWithCategoricalFeatures = " + isMulticlassClassificationWithCategoricalFeatures)
logDebug("isMultiClassWithCategoricalFeatures = " +
isMulticlassClassificationWithCategoricalFeatures)

// shift when more than one group is used at deep tree level
val groupShift = numNodes * groupIndex
Expand Down Expand Up @@ -643,7 +644,8 @@ object DecisionTree extends Serializable with Logging {
val arrIndex = arrShift + featureIndex
// Update the left or right count for one bin.
val aggShift = numClasses * numBins * numFeatures * nodeIndex
val aggIndex = aggShift + numClasses * featureIndex * numBins + arr(arrIndex).toInt * numClasses
val aggIndex = aggShift + numClasses * featureIndex * numBins
+ arr(arrIndex).toInt * numClasses
val labelInt = label.toInt
agg(aggIndex + labelInt) = agg(aggIndex + labelInt) + labelWeights.getOrElse(labelInt, 1)
}
Expand Down Expand Up @@ -739,7 +741,8 @@ object DecisionTree extends Serializable with Logging {
val isSpaceSufficientForAllCategoricalSplits
= numBins > math.pow(2, featureCategories.toInt - 1) - 1
if (isSpaceSufficientForAllCategoricalSplits) {
updateBinForUnorderedFeature(nodeIndex, featureIndex, arr, label, agg, rightChildShift)
updateBinForUnorderedFeature(nodeIndex, featureIndex, arr, label, agg,
rightChildShift)
} else {
updateBinForOrderedFeature(arr, agg, nodeIndex, label, featureIndex)
}
Expand Down Expand Up @@ -909,10 +912,10 @@ object DecisionTree extends Serializable with Logging {
.map{case (leftCount, rightCount) => leftCount + rightCount}

def indexOfLargestArrayElement(array: Array[Double]): Int = {
val result = array.foldLeft(-1,Double.MinValue,0) {
val result = array.foldLeft(-1, Double.MinValue, 0) {
case ((maxIndex, maxValue, currentIndex), currentValue) =>
if(currentValue > maxValue) (currentIndex,currentValue,currentIndex+1)
else (maxIndex,maxValue,currentIndex+1)
if(currentValue > maxValue) (currentIndex, currentValue, currentIndex + 1)
else (maxIndex, maxValue, currentIndex+1)
}
if (result._1 < 0) 0 else result._1
}
Expand Down Expand Up @@ -1408,8 +1411,8 @@ object DecisionTree extends Serializable with Logging {
categoriesSortedByCentroid.iterator.zipWithIndex.foreach {
case ((key, value), index) =>
categoriesForSplit = key :: categoriesForSplit
splits(featureIndex)(index) = new Split(featureIndex, Double.MinValue, Categorical,
categoriesForSplit)
splits(featureIndex)(index) = new Split(featureIndex, Double.MinValue,
Categorical, categoriesForSplit)
bins(featureIndex)(index) = {
if (index == 0) {
new Bin(new DummyCategoricalSplit(featureIndex, Categorical),
Expand Down

0 comments on commit 4e85f2c

Please sign in to comment.