binoua commited on
Commit
55714b8
1 Parent(s): a288dbb

chore: better accuracy

Browse files
compiled_model/client.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1a0e943aec188cb35e60d78e2280a4a4b346aded279b692a6be2d01f1a045710
3
- size 104293
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d39a9cede3a266cbf62cec33bf05fffe63c5bc11fbfe0781e0d49043ae133754
3
+ size 104292
compiled_model/server.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:72f18576ba0bfe05cdadcc34a8a65233286e158c8f2b70880d99457b1b860378
3
  size 2687
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c876bee83abe4fc626d129544390568d9d05786f72ef19f3ff656499505e1494
3
  size 2687
creating_models.py CHANGED
@@ -11,7 +11,7 @@ def compile_and_make_it_deployable(model_dev, X_train):
11
  path_to_model = Path("compiled_model")
12
 
13
  # Compile into FHE
14
- model_dev.compile(X_train, p_error=0.8)
15
 
16
  # Saving the model
17
  shutil.rmtree(path_to_model, ignore_errors=True)
@@ -27,6 +27,12 @@ def compile_and_make_it_deployable(model_dev, X_train):
27
 
28
  print(f"Your keys will be {sys.getsizeof(evaluation_keys) / 1024 / 1024}-megabytes long")
29
 
 
 
 
 
 
 
30
 
31
  # This is the spam classifier. Taken from https://github.com/zama-ai/concrete-ml/blob/main/docs/advanced_examples/DecisionTreeClassifier.ipynb
32
  import numpy
 
11
  path_to_model = Path("compiled_model")
12
 
13
  # Compile into FHE
14
+ model_dev.compile(X_train, p_error=0.01)
15
 
16
  # Saving the model
17
  shutil.rmtree(path_to_model, ignore_errors=True)
 
27
 
28
  print(f"Your keys will be {sys.getsizeof(evaluation_keys) / 1024 / 1024}-megabytes long")
29
 
30
+ # Check accuracy with p_error
31
+ y_pred_concrete = model_dev.predict_proba(x_test, fhe="simulate")[:, 1]
32
+ concrete_average_precision = average_precision_score(y_test, y_pred_concrete)
33
+
34
+ print(f"Concrete average precision score (simulate): {concrete_average_precision:0.2f}")
35
+
36
 
37
  # This is the spam classifier. Taken from https://github.com/zama-ai/concrete-ml/blob/main/docs/advanced_examples/DecisionTreeClassifier.ipynb
38
  import numpy