| --- |
| language: en |
| license: mit |
| tags: |
| - text-classification |
| - ufc |
| - prediction |
| - sports |
| --- |
| |
| # UFC Fight Outcome Predictor (DistilBERT-based) |
|
|
| This model is a fine-tuned BERT classifier designed to predict the **outcome of UFC fights** based on textual inputs such as pre-fight analysis, fighter stats. It is trained as a **binary text classification** model. |
|
|
| ## Use Case |
|
|
| You can use this model to: |
| - Predict likely fight outcomes from textual descriptions |
|
|
| ## Model Details |
|
|
| - **Base model**: `bert-base-uncased` |
| - **Task**: Binary text classification (Win / Loss) |
| - **Training data**: Custom UFC-related dataset |
| - **Input**: Text (e.g., fighter matchups, stats) |
| - **Output**: Binary class prediction (`0 = Fighter B wins`, `1 = Fighter A wins`) |
|
|
| ## Example Usage (Python) |
|
|
| ```python |
| from transformers import DistilBertForSequenceClassification, DistilBertTokenizer |
| |
| loaded_model = DistilBertForSequenceClassification.from_pretrained("/content/fine_tuned_ufc_model") |
| loaded_tokenizer = DistilBertTokenizer.from_pretrained("/content/fine_tuned_ufc_model") |
| |
| def predict_winner(fighter_a_stats, fighter_b_stats, model, tokenizer): |
| |
| input_text = ( |
| f"Fighter A: {fighter_a_stats} || Fighter B: {fighter_b_stats}" |
| ) |
| inputs = tokenizer(input_text, return_tensors="pt", truncation=True, padding=True).to(device) |
| outputs = model(**inputs) |
| probs = torch.nn.functional.softmax(outputs.logits, dim=-1) |
| pred = torch.argmax(probs, dim=1).item() |
| return {"Fighter A wins": float(probs[0][0]), "Fighter B wins": float(probs[0][1])}, pred |
| |
| fighter_a = "Height: 73 in | Reach: 80 in | Str. Acc: 0.57 | Str. Def: 0.58 | SLpM: 4.25 | SApM: 2.12" |
| fighter_b = "Height: 70 in | Reach: 71 in | Str. Acc: 0.49 | Str. Def: 0.55 | SLpM: 4.00 | SApM: 3.00" |
| |
| probs, winner = predict_winner(fighter_a, fighter_b, loaded_model, loaded_tokenizer) |
| print(probs, "Winner Label (0=A, 1=B):", winner) |
| |
| // Example Output: {'Fighter A wins': 0.03644789755344391, 'Fighter B wins': 0.9635520577430725} Winner Label (0=A, 1=B): 1 |
| ``` |
|
|
| ## Files |
| - model.safetensors: The model weights in safetensors format |
| - config.json: Model architecture config |
| - tokenizer_config.json, special_tokens_map.json, vocab.txt: Tokenizer files |
| |
| ✍️ Author |
| Created by @Ishwak1 |
| |
| ### For questions or fine-tuning on your own fight data, feel free to open a discussion! |