Starting on the model.h, but need to make layer structs and structs for loss and optimizers
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include "./core/omp_config.h"
|
||||
#include "./utils/matrix.h"
|
||||
#include "./utils/vector.h"
|
||||
#include "utils/generators/linspace.h"
|
||||
|
||||
#include <math.h> /* sin */
|
||||
|
||||
//#include "./utils/random.h"
|
||||
|
||||
//#include <math.h>
|
||||
|
||||
|
||||
namespace neural_networks{
|
||||
|
||||
template <typename T>
|
||||
void create_sine_data(const uint64_t samples, const T length, utils::Matrix<T>& X, utils::Matrix<T>& y) {
|
||||
|
||||
X.resize(samples, 1);
|
||||
X.set_col(0, utils::linspace(
|
||||
T{0}, // start
|
||||
length, // stop
|
||||
samples, // N
|
||||
true // endpoint
|
||||
));
|
||||
|
||||
y.resize(samples, 1);
|
||||
|
||||
|
||||
for (uint64_t i = 0; i < samples; ++i){
|
||||
y(i,0) = std::sin(X(i,0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // end namesoace NN
|
||||
Reference in New Issue
Block a user