89c3ddeef56b1183cd0ac003b5e9bccbad9e4b0d,nilearn/decoding/tests/test_sklearn_compatibility.py,,test_get_params,#,8
Before Change
// get_params() methods returned empty dicts.
cv_addition_params = ["n_alphas", "eps", "cv", "alpha_min"]
for model in [SmoothLassoClassifier, TVl1Classifier,
TVl1Regressor, SmoothLassoRegressor]:
kwargs = {}
if model.__name__.endswith("CV"):
kwargs["alphas"] = np.logspace(-3, 1, num=5)
for param in ["max_iter", "alpha", "l1_ratio", "verbose",
"tol", "mask", "memory", "copy_data",
"fit_intercept", "alphas"] + [
[], cv_addition_params][model.__name__.endswith("CV")]:
if model.__name__.endswith("CV"):
if param == "alpha":
continue
elif param == "alphas":
continue
m = model(**kwargs)
try:
params = m.get_params()
except AttributeError:
if "get_params" in traceback.format_exc():
params = m._get_params()
else:
raise
assert_true(param in params,
msg="Class "%s" doesn"t have parameter "%s"." % (
model.__name__, param))
After Change
// Issue /ቨ (on github) reported that our objects
// get_params() methods returned empty dicts.
for penalty in ["smooth-lasso", "tvl1"]:
for classif in [True, False]:
kwargs = {}
for param in ["max_iter", "alpha", "l1_ratio", "verbose",
"tol", "mask", "memory", "copy_data",
"fit_intercept", "alphas"]:
m = SpaceNet(penalty=penalty, classif=classif, **kwargs)
try:
params = m.get_params()
except AttributeError:
if "get_params" in traceback.format_exc():
params = m._get_params()
else:
raise
assert_true(param in params,
msg="%s doesn"t have parameter "%s"." % (
m, param))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: nilearn/nilearn
Commit Name: 89c3ddeef56b1183cd0ac003b5e9bccbad9e4b0d
Time: 2015-07-28
Author: elvis.dohmatob@inria.fr
File Name: nilearn/decoding/tests/test_sklearn_compatibility.py
Class Name:
Method Name: test_get_params
Project Name: pantsbuild/pants
Commit Name: b29d65416481efe627ee832e9f7e6646edcd81a6
Time: 2014-06-16
Author: john.sirois@gmail.com
File Name: tests/python/pants_test/test_utf8_header.py
Class Name: Utf8HeaderTest
Method Name: test_file_have_coding_utf8
Project Name: nilearn/nilearn
Commit Name: 1712b1d1d5ec050b89e24c233f30fdceb26ca1b0
Time: 2015-07-28
Author: elvis.dohmatob@inria.fr
File Name: nilearn/decoding/tests/test_sklearn_compatibility.py
Class Name:
Method Name: test_get_params