DiSMEC++
xmc.h
Go to the documentation of this file.
1 // Copyright (c) 2021, Aalto University, developed by Erik Schultheis
2 // All rights reserved.
3 //
4 // SPDX-License-Identifier: MIT
5 
6 #ifndef DISMEC_XMC_H
7 #define DISMEC_XMC_H
8 
9 #include <filesystem>
10 #include <iosfwd>
11 #include "fwd.h"
12 
13 
64 namespace dismec::io
65 {
67  enum class IndexMode {
68  ZERO_BASED,
69  ONE_BASED
70  };
71 
81  MultiLabelData read_xmc_dataset(const std::filesystem::path& source, IndexMode mode=IndexMode::ZERO_BASED);
82 
93  MultiLabelData read_xmc_dataset(std::istream& source, std::string_view name, IndexMode mode=IndexMode::ZERO_BASED);
94 
95 
101  void save_xmc_dataset(std::ostream& target, const MultiLabelData& data);
102 
103  void save_xmc_dataset(const std::filesystem::path& target, const MultiLabelData& data, int precision=4);
104 }
105 
106 #endif //DISMEC_XMC_H
Forward-declares types.
constexpr double precision(const ConfusionMatrixBase< T > &matrix)
MultiLabelData read_xmc_dataset(const std::filesystem::path &source, IndexMode mode=IndexMode::ZERO_BASED)
Reads a dataset given in the extreme multilabel classification format.
Definition: xmc.cpp:216
void save_xmc_dataset(std::ostream &target, const MultiLabelData &data)
Saves the given dataset in XMC format.
Definition: xmc.cpp:294
IndexMode
Enum to decide whether indices in an xmc file are starting from 0 or from 1.
Definition: xmc.h:67
@ ONE_BASED
labels and feature indices are 1, 2, ..., num
@ ZERO_BASED
labels and feature indices are 0, 1, ..., num - 1