Skip to content

Commit 3b47c5f

Browse files
committed
added Limix
1 parent 4441a2d commit 3b47c5f

10 files changed

Lines changed: 494 additions & 484 deletions

.DS_Store

0 Bytes
Binary file not shown.

README.md

Lines changed: 81 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ print(response.metadata) # Model version, inference time, etc.
7070

7171
### Input Data Format
7272

73-
**All models require 3D input arrays:**
73+
#### Time-Series Models (FlowState, Chronos2, TiRex)
74+
75+
**All time-series models require 3D input arrays:**
7476

7577
```python
7678
# Shape: (batch_size, sequence_length, features)
@@ -86,8 +88,25 @@ x = np.array([
8688

8789
**Important**: 2D input will raise a validation error. Always provide 3D arrays.
8890

91+
#### Tabular Models (LimiX)
92+
93+
**Tabular models require 2D input arrays:**
94+
95+
```python
96+
# Shape: (n_samples, n_features)
97+
X_train = np.array([
98+
[1.0, 2.0, 3.0], # Sample 1
99+
[4.0, 5.0, 6.0], # Sample 2
100+
]) # Shape: (2, 3)
101+
```
102+
103+
- **n_samples**: Number of training/test samples
104+
- **n_features**: Number of input features per sample
105+
89106
### Output Data Format
90107

108+
#### Time-Series Output
109+
91110
**Point Forecasts** (3D):
92111
```python
93112
response.point # Shape: (batch_size, horizon, features)
@@ -99,11 +118,27 @@ response.quantiles # Shape: (batch_size, horizon, num_quantiles, features)
99118
# Example: (32, 24, 5, 1) = 32 series, 24 steps ahead, 5 quantiles, 1 feature
100119
```
101120

102-
### Univariate vs Multivariate
121+
#### Tabular Output
122+
123+
**Predictions** (1D):
124+
```python
125+
response.predictions # Shape: (n_samples,)
126+
# Classification: class labels or indices
127+
# Regression: continuous values
128+
```
129+
130+
**Classification Probabilities** (2D):
131+
```python
132+
response.probabilities # Shape: (n_samples, n_classes) - classification only
133+
# Probability for each class
134+
```
135+
136+
### Univariate vs Multivariate (Time-Series Only)
103137

104138
- **Chronos2**: ✅ Supports multivariate forecasting (multiple features)
105139
- **FlowState**: ⚠️ Univariate only - automatically transforms multivariate input
106140
- **TiRex**: ⚠️ Univariate only - automatically transforms multivariate input
141+
- **LimiX**: ✅ Supports multivariate tabular features (standard in tabular inference)
107142

108143
When you provide multivariate input (features > 1) to FlowState or TiRex, the SDK automatically:
109144
1. Issues a warning
@@ -124,7 +159,19 @@ print(response.point.shape) # (2, 24, 3) - original structure preserved
124159

125160
## Available Models
126161

127-
### FlowState
162+
### Model Selection Guide
163+
164+
Choose your client and model based on your task:
165+
166+
| Task | Client | Models | Input | Output |
167+
|------|--------|--------|-------|--------|
168+
| **Time-Series Forecasting** | `ForecastClient` | FlowState, Chronos2, TiRex | 3D: `(batch, seq_len, features)` | 3D/4D point/quantiles |
169+
| **Tabular Classification** | `TabularClient` | LimiX | 2D: `(n_samples, n_features)` | 1D predictions + 2D probabilities |
170+
| **Tabular Regression** | `TabularClient` | LimiX | 2D: `(n_samples, n_features)` | 1D continuous predictions |
171+
172+
### Time-Series Models
173+
174+
#### FlowState
128175

129176
```python
130177
from faim_sdk import FlowStateForecastRequest
@@ -142,7 +189,7 @@ response = client.forecast(request)
142189
print(response.point.shape) # (batch_size, 24, features)
143190
```
144191

145-
### Chronos 2.0
192+
#### Chronos 2.0
146193

147194
```python
148195
from faim_sdk import Chronos2ForecastRequest
@@ -159,7 +206,7 @@ response = client.forecast(request)
159206
print(response.quantiles.shape) # (batch_size, 24, 5)
160207
```
161208

162-
### TiRex
209+
#### TiRex
163210

164211
```python
165212
from faim_sdk import TiRexForecastRequest
@@ -174,7 +221,7 @@ response = client.forecast(request)
174221
print(response.point.shape) # (batch_size, 24, features)
175222
```
176223

177-
## Tabular Inference with LimiX
224+
### LimiX
178225

179226
The SDK also supports **LimiX**, a foundation model for tabular classification and regression:
180227

@@ -282,9 +329,9 @@ request = LimiXPredictRequest(
282329
response = client.predict(request)
283330
```
284331

