ca14cf72e3e4bd3a6136cafad8701ac41f48f09b,yellowbrick/cluster/elbow.py,KElbowVisualizer,__init__,#KElbowVisualizer#Any#Any#Any#Any#Any#,206

Before Change


            k = (2, k+1)

        // Expand k in to the values we will use, capturing exceptions
        try:
            k = tuple(k)
            self.k_values_ = list(range(*k))
        except:
            raise YellowbrickValueError((
                "Specify a range or maximal K value, the value "{}" "
                "is not a valid argument for K.".format(k)
            ))


        // Holds the values of the silhoutte scores
        self.k_scores_ = None

    def fit(self, X, y=None, **kwargs):
        

After Change


        // Convert K into a tuple argument if an integer
        if isinstance(k, int):
            self.k_values_ = list(range(2, k+1))
        elif isinstance(k, tuple) and len(k) == 2 and \
                all(isinstance(x, (int, np.integer)) for x in k):
            self.k_values_ = list(range(*k))
        elif isinstance(k, collections.Iterable) and \
                all(isinstance(x, (int, np.integer)) for x in k):
            self.k_values_ = list(k)
        else:
            raise YellowbrickValueError((
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: DistrictDataLabs/yellowbrick
Commit Name: ca14cf72e3e4bd3a6136cafad8701ac41f48f09b
Time: 2018-08-25
Author: davidwaterman@gmail.com
File Name: yellowbrick/cluster/elbow.py
Class Name: KElbowVisualizer
Method Name: __init__


Project Name: mathics/Mathics
Commit Name: deed936ca0bfa5998af0225fab99c47bd2bc4b6d
Time: 2020-09-06
Author: pablo-escobar@riseup.net
File Name: mathics/builtin/linalg.py
Class Name: Eigenvalues
Method Name: apply


Project Name: tyarkoni/pliers
Commit Name: 8be8a8a2403d10fde3e6e44344cbf021bcef1fa9
Time: 2018-03-05
Author: quinten.mcnamara@gmail.com
File Name: pliers/stimuli/api.py
Class Name: TweetStimFactory
Method Name: validate_keys