85aabb5014e22659ac722280607a1f4b44e1fb32,tslearn/shapelets.py,ShapeletModel,fit,#ShapeletModel#Any#Any#,380
Before Change
self.label_binarizer_ = None
self.d_ = d
if y.ndim == 1 or y.shape[1] == 1:
self.label_binarizer_ = LabelBinarizer().fit(y)
y_ = self.label_binarizer_.transform(y)
self.classes_ = self.label_binarizer_.classes_
else:
y_ = y
self.categorical_y_ = True
self.classes_ = numpy.unique(y)
assert y_.shape[1] != 2, ("Binary classification case, " +
"monodimensional y should be passed.")
if y_.ndim == 1 or y_.shape[1] == 1:
n_classes = 2
else:
n_classes = y_.shape[1]
After Change
self.label_to_ind_ = None
self.d_ = d
self.classes_ = [int(lab) for lab in set(y)]
n_labels = len(self.classes_)
self.label_to_ind_ = {int(lab): ind
for ind, lab in enumerate(self.classes_)}
y_ind = numpy.array(
[self.label_to_ind_[lab] for lab in y]
)
y_ = to_categorical(y_ind)
if n_labels == 2:
y_ = y_[:, 1:] // Keep only indicator of max index class
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances Project Name: rtavenar/tslearn
Commit Name: 85aabb5014e22659ac722280607a1f4b44e1fb32
Time: 2020-05-03
Author: romain.tavenard@univ-rennes2.fr
File Name: tslearn/shapelets.py
Class Name: ShapeletModel
Method Name: fit
Project Name: eriklindernoren/PyTorch-GAN
Commit Name: 755483e22a22c7445293ec19fbc4c0487433a5d4
Time: 2018-04-23
Author: eriklindernoren@gmail.com
File Name: implementations/discogan/datasets.py
Class Name: ImageDataset
Method Name: __getitem__
Project Name: eriklindernoren/PyTorch-GAN
Commit Name: 8f420a3b35944dcfa470dee958ef61dee221ce02
Time: 2018-04-23
Author: eriklindernoren@gmail.com
File Name: implementations/dualgan/datasets.py
Class Name: MNISTM
Method Name: __getitem__