6
6
import warnings
7
7
from sklearn .utils import check_random_state
8
8
from sklearn .neighbors import NearestNeighbors
9
+ import warnings
9
10
10
11
__all__ = ['Constraints' ]
11
12
@@ -32,7 +33,7 @@ def __init__(self, partial_labels):
32
33
self .partial_labels = partial_labels
33
34
34
35
def positive_negative_pairs (self , n_constraints , same_length = False ,
35
- random_state = None ):
36
+ random_state = None , num_constraints = 'deprecated' ):
36
37
"""
37
38
Generates positive pairs and negative pairs from labeled data.
38
39
@@ -55,6 +56,8 @@ def positive_negative_pairs(self, n_constraints, same_length=False,
55
56
random_state : int or numpy.RandomState or None, optional (default=None)
56
57
A pseudo random number generator object or a seed for it if int.
57
58
59
+ num_constraints : Renamed to n_constrains. Will be deprecated 0.7.0
60
+
58
61
Returns
59
62
-------
60
63
a : array-like, shape=(n_constraints,)
@@ -69,6 +72,12 @@ def positive_negative_pairs(self, n_constraints, same_length=False,
69
72
d : array-like, shape=(n_constraints,)
70
73
1D array of indicators for the right elements of negative pairs.
71
74
"""
75
+ if self .num_constraints != 'deprecated' :
76
+ warnings .warn ('"num_constraints" parameter has been renamed to '
77
+ '"n_constraints". It has been deprecated in'
78
+ ' version 0.6.3 and will be removed in 0.7.0'
79
+ '' , FutureWarning )
80
+ self .n_constraints = num_constraints
72
81
random_state = check_random_state (random_state )
73
82
a , b = self ._pairs (n_constraints , same_label = True ,
74
83
random_state = random_state )
0 commit comments