Commit
·
9814135
1
Parent(s):
50a62d2
Updated README
Browse files
README.md
CHANGED
@@ -1,3 +1,60 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: mit
|
3 |
---
|
|
|
|
1 |
---
|
2 |
+
tags:
|
3 |
+
- tabular
|
4 |
+
- regression
|
5 |
+
- tabular-regression
|
6 |
+
- dota
|
7 |
+
---
|
8 |
+
|
9 |
+
## Validation Metrics
|
10 |
+
|
11 |
+
- R2: 0.63
|
12 |
+
- MSE: 2428.91
|
13 |
+
- MAE: 34.33
|
14 |
+
- RMSE: 49.28
|
15 |
+
|
16 |
+
## Usage
|
17 |
+
|
18 |
+
```python
|
19 |
+
import numpy as np
|
20 |
+
from numpy import random
|
21 |
+
import pandas as pd
|
22 |
+
import onnxruntime as ort
|
23 |
+
|
24 |
+
# Load the saved file
|
25 |
+
model_path = "rd2l_forest.onnx"
|
26 |
+
session = ort.InferenceSession(model_path)
|
27 |
+
|
28 |
+
# Define default naming scheme
|
29 |
+
input_name = session.get_inputs()[0].name
|
30 |
+
output_name = session.get_outputs()[0].name
|
31 |
+
|
32 |
+
def prediction(input_data : np.ndarray) -> float
|
33 |
+
"""
|
34 |
+
Performs inference on the loaded ONNX model using the provided input data.
|
35 |
+
|
36 |
+
Args:
|
37 |
+
input_data (np.ndarray): An array of size (263,), this represents all of a singular players information
|
38 |
+
|
39 |
+
Returns:
|
40 |
+
float: The predicted cost of the player
|
41 |
+
|
42 |
+
"""
|
43 |
+
|
44 |
+
# Convert to onnx input format and reshape
|
45 |
+
input_data = input_data.to_numpy(dtype=np.float32).reshape(1, -1)
|
46 |
+
|
47 |
+
# Create prediction
|
48 |
+
predictions = session.run([output_name], {input_name: input_data})
|
49 |
+
|
50 |
+
# Convert to individual value
|
51 |
+
return round(float(predictions[0][0][0]), 2)
|
52 |
+
|
53 |
+
sample_df = pd.DataFrame(np.random.rand(263))
|
54 |
+
|
55 |
+
prediction(sample_df)
|
56 |
+
```
|
57 |
+
---
|
58 |
license: mit
|
59 |
---
|
60 |
+
|