16 2,3 4:1.0 5:-0.5 8:0.25
27 std::stringstream original_source;
31 features.coeffRef(0, 4) = 1.0;
32 features.coeffRef(0, 5) = -0.5;
33 features.coeffRef(0, 8) = 0.25;
34 features.coeffRef(1, 2) = 1.0;
35 features.coeffRef(2, 6) = -2.0;
36 features.coeffRef(2, 5) = 1.5;
37 features.coeffRef(3, 3) = -3.0;
39 std::vector<std::vector<long>> label_ex(5);
40 label_ex[0].push_back(1);
41 label_ex[1].push_back(3);
42 label_ex[2].push_back(0);
43 label_ex[3].push_back(0);
47 std::stringstream canonical_save;
51 REQUIRE(re_read.get_features()->rows() == features.rows());
52 REQUIRE(re_read.get_features()->cols() == features.cols());
53 CHECK(types::DenseColMajor<real_t>(re_read.get_features()->sparse()) == types::DenseColMajor<real_t>(features));
55 std::stringstream round_trip;
58 CHECK(round_trip.str() == canonical_save.str());
building blocks for io procedures that are used by multiple io subsystems
constexpr const char * TEST_FILE
TEST_CASE("xmc round trip")
MultiLabelData read_xmc_dataset(const std::filesystem::path &source, IndexMode mode=IndexMode::ZERO_BASED)
Reads a dataset given in the extreme multilabel classification format.
void save_xmc_dataset(std::ostream &target, const MultiLabelData &data)
Saves the given dataset in XMC format.
Main namespace in which all types, classes, and functions are defined.
types::SparseRowMajor< real_t > SparseFeatures
Sparse Feature Matrix in Row Major format.