Fin-XAI is a distributed framework that bridges the gap between high-performance enterprise .NET applications and advanced Python-based Machine Learning.
Machine Learning models in finance are often treated as "Black Boxes." This project provides a novel architecture combining a .NET 8 Blazor Razor Class Library (RCL) with the analytical depth of Python's SHAP (Shapley Additive exPlanations) to provide real-time, transparency-first decision auditing for financial portfolios.
The solution is divided into two primary environments:
- Inference Engine (Python / FastAPI): A lightweight API that keeps a Random Forest classifier (trained on the UCI German Credit Dataset) loaded in memory. It calculates dynamic SHAP values on the fly to explain why a specific financial decision or risk score was assigned.
-
Client Dashboard (
FinXAI.UniverseNuGet / Blazor): A plug-and-play Razor Class Library containing the data models, HTTP services, and a fully interactive UI component (<FinXaiDashboard />). It uses JS Interop to handle client-side PDF/CSV exports without taxing the server.
To run the full simulator locally, you need both the Python engine and the .NET host running.
Ensure Python 3.9+ is installed. Navigate to the FinXAI.Universe/PythonEngine directory.
# Install required ML and API libraries
pip install fastapi uvicorn pandas scikit-learn ucimlrepo shap
# Start the API server on port 7001
python Main.py
Open the solution in Visual Studio. Set FinXAI.Demo as the Startup Project and run the application (F5). Navigate to the /finxai route to interact with the dashboard.
This project is packaged as a reusable Blazor UI library. To add the Explainable AI dashboard to your own .NET 8 application:
1. Install the package:
dotnet add package FinXAI.Universe
2. Register the required HTTP Client in your Program.cs:
builder.Services.AddScoped(sp => new HttpClient());3. Drop the component into any Razor page:
@using FinXAI.Universe.Components
<FinXaiDashboard ApiBaseUrl="[http://127.0.0.1:7001](http://127.0.0.1:7001)" />
- Frontend/UI: .NET 8, Blazor Server, Bootstrap 5, Chart.js (via ChartJs.Blazor)
- Backend/API: Python, FastAPI, Uvicorn
- Data Science: Scikit-Learn, SHAP, Pandas, UCI Machine Learning Repository
Yash Saini