| # |
| # Copyright 2021 Google LLC |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| |
| # Private LSH clustering library |
| |
| load("@learning_py_pip_deps//:requirements.bzl", "requirement") |
| |
| package(default_visibility = [ |
| "//visibility:public", |
| ]) |
| |
| licenses(["notice"]) |
| |
| py_library( |
| name = "clustering_algorithm", |
| srcs = ["clustering_algorithm.py"], |
| srcs_version = "PY3", |
| deps = [ |
| ":clustering_params", |
| ":coreset_params", |
| ":default_clustering_params", |
| ":lsh_tree", |
| ":privacy_calculator", |
| ":private_outputs", |
| requirement("absl-py"), |
| requirement("numpy"), |
| requirement("scikit-learn"), |
| ], |
| ) |
| |
| py_test( |
| name = "clustering_algorithm_test", |
| srcs = ["clustering_algorithm_test.py"], |
| python_version = "PY3", |
| srcs_version = "PY3", |
| deps = [ |
| ":clustering_algorithm", |
| ":clustering_params", |
| requirement("absl-py"), |
| requirement("numpy"), |
| ], |
| ) |
| |
| py_library( |
| name = "central_privacy_utils", |
| srcs = ["central_privacy_utils.py"], |
| srcs_version = "PY3", |
| deps = [ |
| ":clustering_params", |
| "@com_google_python_dp_accounting//dp_accounting/pld:accountant", |
| "@com_google_python_dp_accounting//dp_accounting/pld:common", |
| requirement("numpy"), |
| requirement("scipy"), |
| ], |
| ) |
| |
| py_test( |
| name = "central_privacy_utils_test", |
| size = "large", |
| srcs = ["central_privacy_utils_test.py"], |
| python_version = "PY3", |
| srcs_version = "PY3", |
| deps = [ |
| ":central_privacy_utils", |
| ":clustering_params", |
| ":test_utils", |
| requirement("absl-py"), |
| requirement("numpy"), |
| requirement("scipy"), |
| ], |
| ) |
| |
| py_library( |
| name = "clustering_params", |
| srcs = ["clustering_params.py"], |
| srcs_version = "PY3", |
| deps = [ |
| requirement("absl-py"), |
| requirement("numpy"), |
| ], |
| ) |
| |
| py_test( |
| name = "clustering_params_test", |
| srcs = ["clustering_params_test.py"], |
| python_version = "PY3", |
| srcs_version = "PY3", |
| deps = [ |
| ":clustering_params", |
| requirement("absl-py"), |
| requirement("numpy"), |
| ], |
| ) |
| |
| py_library( |
| name = "coreset_params", |
| srcs = ["coreset_params.py"], |
| srcs_version = "PY3", |
| deps = [ |
| ":clustering_params", |
| ":privacy_calculator", |
| ], |
| ) |
| |
| py_test( |
| name = "coreset_params_test", |
| srcs = ["coreset_params_test.py"], |
| python_version = "PY3", |
| srcs_version = "PY3", |
| deps = [ |
| ":clustering_params", |
| ":coreset_params", |
| ":test_utils", |
| requirement("absl-py"), |
| ], |
| ) |
| |
| py_library( |
| name = "default_clustering_params", |
| srcs = ["default_clustering_params.py"], |
| srcs_version = "PY3", |
| deps = [ |
| ":central_privacy_utils", |
| ":clustering_params", |
| ":privacy_calculator", |
| requirement("numpy"), |
| ], |
| ) |
| |
| py_test( |
| name = "default_clustering_params_test", |
| srcs = ["default_clustering_params_test.py"], |
| python_version = "PY3", |
| srcs_version = "PY3", |
| deps = [ |
| ":central_privacy_utils", |
| ":clustering_params", |
| ":default_clustering_params", |
| ":test_utils", |
| requirement("absl-py"), |
| requirement("numpy"), |
| ], |
| ) |
| |
| py_library( |
| name = "lsh", |
| srcs = ["lsh.py"], |
| srcs_version = "PY3", |
| deps = [ |
| requirement("numpy"), |
| ], |
| ) |
| |
| py_test( |
| name = "lsh_test", |
| srcs = ["lsh_test.py"], |
| python_version = "PY3", |
| srcs_version = "PY3", |
| deps = [ |
| ":lsh", |
| requirement("absl-py"), |
| requirement("numpy"), |
| ], |
| ) |
| |
| py_library( |
| name = "lsh_tree", |
| srcs = ["lsh_tree.py"], |
| srcs_version = "PY3", |
| deps = [ |
| ":central_privacy_utils", |
| ":clustering_params", |
| ":coreset_params", |
| ":lsh", |
| requirement("absl-py"), |
| requirement("numpy"), |
| ], |
| ) |
| |
| py_test( |
| name = "lsh_tree_test", |
| size = "large", |
| srcs = ["lsh_tree_test.py"], |
| python_version = "PY3", |
| srcs_version = "PY3", |
| deps = [ |
| ":clustering_params", |
| ":lsh", |
| ":lsh_tree", |
| ":test_utils", |
| requirement("absl-py"), |
| requirement("numpy"), |
| requirement("scipy"), |
| ], |
| ) |
| |
| py_library( |
| name = "privacy_calculator", |
| srcs = ["privacy_calculator.py"], |
| srcs_version = "PY3", |
| deps = [ |
| ":central_privacy_utils", |
| ":clustering_params", |
| "@com_google_python_dp_accounting//dp_accounting:dp_event", |
| "@com_google_python_dp_accounting//dp_accounting:dp_event_builder", |
| "@com_google_python_dp_accounting//dp_accounting:mechanism_calibration", |
| "@com_google_python_dp_accounting//dp_accounting/pld:accountant", |
| "@com_google_python_dp_accounting//dp_accounting/pld:common", |
| "@com_google_python_dp_accounting//dp_accounting/pld:pld_privacy_accountant", |
| requirement("absl-py"), |
| requirement("numpy"), |
| ], |
| ) |
| |
| py_test( |
| name = "privacy_calculator_test", |
| size = "large", |
| srcs = ["privacy_calculator_test.py"], |
| python_version = "PY3", |
| srcs_version = "PY3", |
| deps = [ |
| ":central_privacy_utils", |
| ":clustering_params", |
| ":privacy_calculator", |
| "@com_google_python_dp_accounting//dp_accounting:dp_event", |
| "@com_google_python_dp_accounting//dp_accounting:mechanism_calibration", |
| "@com_google_python_dp_accounting//dp_accounting/pld:accountant", |
| requirement("absl-py"), |
| requirement("numpy"), |
| ], |
| ) |
| |
| py_library( |
| name = "private_outputs", |
| srcs = ["private_outputs.py"], |
| srcs_version = "PY3", |
| deps = [ |
| ":clustering_params", |
| requirement("numpy"), |
| ], |
| ) |
| |
| py_test( |
| name = "private_outputs_test", |
| srcs = ["private_outputs_test.py"], |
| python_version = "PY3", |
| srcs_version = "PY3", |
| deps = [ |
| ":private_outputs", |
| requirement("absl-py"), |
| requirement("numpy"), |
| ], |
| ) |
| |
| py_library( |
| name = "test_utils", |
| testonly = 1, |
| srcs = ["test_utils.py"], |
| srcs_version = "PY3", |
| deps = [ |
| ":central_privacy_utils", |
| ":clustering_params", |
| ":coreset_params", |
| ":privacy_calculator", |
| ], |
| ) |