17 template<
class LABEL=arma::Row<DTYPE>,
class T=DTYPE>
24 std::optional<size_t> num_class_;
25 std::optional<size_t> seed_;
38 Dataset (
const size_t dim,
const size_t seed = SEED );
46 Dataset (
const arma::Mat<T>& inputs,
47 const LABEL& labels );
55 void Update (
const arma::Mat<T>& inputs,
const LABEL& labels );
57 void Update (
const LABEL& labels );
65 void Linear (
const size_t N=10,
const T noise_std=T(1.));
73 void Sine (
const size_t N=10,
const T noise_std=T(1.));
82 void Banana (
const size_t N=10,
const T delta=0. );
92 void Dipping (
const size_t N=10,
const T r=1,
const T noise_std=0.1 );
102 void Gaussian (
const size_t N=10,
103 const arma::Row<T>& means = {-1,1} );
106 template <
class Archive>
107 void serialize(Archive& ar)
109 ar( CEREAL_NVP(size_),
112 CEREAL_NVP(num_class_),
113 CEREAL_NVP(dimension_) );
116 void Save(
const std::string& filename );
119 void _update_info ( );
128 template<
class LTYPE =
size_t,
class T = DTYPE>
135 std::optional<size_t> num_class_;
136 std::filesystem::path path_;
138 arma::Mat<T> inputs_;
139 arma::Row<LTYPE> labels_;
142 Dataset(
const size_t&
id,
const std::filesystem::path& path);
146 void Update(
const arma::Mat<T>& input,
const arma::Row<LTYPE>& labels);
149 template <
class Archive>
150 void serialize(Archive& ar)
152 ar(CEREAL_NVP(size_),
154 CEREAL_NVP(path_.string()),
155 CEREAL_NVP(num_class_),
156 CEREAL_NVP(meta_url_),
157 CEREAL_NVP(down_url_),
159 CEREAL_NVP(metafile_),
162 CEREAL_NVP(dimension_));
166 void Save(
const std::string& filename);
167 static std::shared_ptr<Dataset<LTYPE, T>> Load(
const std::string& filename);
170 std::filesystem::path filepath_ = path_ /
"datasets";
171 std::filesystem::path metapath_ = path_ /
"meta";
177 bool _iscateg(
const arma::Row<T>& row);
178 arma::Row<size_t> _convcateg(
const arma::Row<T>& row);
179 arma::Row<size_t> _procrow(
const arma::Row<T>& row);
181 std::string _gettargetname(
const std::string& metadata);
182 std::string _getdownurl(
const std::string& metadata);
183 int _findlabel(
const std::string& targetname);
185 std::string _fetchmetadata();
186 std::string _readmetadata();
188 std::string meta_url_;
189 std::string down_url_;
191 std::string metafile_;
197 template<
class T=
size_t>
210 Collect (
const arma::Row<size_t>& ids );
216 Collect (
const size_t&
id,
const std::filesystem::path& path );
222 size_t GetSize ( )
const {
return size_;}
223 size_t GetCounter ( )
const {
return counter_;}
224 arma::Row<size_t> GetKeys ( )
const {
return keys_;}
233 arma::Row<size_t> _getkeys ( );
235 arma::Row<size_t> keys_;
237 std::filesystem::path path_;
238 std::filesystem::path filespath_ = path_ /
"collect";
239 std::filesystem::path metapath_ = path_ /
"collect";
240 std::filesystem::path metafile_ = metapath_ / (std::to_string(id_)+
".meta");
249 #include "dataset_impl.h"