Repository: lisa-lab/pylearn2

Issue:
Remove core files from whitelist
- [x] models/mlp.py
- [x] `costs/mlp/__init__.py`
- [x] costs/mlp/dropout.py
- [x] monitor.py
- [x] optimization/batch_gradient_descent.py
- [x] blocks.py
- [ ] expr/nnet.py
- [x] costs/cost.py
- [x] datasets/dense_design_matrix.py
- [x] datasets/dataset.py



Discussion:
I fixed `datasets/dense_design_matrix.py` as part of #799 

The whitelist is in `pylearn2/devtools/tests/test_format.py`


Resolving patch:
diff --git a/pylearn2/expr/nnet.py b/pylearn2/expr/nnet.py
--- a/pylearn2/expr/nnet.py
+++ b/pylearn2/expr/nnet.py
@@ -14,6 +14,7 @@
 from theano import tensor as T
 from theano.gof.op import get_debug_values
 
+
 def softmax_numpy(x):
     """
     .. todo::
@@ -33,6 +34,7 @@ def softmax_numpy(x):
     numer = np.exp(stable_x)
     return (numer.T / numer.sum(axis=1)).T
 
+
 def pseudoinverse_softmax_numpy(x):
     """
     .. todo::
@@ -56,6 +58,7 @@ def pseudoinverse_softmax_numpy(x):
     rval -= rval.mean()
     return rval
 
+
 def sigmoid_numpy(x):
     """
     .. todo::
@@ -65,6 +68,7 @@ def sigmoid_numpy(x):
     assert not isinstance(x, theano.gof.Variable)
     return 1. / (1. + np.exp(-x))
 
+
 def inverse_sigmoid_numpy(x):
     """
     .. todo::
@@ -73,6 +77,7 @@ def inverse_sigmoid_numpy(x):
     """
     return np.log(x / (1. - x))
 
+
 def arg_of_softmax(Y_hat):
     """
     Given the output of a call to theano.tensor.nnet.softmax,
@@ -102,12 +107,13 @@ def arg_of_softmax(Y_hat):
         op = owner.op
     if not isinstance(op, T.nnet.Softmax):
         raise ValueError("Expected Y_hat to be the output of a softmax, "
-                "but it appears to be the output of " + str(op) + " of type "
-                + str(type(op)))
-    z ,= owner.inputs
+                         "but it appears to be the output of " + str(op) +
+                         " of type " + str(type(op)))
+    z, = owner.inputs
     assert z.ndim == 2
     return z
 
+
 def kl(Y, Y_hat, batch_axis):
     """
     Warning: This function expects a sigmoid nonlinearity in the
@@ -169,6 +175,7 @@ def kl(Y, Y_hat, batch_axis):
 
     return ave
 
+
 def elemwise_kl(Y, Y_hat):
     """
     Warning: This function expects a sigmoid nonlinearity in the
@@ -253,6 +260,7 @@ def softmax_ratio(numer, denom):
 
     return new_num / new_den
 
+
 def compute_precision(tp, fp):
     """
     Computes the precision for the binary decisions.
@@ -273,6 +281,7 @@ def compute_precision(tp, fp):
     precision = tp / T.maximum(1., tp + fp)
     return precision
 
+
 def compute_recall(y, tp):
     """
     Computes the recall for the binary classification.
@@ -292,6 +301,7 @@ def compute_recall(y, tp):
     recall = tp / T.maximum(1., y.sum())
     return recall
 
+
 def compute_f1(precision, recall):
     """
     Computes the f1 score for the binary classification.
@@ -312,6 +322,5 @@ def compute_f1(precision, recall):
         f1 score for the binary decisions.
     """
     f1 = (2. * precision * recall /
-            T.maximum(1, precision + recall))
-    return f1
-
+          T.maximum(1, precision + recall))
+    return f1
\ No newline at end of file


Test patch:
diff --git a/pylearn2/devtools/tests/test_format.py b/pylearn2/devtools/tests/test_format.py
--- a/pylearn2/devtools/tests/test_format.py
+++ b/pylearn2/devtools/tests/test_format.py
@@ -168,7 +168,6 @@
     "packaged_dependencies/theano_linear/__init__.py",
     "packaged_dependencies/theano_linear/test_linear.py",
     "expr/tests/test_nnet.py",
-    "expr/nnet.py",
     "expr/image.py",
     "expr/coding.py",
     "expr/normalize.py",