@@ -71,6 +71,11 @@ def test_pairwise_distances():
7171 S = pairwise_distances (X , Y , metric = "minkowski" , ** kwds )
7272 S2 = pairwise_distances (X , Y , metric = minkowski , ** kwds )
7373 assert_array_almost_equal (S , S2 )
74+ # same with Y = None
75+ kwds = {"p" : 2.0 }
76+ S = pairwise_distances (X , metric = "minkowski" , ** kwds )
77+ S2 = pairwise_distances (X , metric = minkowski , ** kwds )
78+ assert_array_almost_equal (S , S2 )
7479 # Test that scipy distance metrics throw an error if sparse matrix given
7580 assert_raises (TypeError , pairwise_distances , X_sparse , metric = "minkowski" )
7681 assert_raises (TypeError , pairwise_distances , X , Y_sparse ,
@@ -126,11 +131,16 @@ def test_pairwise_kernels():
126131 # Test with a callable function, with given keywords.
127132 metric = callable_rbf_kernel
128133 kwds = {}
129- kwds ['gamma' ] = 0.
134+ kwds ['gamma' ] = 0.1
130135 K1 = pairwise_kernels (X , Y = Y , metric = metric , ** kwds )
131136 K2 = rbf_kernel (X , Y = Y , ** kwds )
132137 assert_array_almost_equal (K1 , K2 )
133138
139+ # callable function, X=Y
140+ K1 = pairwise_kernels (X , Y = X , metric = metric , ** kwds )
141+ K2 = rbf_kernel (X , Y = X , ** kwds )
142+ assert_array_almost_equal (K1 , K2 )
143+
134144
135145def test_pairwise_kernels_filter_param ():
136146 rng = np .random .RandomState (0 )
0 commit comments