Spaces:
Sleeping
Sleeping
Commit
•
1f4cd2f
1
Parent(s):
b9b1bad
uploaded model
Browse files- _2_scale_transform.py +69 -0
- m3_xg_boost.model +3 -0
_2_scale_transform.py
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
Filename: _2_scale_transform.py <br>
|
3 |
+
Title: Custom scale transformer for new user input <br>
|
4 |
+
Author: Raghava | GitHub: @raghavtwenty <br>
|
5 |
+
Date Created: June 10, 2023 | Last Updated: May 13, 2024 <br>
|
6 |
+
Language: Python | Version: 3.10.14, 64-bit <br>
|
7 |
+
"""
|
8 |
+
|
9 |
+
# Importing required library
|
10 |
+
import numpy as np
|
11 |
+
|
12 |
+
|
13 |
+
# Transformation function
|
14 |
+
def transform_new_input(new_input):
|
15 |
+
|
16 |
+
# Scaled minimum and maximum values from preprocessing
|
17 |
+
scaled_min = np.array(
|
18 |
+
[
|
19 |
+
1.0,
|
20 |
+
10.0,
|
21 |
+
856.0,
|
22 |
+
5775.0,
|
23 |
+
42.0,
|
24 |
+
26.0,
|
25 |
+
0.0,
|
26 |
+
278.0,
|
27 |
+
4.0,
|
28 |
+
1.0,
|
29 |
+
-630355.0,
|
30 |
+
4.0,
|
31 |
+
50.0,
|
32 |
+
]
|
33 |
+
)
|
34 |
+
|
35 |
+
scaled_max = np.array(
|
36 |
+
[
|
37 |
+
4.0,
|
38 |
+
352752.0,
|
39 |
+
271591638.0,
|
40 |
+
239241314.0,
|
41 |
+
421552.0,
|
42 |
+
3317.0,
|
43 |
+
6302708.0,
|
44 |
+
6302708.0,
|
45 |
+
5.0,
|
46 |
+
5.0,
|
47 |
+
1746749.0,
|
48 |
+
608.0,
|
49 |
+
1012128.0,
|
50 |
+
]
|
51 |
+
)
|
52 |
+
|
53 |
+
new_input = np.array(new_input)
|
54 |
+
|
55 |
+
# Formula for transformation
|
56 |
+
scaled_input = (new_input - scaled_min) / (scaled_max - scaled_min)
|
57 |
+
|
58 |
+
return scaled_input
|
59 |
+
|
60 |
+
|
61 |
+
# Main
|
62 |
+
if __name__ == "__main__":
|
63 |
+
# Test case
|
64 |
+
test_input = [
|
65 |
+
[2, 209, 20671, 6316631, 274, 96, 3527, 2757949, 5, 2, 183877, 8, 90494]
|
66 |
+
]
|
67 |
+
|
68 |
+
print("Scaled value: ")
|
69 |
+
print(transform_new_input(test_input))
|
m3_xg_boost.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bb191415e4c9d444d0a421f5e35859ed3eadd4da2c920d6a1d43f07b39ecb4ed
|
3 |
+
size 686556
|