handwritten-mathematics-recogniser
Version:
Easy and abstracted way to recognise handwritten mathematics in a browser or in a web view.
50 lines (48 loc) • 1.71 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
class Forwarder {
static relu(value) {
return Math.max(value, 0);
}
static matrixAddition(matrix1, matrix2) {
return;
}
static matrixMultiplication(matrix1, matrix2) {
if (matrix1.length !== matrix2[0].length) {
throw new Error('Illegal matrix dimensions!');
}
const matrix = Array.from({ length: matrix1[0].length }, () => Array.from({ length: matrix2.length }, () => 0));
for (let y = 0; y < matrix.length; y++) {
for (let x = 0; x < matrix[0].length; x++) {
for (let z = 0; z < matrix[0].length; z++) {
matrix[y][x] += matrix1[y][z] * matrix2[z][x];
}
}
}
return matrix;
}
static convolution(image, kernel, padding = false) {
const convolution = Array.from({ length: image.length }, () => Array.from({ length: image[0].length }, () => 0));
for (let y = 0; y < image.length; y++) {
for (let x = 0; x < image[y].length; x++) {
for (let j = 0; j < kernel.length; j++) {
for (let i = 0; i < kernel[j].length; i++) {
convolution[y][x] += image[y + j][x + i] * kernel[y + j][x + i];
}
}
}
}
return convolution;
}
static maxPooling(image, windowX, windowY, strideX, strideY) {
return;
}
static softmax(value) {
return;
}
static softmaxProbabilities(probabilities) {
return;
}
}
exports.Forwarder = Forwarder;
//# sourceMappingURL=forwarder.js.map