File size: 1,291 Bytes
869bfa3
9814135
 
 
 
 
 
 
 
 
4df65b4
9814135
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
869bfa3
 
9814135
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---

tags:
- tabular
- regression
- tabular-regression
- dota
---


## Validation Metrics

- Accuracy: 0.8284240188362744
- R2: 0.63
- MSE: 2428.91
- MAE: 34.33
- RMSE: 49.28

## Usage

```python

import numpy as np

from numpy import random

import pandas as pd

import onnxruntime as ort



# Load the saved file

model_path = "rd2l_forest.onnx"

session = ort.InferenceSession(model_path)



# Define default naming scheme

input_name = session.get_inputs()[0].name

output_name = session.get_outputs()[0].name



def prediction(input_data : np.ndarray) -> float

    """

    Performs inference on the loaded ONNX model using the provided input data.



    Args:

        input_data (np.ndarray): An array of size (263,), this represents all of a singular players information



    Returns:

        float: The predicted cost of the player



    """

    

    # Convert to onnx input format and reshape 

    input_data = input_data.to_numpy(dtype=np.float32).reshape(1, -1)



    # Create prediction

    predictions = session.run([output_name], {input_name: input_data})



    # Convert to individual value

    return round(float(predictions[0][0][0]), 2)



sample_df = pd.DataFrame(np.random.rand(263))



prediction(sample_df)

```
---
license: mit
---