Chisei v1.0
Lightweight AI/ML Framework
Loading...
Searching...
No Matches
idx_loader.hpp
Go to the documentation of this file.
1/*
2 *
3 * Copyright 2025 Nathanne Isip
4 *
5 * Redistribution and use in source and binary forms,
6 * with or without modification, are permitted provided
7 * that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the
10 * above copyright notice, this list of conditions
11 * and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce
14 * the above copyright notice, this list of conditions
15 * and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19 * CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
31 * DAMAGE.
32 *
33 */
34
35#ifndef CHISEI_IDX_LOADER_HPP
36#define CHISEI_IDX_LOADER_HPP
37
38#include <cstdint>
39#include <exception>
40#include <fstream>
41#include <vector>
42
45
46namespace chisei {
47 class IDXLoader final {
48 public:
50 const std::string& images_file,
51 const std::string& labels_file,
52 double learning_rate,
53 int epoch
54 );
55
56 private:
57 static uint32_t readUint32(std::ifstream& file);
58 };
59}
60
61#endif
static NeuralNetwork fromMNIST(const std::string &images_file, const std::string &labels_file, double learning_rate, int epoch)
Represents a fully connected feedforward neural network.