RD2L_Random_Forest / README.md
nick-leland's picture
Added the accuracy
4df65b4
---
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
---