我有非常好定义的机器学习训练集(只有字符串属性)。
例如:
@relation training_rel
@attribute class {politics,sports}
@attribute text string
@data
politics,'some text about politics over here'
... // a lot of other training instances of class politics
sports,'and now some sports over here'
... // a lot of other
我正在查看在中找到的交叉验证代码示例
上面写着:
CrossValidator首先将数据集分割成一组折叠,这些褶皱用作单独的训练和测试数据集。例如,使用k=3折叠,CrossValidator将生成3个(训练,测试)数据集对,每个使用2/3的数据进行培训,1/3用于测试。
因此,我不明白为什么代码中的数据在培训和测试中是分开的:
// Run cross-validation, and choose the best set of parameters.
val cvModel = cv.fit(training)
// Prepare test documents, which a