Skip to content
Snippets Groups Projects
Commit bf4c9a5e authored by Ameet Talwalkar's avatar Ameet Talwalkar
Browse files

renamed with labeled prefix

parent 744da8ee
No related branches found
No related tags found
No related merge requests found
......@@ -150,7 +150,7 @@ object LogisticRegression {
System.exit(1)
}
val sc = new SparkContext(args(0), "LogisticRegression")
val data = MLUtils.loadData(sc, args(1))
val data = MLUtils.loadLabeledData(sc, args(1))
val model = LogisticRegression.train(data, args(3).toInt, args(2).toDouble)
sc.stop()
......
......@@ -35,7 +35,7 @@ object LogisticRegressionGenerator {
(y, x)
}
MLUtils.saveData(data, outputPath)
MLUtils.saveLabeledData(data, outputPath)
sc.stop()
}
}
......@@ -187,7 +187,7 @@ object RidgeRegression {
System.exit(1)
}
val sc = new SparkContext(args(0), "RidgeRegression")
val data = MLUtils.loadData(sc, args(1))
val data = MLUtils.loadLabeledData(sc, args(1))
val model = RidgeRegression.train(data, 0, 1000)
sc.stop()
}
......
......@@ -49,7 +49,7 @@ object RidgeRegressionGenerator {
}
}
MLUtils.saveData(data, outputPath)
MLUtils.saveLabeledData(data, outputPath)
sc.stop()
}
}
......@@ -19,7 +19,7 @@ object MLUtils {
* @return An RDD of tuples. For each tuple, the first element is the label, and the second
* element represents the feature values (an array of Double).
*/
def loadData(sc: SparkContext, dir: String): RDD[(Double, Array[Double])] = {
def loadLabeledData(sc: SparkContext, dir: String): RDD[(Double, Array[Double])] = {
sc.textFile(dir).map { line =>
val parts = line.split(",")
val label = parts(0).toDouble
......@@ -28,7 +28,7 @@ object MLUtils {
}
}
def saveData(data: RDD[(Double, Array[Double])], dir: String) {
def saveLabeledData(data: RDD[(Double, Array[Double])], dir: String) {
val dataStr = data.map(x => x._1 + "," + x._2.mkString(" "))
dataStr.saveAsTextFile(dir)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment