Skip to content

Commit

Permalink
Removing unused code (#400)
Browse files Browse the repository at this point in the history
* clean-ups

* tiny fix

* format

* format c++
  • Loading branch information
dvadym authored Nov 13, 2021
1 parent 8d349c1 commit 0237b5e
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 106 deletions.
1 change: 0 additions & 1 deletion src/bindings/PyDP/algorithms/bounded_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "algorithms/bounded-variance.h"

#include "../pydp_lib/algorithm_builder.hpp"
#include "../pydp_lib/casting.hpp" // our caster helper library

using namespace std;

Expand Down
1 change: 0 additions & 1 deletion src/bindings/PyDP/algorithms/rand.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Provides bindings for rand
#include "algorithms/rand.h"
#include "../pydp_lib/casting.hpp"
#include "pybind11/pybind11.h"

namespace py = pybind11;
Expand Down
3 changes: 1 addition & 2 deletions src/bindings/PyDP/base/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

#include "pybind11/pybind11.h"

#include "../pydp_lib/casting.hpp" // our caster helper library
#include "base/logging.h" // the header file associated with logging.cc
#include "base/logging.h" // the header file associated with logging.cc

namespace py = pybind11;
namespace dpb = differential_privacy::base;
Expand Down
4 changes: 1 addition & 3 deletions src/bindings/PyDP/base/status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

#include <string>

#include "../pydp_lib/casting.hpp" // our caster helper library
#include "pybind11/operators.h" // for overloading the operators
#include "pybind11/operators.h" // for overloading the operators
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"

#include "base/status.h" // the header file associated with status.cc
#include "base/statusor.h" //header file associated with statusor.cc
// #include "differential_privacy/proto/data.pb.h" // for Output type

using namespace std;

Expand Down
12 changes: 0 additions & 12 deletions src/bindings/PyDP/mechanisms/mechanism.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
#include "pybind11/functional.h"
#include "pybind11/stl.h"

#include "algorithms/distributions.h"
#include "algorithms/numerical-mechanisms.h"

#include "../pydp_lib/algorithm_builder.hpp"
#include "../pydp_lib/casting.hpp"

using namespace std;

Expand Down Expand Up @@ -107,11 +105,6 @@ class LaplaceMechanismBinder {
builder.Build().value());
}

static std::unique_ptr<dp::NumericalMechanismBuilder> clone() {
dp::LaplaceMechanism::Builder cloner;
return std::move(cloner.Clone());
}

static void DeclareIn(py::module& m) {
py::class_<dp::LaplaceMechanism, dp::NumericalMechanism> lap_mech(
m, "LaplaceMechanism");
Expand Down Expand Up @@ -140,11 +133,6 @@ class GaussianMechanismBinder {
builder.Build().value());
};

static std::unique_ptr<dp::NumericalMechanismBuilder> clone() {
dp::GaussianMechanism::Builder cloner;
return std::move(cloner.Clone());
};

static void DeclareIn(py::module& m) {
py::class_<dp::GaussianMechanism, dp::NumericalMechanism> gaus_mech(
m, "GaussianMechanism");
Expand Down
2 changes: 0 additions & 2 deletions src/bindings/PyDP/proto/proto.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include <fstream>
#include <string>

#include "../pydp_lib/casting.hpp" // our caster helper library
#include "pybind11/pybind11.h"

#include "proto/summary.pb.h"
#include "proto/util.h" // the header file associated with status.cc

using namespace std;

Expand Down
13 changes: 0 additions & 13 deletions src/bindings/PyDP/pydp_lib/casting.hpp

This file was deleted.

60 changes: 0 additions & 60 deletions tests/algorithms/conftest.py

This file was deleted.

This file was deleted.

13 changes: 4 additions & 9 deletions tests/algorithms/test_order_statistics.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# stdlib
import math

# verify with actual value
import statistics

# third party
from conftest import expect_near
from conftest import percentile
import pytest

# pydp absolute
Expand All @@ -32,8 +27,8 @@ def test_min(data, dtype):
minn = dp.algorithms.laplacian.Min(
dtype=dtype, epsilon=1.0, lower_bound=0, upper_bound=200
)
assert expect_near(min(data), minn.quick_result(data), 10)
assert expect_near(0, minn.quick_result(data), 10)
assert minn.quick_result(data) == pytest.approx(min(data), abs=10)
assert minn.quick_result(data) == pytest.approx(0, abs=10)


@pytest.mark.parametrize("dtype, data", [("int", data_ints), ("float", data_floats)])
Expand All @@ -43,7 +38,7 @@ def test_max(data, dtype):
)
assert 190 < maxx.quick_result(data) < 210

assert expect_near(max(data), maxx.quick_result(data), 10)
assert maxx.quick_result(data) == pytest.approx(max(data), abs=10)


@pytest.mark.parametrize("dtype, data", [("int", data_ints), ("float", data_floats)])
Expand All @@ -53,7 +48,7 @@ def test_median(data, dtype):
dtype=dtype, epsilon=1.0, lower_bound=0, upper_bound=200
)

assert expect_near(statistics.median(data), median.quick_result(data), 20)
assert median.quick_result(data) == pytest.approx(statistics.median(data), abs=20)


@pytest.mark.parametrize("dtype", ["int", "float"])
Expand Down
1 change: 0 additions & 1 deletion tests/algorithms/test_partition_selection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np
import pytest
import pydp as dp
from pydp.algorithms.partition_selection import create_partition_strategy

# TODO - wait for NumericalMechanism implementation to use those for testing Laplace/Gaussian Partition Selection.
Expand Down

0 comments on commit 0237b5e

Please sign in to comment.