Skip to content

AlanMet/SineWaveNN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 SineWaveNN

A simple neural network written in Dart that learns to approximate the sine function.
This project demonstrates how a minimal feedforward network can be built from scratch using custom matrix operations and activation functions.


πŸ“Œ Features

  • Neural network built entirely in Dart
  • Custom matrix and activation function support
  • Trains a 1β†’10β†’1 feedforward network to approximate sin(x)
  • Includes training and evaluation logic
  • No external ML libraries required

πŸš€ Getting Started

1. Clone the repository

git clone https://github.com/AlanMet/SineWaveNN.git
cd SineWaveNN
  1. Run the program Make sure you have the Dart SDK installed.
Copy
Edit
dart run main.dart

πŸ§ͺ How It Works

Data Generation The generateData() function creates pairs of random inputs x ∈ [0, 1) and their corresponding sine values sin(x).

Network Structure

A simple feedforward neural network is created with the architecture: 1 input β†’ 10 hidden units (tanh) β†’ 1 output (tanh)

Training

The network is trained on 10,000 examples for 10,000 epochs.

Mean squared error loss is minimized using basic gradient descent.

Accuracy Evaluation

After training, the model is tested on 10,000 new samples.

Accuracy is calculated by comparing rounded outputs (toStringAsFixed(2)).

πŸ“ˆ Example Output

bash Copy Edit Training complete. Accuracy: 92.34% (Note: Accuracy is based on matching rounded sine predictions)

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages