本文整理汇总了C++中TrainingSet::hasMoreFeatures方法的典型用法代码示例。如果您正苦于以下问题:C++ TrainingSet::hasMoreFeatures方法的具体用法?C++ TrainingSet::hasMoreFeatures怎么用?C++ TrainingSet::hasMoreFeatures使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrainingSet
的用法示例。
在下文中一共展示了TrainingSet::hasMoreFeatures方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(TrainingSetTest, test1) {
enum Bike {
MOUNTAIN_BIKE,
FAST_BIKE
};
TrainingSet<Bike, 2> trainingSet;
std::array<double, 2> t1 = {1, 2};
std::array<double, 2> t2 = {3, 4};
std::array<double, 2> t3 = {5, 6};
std::array<double, 2> t4 = {7, 8};
trainingSet.add(MOUNTAIN_BIKE, t1);
trainingSet.add(MOUNTAIN_BIKE, t2);
trainingSet.add(FAST_BIKE, t3);
trainingSet.add(FAST_BIKE, t4);
std::vector<double> expected1 = {1, 3};
std::vector<double> expected2 = {2, 4};
EXPECT_TRUE(trainingSet.hasMoreTypes());
EXPECT_EQ(trainingSet.getNextType(), MOUNTAIN_BIKE);
EXPECT_TRUE(trainingSet.getNextFeature() == expected1);
EXPECT_TRUE(trainingSet.getNextFeature() == expected2);
EXPECT_TRUE(trainingSet.hasMoreTypes());
EXPECT_EQ(trainingSet.getNextType(), FAST_BIKE);
EXPECT_FALSE(trainingSet.hasMoreFeatures());
}