文件名称:机器学习框架KeystoneML.zip
文件大小:14.27MB
文件格式:ZIP
更新时间:2022-08-05 20:54:51
开源项目
KeystoneML 是一个用 Scala 编写的软件框架,来自伯克利大学 AMPLab 实验室。该项目主要目的是简化构造大规模、端到端的机器学习管道,基于 Apache Spark 构建。示例代码:val trainData = NewsGroupsDataLoader(sc, trainingDir) val predictor = Trim.then(LowerCase()) .then(Tokenizer()) .then(new NGramsFeaturizer(1 to conf.nGrams)) .then(TermFrequency(x => 1)) .thenEstimator(CommonSparseFeatures(conf.commonFeatures)) .fit(trainData.data) .thenLabelEstimator(NaiveBayesEstimator(numClasses)) .fit(trainData.data, trainData.labels) .then(MaxClassifier)测试:val test = NewsGroupsDataLoader(sc, testingDir) val predictions = predictor(test.data) val eval = MulticlassClassifierEvaluator(predictions, test.labels, numClasses) println(eval.summary(newsgroupsData.classes))输出:Avg Accuracy: 0.980 Macro Precision:0.816 Macro Recall: 0.797 Macro F1: 0.797 Total Accuracy: 0.804 Micro Precision:0.804 Micro Recall: 0.804 Micro F1: 0.804 标签:KeystoneML