@@ -33,22 +33,22 @@ private case class BinaryConfusionMatrixImpl(
3333 totalCount : LabelCounter ) extends BinaryConfusionMatrix with Serializable {
3434
3535 /** number of true positives */
36- override def tp : Long = count.numPositives
36+ override def numTruePositives : Long = count.numPositives
3737
3838 /** number of false positives */
39- override def fp : Long = count.numNegatives
39+ override def numFalsePositives : Long = count.numNegatives
4040
4141 /** number of false negatives */
42- override def fn : Long = totalCount.numPositives - count.numPositives
42+ override def numFalseNegatives : Long = totalCount.numPositives - count.numPositives
4343
4444 /** number of true negatives */
45- override def tn : Long = totalCount.numNegatives - count.numNegatives
45+ override def numTrueNegatives : Long = totalCount.numNegatives - count.numNegatives
4646
4747 /** number of positives */
48- override def p : Long = totalCount.numPositives
48+ override def numPositives : Long = totalCount.numPositives
4949
5050 /** number of negatives */
51- override def n : Long = totalCount.numNegatives
51+ override def numNegatives : Long = totalCount.numNegatives
5252}
5353
5454/**
@@ -57,10 +57,10 @@ private case class BinaryConfusionMatrixImpl(
5757 * @param scoreAndLabels an RDD of (score, label) pairs.
5858 */
5959class BinaryClassificationMetrics (scoreAndLabels : RDD [(Double , Double )])
60- extends Serializable with Logging {
60+ extends Serializable with Logging {
6161
6262 private lazy val (
63- cumCounts : RDD [(Double , LabelCounter )],
63+ cumulativeCounts : RDD [(Double , LabelCounter )],
6464 confusions : RDD [(Double , BinaryConfusionMatrix )]) = {
6565 // Create a bin for each distinct score value, count positives and negatives within each bin,
6666 // and then sort by score values in descending order.
@@ -74,32 +74,32 @@ class BinaryClassificationMetrics(scoreAndLabels: RDD[(Double, Double)])
7474 iter.foreach(agg += _)
7575 Iterator (agg)
7676 }, preservesPartitioning = true ).collect()
77- val partitionwiseCumCounts =
77+ val partitionwiseCumulativeCounts =
7878 agg.scanLeft(new LabelCounter ())((agg : LabelCounter , c : LabelCounter ) => agg.clone() += c)
79- val totalCount = partitionwiseCumCounts .last
79+ val totalCount = partitionwiseCumulativeCounts .last
8080 logInfo(s " Total counts: $totalCount" )
81- val cumCounts = counts.mapPartitionsWithIndex(
81+ val cumulativeCounts = counts.mapPartitionsWithIndex(
8282 (index : Int , iter : Iterator [(Double , LabelCounter )]) => {
83- val cumCount = partitionwiseCumCounts (index)
83+ val cumCount = partitionwiseCumulativeCounts (index)
8484 iter.map { case (score, c) =>
8585 cumCount += c
8686 (score, cumCount.clone())
8787 }
8888 }, preservesPartitioning = true )
89- cumCounts .persist()
90- val confusions = cumCounts .map { case (score, cumCount) =>
89+ cumulativeCounts .persist()
90+ val confusions = cumulativeCounts .map { case (score, cumCount) =>
9191 (score, BinaryConfusionMatrixImpl (cumCount, totalCount).asInstanceOf [BinaryConfusionMatrix ])
9292 }
93- (cumCounts , confusions)
93+ (cumulativeCounts , confusions)
9494 }
9595
9696 /** Unpersist intermediate RDDs used in the computation. */
9797 def unpersist () {
98- cumCounts .unpersist()
98+ cumulativeCounts .unpersist()
9999 }
100100
101101 /** Returns thresholds in descending order. */
102- def thresholds (): RDD [Double ] = cumCounts .map(_._1)
102+ def thresholds (): RDD [Double ] = cumulativeCounts .map(_._1)
103103
104104 /**
105105 * Returns the receiver operating characteristic (ROC) curve,
0 commit comments