yashriva commited on
Commit
60abf7d
1 Parent(s): 1d368d2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +36 -0
README.md CHANGED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - scikit-learn/iris
4
+ ---
5
+
6
+ ```python
7
+ import joblib
8
+
9
+ model = joblib.load("iris_svm.joblib")
10
+ import json
11
+
12
+ with open("config.json", "r") as f:
13
+ config = json.load(f)
14
+
15
+ features = config["features"]
16
+ target = config["targets"][0]
17
+ target_mapping = config["target_mapping"]
18
+
19
+ import numpy as np
20
+
21
+ # example input data
22
+ input_data = np.array([
23
+ [5.1, 3.5, 1.4, 0.2],
24
+ [4.9, 3.0, 1.4, 0.2],
25
+ [6.2, 3.4, 5.4, 2.3]
26
+ ])
27
+
28
+ # make sure the input data has the correct shape
29
+ if input_data.shape[1] != len(features):
30
+ raise ValueError(f"Input data must have {len(features)} features.")
31
+
32
+ predicted_classes = model.predict(input_data)
33
+ predicted_class_names = [list(target_mapping.keys())[list(target_mapping.values()).index(predicted_class)] for predicted_class in predicted_classes]
34
+
35
+ print("Predicted classes:", predicted_class_names)
36
+ ```