amirTamer commited on
Commit
afb6160
·
1 Parent(s): a1f32e7
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -20,19 +20,19 @@ def load_pickle_file(file_name):
20
  return None
21
 
22
 
23
- def build_knn_from_pca_package(package):
24
- if package is None:
25
- return None
26
 
27
- required_keys = {"best_k", "weights", "X_train", "y_train", "pca_mean", "pca_components"}
28
- missing_keys = required_keys.difference(package)
29
- if missing_keys:
30
- print(f"knn_pca.pkl is missing keys: {sorted(missing_keys)}")
31
- return None
32
 
33
- knn = MultimodeKNN(k=package["best_k"], weights=package["weights"])
34
- knn.fit(package["X_train"], package["y_train"])
35
- return knn
36
 
37
  gnb_package = load_pickle_file("gnb_digit6_package.pkl")
38
  pca_multi = load_pickle_file("pcaMulti.pkl")
@@ -73,7 +73,7 @@ svm_scaler = load_pickle_file("svmScaler.pkl")
73
 
74
 
75
  knn_model_binary = load_pickle_file('knn_final_model.pkl')
76
- knn_multi = build_knn_from_pca_package(pca_KNN)
77
 
78
  gnb_multimode_model = load_pickle_file('gnbMulti.pkl')
79
  if gnb_multimode_model is not None:
 
20
  return None
21
 
22
 
23
+ # def build_knn_from_pca_package(package):
24
+ # if package is None:
25
+ # return None
26
 
27
+ # required_keys = {"best_k", "weights", "X_train", "y_train", "pca_mean", "pca_components"}
28
+ # missing_keys = required_keys.difference(package)
29
+ # if missing_keys:
30
+ # print(f"knn_pca.pkl is missing keys: {sorted(missing_keys)}")
31
+ # return None
32
 
33
+ # knn = MultimodeKNN(k=package["best_k"], weights=package["weights"])
34
+ # knn.fit(package["X_train"], package["y_train"])
35
+ # return knn
36
 
37
  gnb_package = load_pickle_file("gnb_digit6_package.pkl")
38
  pca_multi = load_pickle_file("pcaMulti.pkl")
 
73
 
74
 
75
  knn_model_binary = load_pickle_file('knn_final_model.pkl')
76
+ knn_multi = load_pickle_file("knn_hog_pca.pkl")
77
 
78
  gnb_multimode_model = load_pickle_file('gnbMulti.pkl')
79
  if gnb_multimode_model is not None: