71432d1890209628e189edf04d7d623160943718,autokeras/hypermodel/preprocessor.py,TextToNgramVector,transform,#TextToNgramVector#Any#Any#,182

Before Change


    def transform(self, x, fit=False):
        sentence = nest.flatten(x)[0].numpy().decode("utf-8")
        data = self.vectorizer.transform([sentence]).toarray()
        if self.selector:
            data = self.selector.transform(data).astype("float32")
        return data[0]

    def output_types(self):
        return (tf.float32,)

After Change


        tokens = self._word_ngram(token_pattern.findall(x.lower()))

        for feature in tokens:
            if feature in self.vocabulary:
                feature_idx = self.vocabulary[feature]
                tf[feature_idx] += 1
        result = tf * self.k_best_idf_values
        result = normalize([result], norm=self.norm, copy=False)[0]
        return result
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


Project Name: keras-team/autokeras
Commit Name: 71432d1890209628e189edf04d7d623160943718
Time: 2019-12-18
Author: 33369174+Davidsirui@users.noreply.github.com
File Name: autokeras/hypermodel/preprocessor.py
Class Name: TextToNgramVector
Method Name: transform


Project Name: aleju/imgaug
Commit Name: 8eb4cb520a5ccfca9c25e849ccf0e17b1cd0659d
Time: 2018-12-23
Author: alexander.jung@zenuity.com
File Name: imgaug/augmenters/geometric.py
Class Name: PerspectiveTransform
Method Name: _augment_images


Project Name: bambinos/bambi
Commit Name: 55e35f8ffb2289f49b5e189c2c2490a7ca47fb8a
Time: 2020-11-12
Author: tomicapretto@gmail.com
File Name: bambi/models.py
Class Name: Model
Method Name: _add