Bringing the latest AI algorithms and breakthroughs directly to the .NET ecosystem
AiDotNet is a comprehensive machine learning and artificial intelligence library designed specifically for the .NET ecosystem. Our mission is to make cutting-edge AI algorithms accessible to .NET developers, whether you're a beginner taking your first steps in machine learning or an expert seeking full customization capabilities.
- Easy to Learn: Simplified APIs that reduce the steep learning curve typically associated with AI/ML
- Fully Customizable: Expert users have complete control over algorithm parameters and implementation details
- Modern Architecture: Built with the latest .NET features and best practices
- Production Ready: Comprehensive testing, CI/CD pipelines, and quality gates ensure reliability
- Actively Developed: Regular updates bringing the latest AI breakthroughs to .NET
- Flexible neural network architectures for classification and regression
- Support for custom layers and activation functions
- Advanced training with backpropagation and various optimizers
- Linear and multiple regression
- Advanced regression techniques with feature engineering
- Real-world examples including housing price prediction
- Forecasting models for sequential data
- Support for stock prices, energy demand, and other time-dependent predictions
- Seasonal decomposition and trend analysis
- Domain adaptation algorithms
- Feature mapping between different data domains
- Pre-trained model support
- LoRA (Low-Rank Adaptation): Efficient fine-tuning of large models
- Automatic Differentiation: Built-in autodiff for gradient computation
- Distributed Training: Scale your training across multiple machines
- Mixed Precision Training: Optimize performance with FP16/FP32 support
- Language Models: Integration with modern language model architectures
- Agents: AI agent frameworks for autonomous decision-making
- Multiple activation functions (ReLU, Sigmoid, Tanh, and more)
- Various optimization algorithms (Adam, SGD, RMSprop)
- Data preprocessing and normalization
- Outlier detection and removal
- Model evaluation metrics
- Caching for improved performance
Install AiDotNet via NuGet Package Manager:
dotnet add package AiDotNetOr via the NuGet Package Manager Console:
Install-Package AiDotNet- .NET 8.0 or later
- .NET Framework 4.6.2 or later
Here's a simple example to get you started with neural network classification:
using AiDotNet.Enums;
using AiDotNet.LinearAlgebra;
using AiDotNet.NeuralNetworks;
// Create training data (XOR problem - classic neural network example)
var xorData = new double[,]
{
{ 0, 0 }, // Input: [0, 0]
{ 0, 1 }, // Input: [0, 1]
{ 1, 0 }, // Input: [1, 0]
{ 1, 1 } // Input: [1, 1]
};
var xorLabels = new double[,]
{
{ 0 }, // Expected output: 0
{ 1 }, // Expected output: 1
{ 1 }, // Expected output: 1
{ 0 } // Expected output: 0
};
// Convert to tensors (required format for neural network)
var features = new Tensor<double>(new int[] { 4, 2 }); // 4 samples, 2 features
var labels = new Tensor<double>(new int[] { 4, 1 }); // 4 samples, 1 output
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 2; j++)
features[new int[] { i, j }] = xorData[i, j];
labels[new int[] { i, 0 }] = xorLabels[i, 0];
}
// Create neural network architecture
var architecture = new NeuralNetworkArchitecture<double>(
inputFeatures: 2,
numClasses: 1,
complexity: NetworkComplexity.Medium
);
// Initialize and train the network
var neuralNetwork = new NeuralNetwork<double>(architecture);
for (int epoch = 0; epoch < 1000; epoch++)
{
neuralNetwork.Train(features, labels);
if (epoch % 200 == 0)
{
double loss = neuralNetwork.GetLastLoss();
Console.WriteLine($"Epoch {epoch}: Loss = {loss:F4}");
}
}
// Make predictions
var predictions = neuralNetwork.Predict(features);
Console.WriteLine($"
Prediction for [1, 0]: {predictions[new int[] { 2, 0 }]:F2}");
Console.WriteLine($"Prediction for [1, 1]: {predictions[new int[] { 3, 0 }]:F2}");AiDotNet comes with comprehensive examples demonstrating various use cases:
- Neural Network Example - Classification (Iris dataset) and regression (housing prices)
- Regression Example - Linear regression for house price prediction
- Time Series Example - Stock price forecasting
- Enhanced Neural Network - Customer churn prediction with preprocessing
- Enhanced Regression - Real estate analysis with feature engineering
- Enhanced Time Series - Energy demand forecasting with multiple models
- Mixture of Experts - Advanced ensemble learning techniques
To run the examples:
- Clone the repository
- Open
AiDotNet.slnin Visual Studio or your preferred IDE - Set the
AiDotNetTestConsoleproject as the startup project - Run the project and choose an example from the menu
- API Documentation - Comprehensive API reference
- Advanced Reasoning Guide - Deep dive into advanced ML concepts
- Distributed Training - Scale your training workloads
- Autodiff Integration - Understanding automatic differentiation
- Mixed Precision Architecture - Optimize performance with mixed precision
| Platform | Versions |
|---|---|
| .NET | 8.0+ |
| .NET Framework | 4.6.2+ |
| Operating Systems | Windows, Linux, macOS |
We welcome contributions from the community! Whether you're fixing bugs, adding features, or improving documentation, your help is appreciated.
Please read our Contributing Guide to learn about our development process and how to submit pull requests.
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.
- Issues: Found a bug or have a feature request? Open an issue
- Discussions: Have questions or want to discuss ideas? Start a discussion
- Security: Found a security vulnerability? Please review our Security Policy
AiDotNet is actively developed with regular updates. Current focus areas include:
- Expanding neural network architectures (CNNs, RNNs, Transformers)
- Additional optimization algorithms
- Enhanced GPU acceleration support
- More pre-built model templates
- Improved documentation and tutorials
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
AiDotNet is developed and maintained by Ooples Finance with contributions from the community. We're grateful to all our contributors who help make AI/ML more accessible in the .NET ecosystem.
Made with ❤️ for the .NET Community