hendriawan

day3-01-portingModel-ke-bahasaC

Nov 29th, 2022 (edited)
1,373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | Source Code | 0 0
  1. from micromlgen import port
  2. from sklearn.svm import SVC
  3. from sklearn.datasets import load_iris
  4.  
  5. iris = load_iris ()
  6. X = iris.data
  7. y = iris.target
  8.  
  9. model=SVC(kernel='linear', gamma=0.01)
  10. model.fit(X,y)
  11.  
  12. weights= port(model)
  13. file = open ("SVMClassifier.h","w+")
  14. # convert ke string agar bisa ditulis ke file
  15. content = str(weights)
  16. file.write(content)
  17. file.close
  18.  
  19.  
Advertisement
Add Comment
Please, Sign In to add comment