Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/netsaur/mod.ts>Backend

Powerful machine learning, accelerated by WebGPU
Go to Latest
interface Backend
Re-export
import { type Backend } from "https://deno.land/x/netsaur@0.2.6/mod.ts";

The Backend is responsible for eveything related to the neural network.

Methods

train(
datasets: DataSet[],
epochs: number,
batches: number,
rate: number,
): void

The train method is a function that trains a neural network using a set of training data. It takes in an array of DataSet objects, the number of epochs to train for, and the learning rate. The method modifies the weights and biases of the network to minimize the cost function and improve its accuracy on the training data.

predict(input: Tensor<Rank>): Promise<Tensor<Rank>>

The predict method is a function that takes in a Tensor object representing the input to the neural network and returns a Promise that resolves to a Tensor object representing the output of the network. This method is used to make predictions on new data after the network has been trained. The Tensor objects passed to and returned from this method have a rank, which represents the number of dimensions of the tensor.

save(): Uint8Array

The save method is a function that saves the network to a Uint8Array. This method is used to save the network after it has been trained.

saveFile(path: string): void

The saveFile method is a function that takes in a string representing the path to a file and saves the network to that file. This method is used to save the network after it has been trained.