more lint

This commit is contained in:
npapernot 2019-07-29 22:15:52 +00:00
parent ed93cf6f44
commit b1f1c47cae
5 changed files with 35 additions and 25 deletions

View file

@ -40,6 +40,7 @@ class StrongConvexMixin:
def radius(self):
"""Radius, R, of the hypothesis space W.
W is a convex set that forms the hypothesis space.
Returns:
@ -114,7 +115,7 @@ class StrongConvexHuber(losses.Loss, StrongConvexMixin):
Args:
reg_lambda: Weight regularization constant
C: Penalty parameter C of the loss term
c_arg: Penalty parameter C of the loss term
radius_constant: constant defining the length of the radius
delta: delta value in huber loss. When to switch from quadratic to
absolute deviation.
@ -147,7 +148,7 @@ class StrongConvexHuber(losses.Loss, StrongConvexMixin):
)
def call(self, y_true, y_pred):
"""Computes loss
"""Computes loss.
Args:
y_true: Ground truth values. One hot encoded using -1 and 1.

View file

@ -200,6 +200,7 @@ class BoltonModel(Model): # pylint: disable=abstract-method
Bolton paper for more description.
n_samples: number of individual samples in x
steps_per_epoch:
**kwargs: **kwargs
"""
if class_weight is None:
class_weight = self.calculate_class_weights(class_weight)

View file

@ -275,7 +275,8 @@ def _do_fit(n_samples,
loss: instance of TestLoss
distribution: distribution to get noise from.
Returns: BoltonModel instsance
Returns:
BoltonModel instsance
"""
clf = models.BoltonModel(n_outputs)
clf.compile(optimizer, loss)

View file

@ -184,7 +184,7 @@ class Bolton(optimizer_v2.OptimizerV2):
Args:
input_dim: the input dimensionality for the weights
output_dim the output dimensionality for the weights
output_dim: the output dimensionality for the weights
Returns:
Noise in shape of layer's weights to be added to the weights.
@ -236,7 +236,8 @@ class Bolton(optimizer_v2.OptimizerV2):
Args:
name:
Returns: attribute from Bolton if specified to come from self, else
Returns:
attribute from Bolton if specified to come from self, else
from _internal_optimizer.
"""
if name == '_private_attributes' or name in self._private_attributes:
@ -254,7 +255,7 @@ class Bolton(optimizer_v2.OptimizerV2):
)
def __setattr__(self, key, value):
""" Set attribute to self instance if its the internal optimizer.
"""Set attribute to self instance if its the internal optimizer.
Reroute everything else to the _internal_optimizer.
@ -333,6 +334,9 @@ class Bolton(optimizer_v2.OptimizerV2):
tensor with dim == n_classes.
n_samples: number of rows/individual samples in the training set
batch_size: batch size used.
Returns:
self
"""
if epsilon <= 0:
raise ValueError('Detected epsilon: {0}. '
@ -354,8 +358,8 @@ class Bolton(optimizer_v2.OptimizerV2):
def __exit__(self, *args):
"""Exit call from with statement.
used to
Used to:
1.reset the model and fit parameters passed to the optimizer
to enable the Bolton Privacy guarantees. These are reset to ensure
that any future calls to fit with the same instance of the optimizer
@ -363,6 +367,9 @@ class Bolton(optimizer_v2.OptimizerV2):
2.call post-fit methods normalizing/projecting the model weights and
adding noise to the weights.
Args:
*args: *args
"""
self.project_weights_to_r(True)
for layer in self.layers: