LSTM-64win-Keystrokes
Summary
This repository contains a PyTorch LSTM classifier for Human vs HID keystroke control detection using windowed timing features. The label for each window is the last keystroke label in that window.
Training setup (as implemented)
- Window size: 64
- Stride: 1
- Label mapping: {"human": 0, "hid": 1}
- Window label: last-keystroke in the window
- Features (F=10):
durationDD_timeDU_timeUD_timeUU_timerun_avg_durationrun_avg_DDrun_avg_DUrun_avg_UDrun_avg_UU
Preprocessing
- Windows built with NumPy
sliding_window_view. - Standardization via
StandardScalerfitted on training windows only, across all timesteps and samples.
Model
torch.nn.LSTM(unidirectional, batch_first)- Hidden size: 64
- Num layers: 1
- Dropout: 0.0
- Head: Linear(hidden_size → 2)
Optimization
- Optimizer: Adam
- LR: 0.001
- Batch size: 256
- Epochs: 30
- Seed: 42
Files
model.safetensors: model weightsconfig.json: architecture + feature metadatascaler.joblib: fitted StandardScalermetrics.json: classification report + confusion matrixinference.py: minimal loading + prediction example
Usage (minimal)
from inference import load_model_and_scaler, predict_df
model, scaler, cfg = load_model_and_scaler("NourFakih/LSTM-64win-Keystrokes")
y_pred = predict_df(df, model, scaler, cfg) # df must contain cfg["feature_cols"]
- Downloads last month
- -
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support