|
Download README.md from ALEXFLR/SBL-NET: direct link, hf CLI and curl.
- Browser
- Download file 2.39 kB
-
https://huggingface.co/ALEXFLR/SBL-NET/resolve/main/README.md
- Command line
-
hf download hf://ALEXFLR/SBL-NET/README.md
-
curl -L -o README.md https://huggingface.co/ALEXFLR/SBL-NET/resolve/main/README.md
2.39 kB
| language: en | |
| license: mit | |
| tags: | |
| - pytorch | |
| - regression | |
| - dot-product | |
| - bilinear-networks | |
| metrics: | |
| - loss | |
| pipeline_tag: tabular-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 & Features | |
| The 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.185%**. | |
| ## 📊 Training Results | |
| * **Loss Function:** Smooth L1 Loss | |
| * **Optimizer:** Adam (with StepLR scheduler) | |
| * **Error Rate:** ~0.185% | |
| * **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 Use | |
| You can download the architecture file and the model weights directly from this repository: | |
| ```python | |
| import torch as t | |
| import torch.nn as nn | |
| import torch.optim as opt | |
| from torch.utils.data import DataLoader, Dataset | |
| class WebAISC(nn.Module): | |
| def __init__(self): | |
| super().__init__() | |
| self.bilinear = nn.Bilinear(in1_features=2, in2_features=2, out_features=250) | |
| self.x2 = nn.Linear(250, 100) | |
| self.x3 = nn.Linear(100, 250) | |
| self.x4 = nn.Linear(250, 1) | |
| self.selu = nn.SELU() | |
| def forward(self, x): | |
| a = x[:, 0:2] | |
| b = x[:, 2:4] | |
| x = self.selu(self.bilinear(a, b)) | |
| x = self.selu(self.x2(x)) | |
| x = self.selu(self.x3(x)) | |
| x = self.x4(x) | |
| return x | |
| model = WebAISC() | |
| test_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}") | |
| ``` | |