Refactoring bolton package to bolt_on only in code usages.
This commit is contained in:
parent
223f2cc640
commit
c0bd19365b
10 changed files with 23 additions and 23 deletions
|
@ -42,8 +42,8 @@ else:
|
||||||
from privacy.optimizers.dp_optimizer import DPGradientDescentGaussianOptimizer
|
from privacy.optimizers.dp_optimizer import DPGradientDescentGaussianOptimizer
|
||||||
from privacy.optimizers.dp_optimizer import DPGradientDescentOptimizer
|
from privacy.optimizers.dp_optimizer import DPGradientDescentOptimizer
|
||||||
|
|
||||||
from privacy.bolton.models import BoltOnModel
|
from privacy.bolt_on.models import BoltOnModel
|
||||||
from privacy.bolton.optimizers import BoltOn
|
from privacy.bolt_on.optimizers import BoltOn
|
||||||
from privacy.bolton.losses import StrongConvexMixin
|
from privacy.bolt_on.losses import StrongConvexMixin
|
||||||
from privacy.bolton.losses import StrongConvexBinaryCrossentropy
|
from privacy.bolt_on.losses import StrongConvexBinaryCrossentropy
|
||||||
from privacy.bolton.losses import StrongConvexHuber
|
from privacy.bolt_on.losses import StrongConvexHuber
|
||||||
|
|
|
@ -23,7 +23,7 @@ if LooseVersion(tf.__version__) < LooseVersion("2.0.0"):
|
||||||
if hasattr(sys, "skip_tf_privacy_import"): # Useful for standalone scripts.
|
if hasattr(sys, "skip_tf_privacy_import"): # Useful for standalone scripts.
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
from privacy.bolton.models import BoltOnModel # pylint: disable=g-import-not-at-top
|
from privacy.bolt_on.models import BoltOnModel # pylint: disable=g-import-not-at-top
|
||||||
from privacy.bolton.optimizers import BoltOn # pylint: disable=g-import-not-at-top
|
from privacy.bolt_on.optimizers import BoltOn # pylint: disable=g-import-not-at-top
|
||||||
from privacy.bolton.losses import StrongConvexHuber # pylint: disable=g-import-not-at-top
|
from privacy.bolt_on.losses import StrongConvexHuber # pylint: disable=g-import-not-at-top
|
||||||
from privacy.bolton.losses import StrongConvexBinaryCrossentropy # pylint: disable=g-import-not-at-top
|
from privacy.bolt_on.losses import StrongConvexBinaryCrossentropy # pylint: disable=g-import-not-at-top
|
|
@ -25,9 +25,9 @@ import tensorflow as tf
|
||||||
from tensorflow.python.framework import test_util
|
from tensorflow.python.framework import test_util
|
||||||
from tensorflow.python.keras import keras_parameterized
|
from tensorflow.python.keras import keras_parameterized
|
||||||
from tensorflow.python.keras.regularizers import L1L2
|
from tensorflow.python.keras.regularizers import L1L2
|
||||||
from privacy.bolton.losses import StrongConvexBinaryCrossentropy
|
from privacy.bolt_on.losses import StrongConvexBinaryCrossentropy
|
||||||
from privacy.bolton.losses import StrongConvexHuber
|
from privacy.bolt_on.losses import StrongConvexHuber
|
||||||
from privacy.bolton.losses import StrongConvexMixin
|
from privacy.bolt_on.losses import StrongConvexMixin
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
|
@ -20,8 +20,8 @@ import tensorflow as tf
|
||||||
from tensorflow.python.framework import ops as _ops
|
from tensorflow.python.framework import ops as _ops
|
||||||
from tensorflow.python.keras import optimizers
|
from tensorflow.python.keras import optimizers
|
||||||
from tensorflow.python.keras.models import Model
|
from tensorflow.python.keras.models import Model
|
||||||
from privacy.bolton.losses import StrongConvexMixin
|
from privacy.bolt_on.losses import StrongConvexMixin
|
||||||
from privacy.bolton.optimizers import BoltOn
|
from privacy.bolt_on.optimizers import BoltOn
|
||||||
|
|
||||||
|
|
||||||
class BoltOnModel(Model): # pylint: disable=abstract-method
|
class BoltOnModel(Model): # pylint: disable=abstract-method
|
|
@ -24,9 +24,9 @@ from tensorflow.python.keras import keras_parameterized
|
||||||
from tensorflow.python.keras import losses
|
from tensorflow.python.keras import losses
|
||||||
from tensorflow.python.keras.optimizer_v2.optimizer_v2 import OptimizerV2
|
from tensorflow.python.keras.optimizer_v2.optimizer_v2 import OptimizerV2
|
||||||
from tensorflow.python.keras.regularizers import L1L2
|
from tensorflow.python.keras.regularizers import L1L2
|
||||||
from privacy.bolton import models
|
from privacy.bolt_on import models
|
||||||
from privacy.bolton.losses import StrongConvexMixin
|
from privacy.bolt_on.losses import StrongConvexMixin
|
||||||
from privacy.bolton.optimizers import BoltOn
|
from privacy.bolt_on.optimizers import BoltOn
|
||||||
|
|
||||||
|
|
||||||
class TestLoss(losses.Loss, StrongConvexMixin):
|
class TestLoss(losses.Loss, StrongConvexMixin):
|
|
@ -20,7 +20,7 @@ from __future__ import print_function
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
from tensorflow.python.keras.optimizer_v2 import optimizer_v2
|
from tensorflow.python.keras.optimizer_v2 import optimizer_v2
|
||||||
from tensorflow.python.ops import math_ops
|
from tensorflow.python.ops import math_ops
|
||||||
from privacy.bolton.losses import StrongConvexMixin
|
from privacy.bolt_on.losses import StrongConvexMixin
|
||||||
|
|
||||||
_accepted_distributions = ['laplace'] # implemented distributions for noising
|
_accepted_distributions = ['laplace'] # implemented distributions for noising
|
||||||
|
|
|
@ -28,8 +28,8 @@ from tensorflow.python.keras.models import Model
|
||||||
from tensorflow.python.keras.optimizer_v2.optimizer_v2 import OptimizerV2
|
from tensorflow.python.keras.optimizer_v2.optimizer_v2 import OptimizerV2
|
||||||
from tensorflow.python.keras.regularizers import L1L2
|
from tensorflow.python.keras.regularizers import L1L2
|
||||||
from tensorflow.python.platform import test
|
from tensorflow.python.platform import test
|
||||||
from privacy.bolton import optimizers as opt
|
from privacy.bolt_on import optimizers as opt
|
||||||
from privacy.bolton.losses import StrongConvexMixin
|
from privacy.bolt_on.losses import StrongConvexMixin
|
||||||
|
|
||||||
|
|
||||||
class TestModel(Model): # pylint: disable=abstract-method
|
class TestModel(Model): # pylint: disable=abstract-method
|
|
@ -16,9 +16,9 @@ from __future__ import absolute_import
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import tensorflow as tf # pylint: disable=wrong-import-position
|
import tensorflow as tf # pylint: disable=wrong-import-position
|
||||||
from privacy.bolton import losses # pylint: disable=wrong-import-position
|
from privacy.bolt_on import losses # pylint: disable=wrong-import-position
|
||||||
from privacy.bolton import models # pylint: disable=wrong-import-position
|
from privacy.bolt_on import models # pylint: disable=wrong-import-position
|
||||||
from privacy.bolton.optimizers import BoltOn # pylint: disable=wrong-import-position
|
from privacy.bolt_on.optimizers import BoltOn # pylint: disable=wrong-import-position
|
||||||
# -------
|
# -------
|
||||||
# First, we will create a binary classification dataset with a single output
|
# First, we will create a binary classification dataset with a single output
|
||||||
# dimension. The samples for each label are repeated data points at different
|
# dimension. The samples for each label are repeated data points at different
|
||||||
|
|
Loading…
Reference in a new issue