285-
## Response Format
332+
## Response Format (Time-Series Forecasting)
286333

287-
All forecasts return a `ForecastResponse` object with predictions and metadata:
334+
Time-series forecasts return a `ForecastResponse` object with predictions and metadata:
288335

289336
```python
290337
response = client.forecast(request)
@@ -308,9 +355,11 @@ print(response.metadata)
308355
# {'model_name': 'chronos2', 'model_version': '1.0', 'inference_time_ms': 123}
309356
```
310357

311-
## Evaluation & Metrics
358+
## Evaluation & Metrics (Time-Series Forecasting)
359+
360+
The SDK includes a comprehensive evaluation toolkit (`faim_sdk.eval`) for measuring time-series forecast quality with standard metrics and visualizations.
312361

313-
The SDK includes a comprehensive evaluation toolkit (`faim_sdk.eval`) for measuring forecast quality with standard metrics and visualizations.
362+
**Note**: These metrics are designed for time-series forecasting evaluation. For tabular model evaluation (classification/regression), use standard scikit-learn metrics like `accuracy_score`, `mean_squared_error`, etc. (see tabular examples above).
314363

315364
### Installation
316365

@@ -320,7 +369,7 @@ For visualization support, install with the viz extra:
320369
pip install faim-sdk[viz]
321370
```
322371

323-
### Available Metrics
372+
### Available Metrics for Time-Series
324373

325374
#### Mean Squared Error (MSE)
326375

@@ -372,9 +421,9 @@ crps_score = crps_from_quantiles(
372421
print(f"CRPS: {crps_score:.4f}")
373422
```
374423

375-
### Visualization
424+
### Visualization (Time-Series Only)
376425

377-
Plot forecasts with training context and ground truth:
426+
Plot time-series forecasts with training context and ground truth:
378427

379428
```python
380429
from faim_sdk.eval import plot_forecast
@@ -574,7 +623,21 @@ responses = asyncio.run(forecast_multiple_series())
574623

575624
See the `examples/` directory for complete Jupyter notebook examples:
576625

577-
- **`toy_example.ipynb`** - A toy example showing how to get started with FAIM and generate both point and probabilistic forecasts.
626+
### Time-Series Forecasting
627+
- **`toy_example.ipynb`** - Get started with FAIM and generate both point and probabilistic forecasts
628+
- **`airpassengers_dataset.ipynb`** - End-to-end example with AirPassengers dataset
629+
630+
### Tabular Inference with LimiX
631+
- **`limix_classification_example.ipynb`** - Binary classification on breast cancer dataset
632+
- Standard approach with LimiX
633+
- Retrieval-Augmented Inference (RAI) comparison
634+
- Side-by-side metrics comparison (Accuracy, Precision, Recall, F1-Score)
635+
636+
- **`limix_regression_example.ipynb`** - Regression on California housing dataset
637+
- Standard approach with LimiX
638+
- Retrieval-Augmented Inference (RAI) comparison
639+
- Comprehensive metrics comparison (MSE, RMSE, MAE, R²)
640+
- Residual statistics analysis
578641

579642
## Requirements
580643

@@ -586,6 +649,8 @@ See the `examples/` directory for complete Jupyter notebook examples:
586649

587650
## Performance Tips
588651

652+
### Time-Series Forecasting
653+
589654
1. **Batch Processing**: Process multiple time series in a single request for optimal throughput
590655
```python
591656
# Good: Single request with 32 series
@@ -599,6 +664,8 @@ See the `examples/` directory for complete Jupyter notebook examples:
599664

600665
3. **Async for Concurrent Requests**: Use `forecast_async()` with `asyncio.gather()` for parallel processing
601666

667+
### General (All Models)
668+
602669
4. **Connection Pooling**: Reuse client instances across requests instead of creating new ones
603670

604671
## Support

0 commit comments

Comments
 (0)