Update README.md
Browse files123---license: mit---1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768---language: enlicense: mittags:- pytorch- regression- dot-product- bilinear-networksmetrics:- losspipeline_tag: table-regression---# SBL-NET (Scalar Bilinear Linear Network)A hybrid PyTorch neural network designed to **highly accurately compute the scalar (dot) product** of split sub-vectors without any data normalization (Z-score, etc.).## 🔬 Architecture & FeaturesThe main highlight of this model is the integration of a rare **bilinear layer (`nn.Bilinear`)** at the input stage, combined with classic fully connected layers (`nn.Linear`) and the `SELU` activation function.* The network accepts an input tensor of shape `[batch, 4]` and splits it into two vectors: `A [batch, 2]` and `B [batch, 2]`.* The bilinear layer efficiently extracts cross-features between the vectors, allowing the model to reduce the error to an impressive **0.0569%**.## 📊 Training Results* **Loss Function:** Smooth L1 Loss* **Optimizer:** Adam (with StepLR scheduler)* **Error Rate:** ~0.0569% (Accuracy ~99.94%)* **Extreme Test Case:*** Input: `[[-6.0, 70.0, 4.0, -196.0]]`* Expected Mathematical Answer: `-13744.0000`* Actual Network Prediction: `-13769.5225`## 🧮 Model Statistics* **Total Parameters:** 52,101* **Trainable Parameters:** 52,101* **Non-trainable Parameters:** 0* **Model Size:** ~208 KB (Weights in FP32)* **Input Shape:** `[batch_size, 4]`* **Output Shape:** `[batch_size, 1]`## 💻 How to UseYou can download the architecture file and the model weights directly from this repository:```pythonimport torch as tfrom huggingface_hub import hf_hub_download# 1. Download the architecture and weights files (replace YOUR_USERNAME)REPO_ID = "YOUR_USERNAME/sbl-net"hf_hub_download(repo_id=REPO_ID, filename="model.py", local_dir=".")hf_hub_download(repo_id=REPO_ID, filename="model_weights_hybrid.pth", local_dir=".")# 2. Import the model class and load the weightsfrom model import WebAISCmodel = WebAISC()model.load_state_dict(t.load("model_weights_hybrid.pth", map_location=t.device('cpu')))model.eval()# 3. Inferencetest_input = t.tensor([[-6.0, 70.0, 4.0, -196.0]], dtype=t.float32)with t.no_grad():prediction = model(test_input)print(f"Model prediction: {prediction.item():.4f}")```
README.md+65