gurudesh/pytracebugs huggingface dataset:
# Buggy code
def fit(self, X, y):
    """Fit Ridge regression model.

    Parameters
    ----------
    X : {array-like, sparse matrix}, shape = [n_samples,n_features]
        Training data

    y : array-like, shape = [n_samples]
        Target values

    Returns
    -------
    self : returns an instance of self.
    """
    self._label_binarizer = LabelBinarizer(pos_label=1, neg_label=-1)
    Y = self._label_binarizer.fit_transform(y)
    if not self._label_binarizer.multilabel_:
        y = column_or_1d(y, warn=True)

    if self.class_weight:
        cw = compute_class_weight(self.class_weight, self.classes_, y)
        # get the class weight corresponding to each sample
        sample_weight = cw[np.searchsorted(self.classes_, y)]
    else:
        sample_weight = None

    super(RidgeClassifier, self).fit(X, Y, sample_weight=sample_weight)
    return self


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def fit(self, X, y):
    """Fit Ridge regression model.

    Parameters
    ----------
    X : {array-like, sparse matrix}, shape = [n_samples,n_features]
        Training data

    y : array-like, shape = [n_samples]
        Target values

    Returns
    -------
    self : returns an instance of self.
    """
    self._label_binarizer = LabelBinarizer(pos_label=1, neg_label=-1)
    Y = self._label_binarizer.fit_transform(y)
    if not self._label_binarizer.y_type_.startswith("multilabel"):
        y = column_or_1d(y, warn=True)

    if self.class_weight:
        cw = compute_class_weight(self.class_weight, self.classes_, y)
        # get the class weight corresponding to each sample
        sample_weight = cw[np.searchsorted(self.classes_, y)]
    else:
        sample_weight = None

    super(RidgeClassifier, self).fit(X, Y, sample_weight=sample_weight)
    return self
# Buggy code
def __init__(
    self,
    alphas=np.array([0.1, 1.0, 10.0]),
    fit_intercept=True,
    normalize=False,
    score_func=None,
    loss_func=None,
    cv=None,
    class_weight=None,
):
    super(RidgeClassifierCV, self).__init__(
        alphas=alphas,
        fit_intercept=fit_intercept,
        normalize=normalize,
        score_func=score_func,
        loss_func=loss_func,
        cv=cv,
    )
    self.class_weight = class_weight


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def __init__(
    self,
    alphas=np.array([0.1, 1.0, 10.0]),
    fit_intercept=True,
    normalize=False,
    scoring=None,
    score_func=None,
    loss_func=None,
    cv=None,
    class_weight=None,
):
    super(RidgeClassifierCV, self).__init__(
        alphas=alphas,
        fit_intercept=fit_intercept,
        normalize=normalize,
        scoring=scoring,
        score_func=score_func,
        loss_func=loss_func,
        cv=cv,
    )
    self.class_weight = class_weight
# Buggy code
def _graph_connected_component(graph, node_id):
    """Find the largest graph connected components the contains one
    given node

    Parameters
    ----------
    graph : array-like, shape: (n_samples, n_samples)
        adjacency matrix of the graph, non-zero weight means an edge
        between the nodes

    node_id : int
        The index of the query node of the graph

    Returns
    -------
    connected_components : array-like, shape: (n_samples,)
        An array of bool value indicates the indexes of the nodes
        belong to the largest connected components of the given query
        node
    """
    connected_components = np.zeros(shape=(graph.shape[0]), dtype=np.bool)
    connected_components[node_id] = True
    n_node = graph.shape[0]
    for i in range(n_node):
        last_num_component = connected_components.sum()
        _, node_to_add = np.where(graph[connected_components] != 0)
        connected_components[node_to_add] = True
        if last_num_component >= connected_components.sum():
            break
    return connected_components


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def _graph_connected_component(graph, node_id):
    """Find the largest graph connected components the contains one
    given node

    Parameters
    ----------
    graph : array-like, shape: (n_samples, n_samples)
        adjacency matrix of the graph, non-zero weight means an edge
        between the nodes

    node_id : int
        The index of the query node of the graph

    Returns
    -------
    connected_components_matrix : array-like, shape: (n_samples,)
        An array of bool value indicates the indexes of the nodes
        belong to the largest connected components of the given query
        node
    """
    connected_components_matrix = np.zeros(shape=(graph.shape[0]), dtype=np.bool)
    connected_components_matrix[node_id] = True
    n_node = graph.shape[0]
    for i in range(n_node):
        last_num_component = connected_components_matrix.sum()
        _, node_to_add = np.where(graph[connected_components_matrix] != 0)
        connected_components_matrix[node_to_add] = True
        if last_num_component >= connected_components_matrix.sum():
            break
    return connected_components_matrix
# Buggy code
def _binary_roc_auc_score(y_true, y_score, sample_weight=None):
    if len(np.unique(y_true)) != 2:
        raise ValueError("ROC AUC score is not defined")

    fpr, tpr, tresholds = roc_curve(y_true, y_score, sample_weight=sample_weight)
    return auc(fpr, tpr, reorder=True)


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def _binary_roc_auc_score(y_true, y_score, sample_weight=None):
    if len(np.unique(y_true)) != 2:
        raise ValueError(
            "Only one class present in y_true. ROC AUC score "
            "is not defined in that case."
        )

    fpr, tpr, tresholds = roc_curve(y_true, y_score, sample_weight=sample_weight)
    return auc(fpr, tpr, reorder=True)
# Buggy code
def __init__(self, neg_label=0, pos_label=1):
    if neg_label >= pos_label:
        raise ValueError("neg_label must be strictly less than pos_label.")

    self.neg_label = neg_label
    self.pos_label = pos_label


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def __init__(self, neg_label=0, pos_label=1, sparse_output=False):
    if neg_label >= pos_label:
        raise ValueError(
            "neg_label={0} must be strictly less than pos_label={1}.".format(
                neg_label, pos_label
            )
        )

    if sparse_output and (pos_label == 0 or neg_label != 0):
        raise ValueError(
            "Sparse binarization is only supported with non "
            "zero pos_label and zero neg_label, got "
            "pos_label={0} and neg_label={1}"
            "".format(pos_label, neg_label)
        )

    self.neg_label = neg_label
    self.pos_label = pos_label
    self.sparse_output = sparse_output
# Buggy code
def fit(self, y):
    """Fit label binarizer

    Parameters
    ----------
    y : numpy array of shape (n_samples,) or (n_samples, n_classes)
        Target values. The 2-d matrix should only contain 0 and 1,
        represents multilabel classification.

    Returns
    -------
    self : returns an instance of self.
    """
    y_type = type_of_target(y)
    self.multilabel_ = y_type.startswith("multilabel")
    if self.multilabel_:
        self.indicator_matrix_ = y_type == "multilabel-indicator"

    self.classes_ = unique_labels(y)

    return self


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def fit(self, y):
    """Fit label binarizer

    Parameters
    ----------
    y : numpy array of shape (n_samples,) or (n_samples, n_classes)
        Target values. The 2-d matrix should only contain 0 and 1,
        represents multilabel classification.

    Returns
    -------
    self : returns an instance of self.
    """
    self.y_type_ = type_of_target(y)
    self.sparse_input_ = sp.issparse(y)
    self.classes_ = unique_labels(y)
    return self
# Buggy code
def transform(self, y):
    """Transform multi-class labels to binary labels

    The output of transform is sometimes referred to by some authors as the
    1-of-K coding scheme.

    Parameters
    ----------
    y : numpy array of shape (n_samples,) or (n_samples, n_classes)
        Target values. The 2-d matrix should only contain 0 and 1,
        represents multilabel classification.

    Returns
    -------
    Y : numpy array of shape [n_samples, n_classes]
    """
    self._check_fitted()

    y_is_multilabel = type_of_target(y).startswith("multilabel")

    if y_is_multilabel and not self.multilabel_:
        raise ValueError("The object was not fitted with multilabel input.")

    return label_binarize(
        y,
        self.classes_,
        multilabel=self.multilabel_,
        pos_label=self.pos_label,
        neg_label=self.neg_label,
    )


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def transform(self, y):
    """Transform multi-class labels to binary labels

    The output of transform is sometimes referred to by some authors as the
    1-of-K coding scheme.

    Parameters
    ----------
    y : numpy array or sparse matrix of shape (n_samples,) or
        (n_samples, n_classes) Target values. The 2-d matrix should only
        contain 0 and 1, represents multilabel classification. Sparse
        matrix can be CSR, CSC, COO, DOK, or LIL.

    Returns
    -------
    Y : numpy array or CSR matrix of shape [n_samples, n_classes]
        Shape will be [n_samples, 1] for binary problems.
    """
    self._check_fitted()
    return label_binarize(
        y,
        self.classes_,
        pos_label=self.pos_label,
        neg_label=self.neg_label,
        sparse_output=self.sparse_output,
    )
# Buggy code
def __init__(self, classes=None):
    self.classes = classes


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def __init__(self, classes=None, sparse_output=False):
    self.classes = classes
    self.sparse_output = sparse_output
# Buggy code
def fit(self, y):
    """Fit the label sets binarizer, storing classes_

    Parameters
    ----------
    y : iterable of iterables
        A set of labels (any orderable and hashable object) for each
        sample. If the `classes` parameter is set, `y` will not be
        iterated.

    Returns
    -------
    self : returns this MultiLabelBinarizer instance
    """
    if self.classes is None:
        classes = sorted(set(itertools.chain.from_iterable(y)))
    else:
        classes = self.classes
    dtype = np.int if all(isinstance(c, int) for c in classes) else object
    self.classes_ = np.empty(len(classes), dtype=dtype)
    self.classes_[:] = classes
    return self


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def fit(self, y):
    """Fit the label sets binarizer, storing `classes_`

    Parameters
    ----------
    y : iterable of iterables
        A set of labels (any orderable and hashable object) for each
        sample. If the `classes` parameter is set, `y` will not be
        iterated.

    Returns
    -------
    self : returns this MultiLabelBinarizer instance
    """
    if self.classes is None:
        classes = sorted(set(itertools.chain.from_iterable(y)))
    else:
        classes = self.classes
    dtype = np.int if all(isinstance(c, int) for c in classes) else object
    self.classes_ = np.empty(len(classes), dtype=dtype)
    self.classes_[:] = classes
    return self
# Buggy code
def transform(self, y):
    """Transform the given label sets

    Parameters
    ----------
    y : iterable of iterables
        A set of labels (any orderable and hashable object) for each
        sample. If the `classes` parameter is set, `y` will not be
        iterated.

    Returns
    -------
    y_indicator : array, shape (n_samples, n_classes)
        A matrix such that `y_indicator[i, j] = 1` iff `classes_[j]` is in
        `y[i]`, and 0 otherwise.
    """
    class_to_index = dict(zip(self.classes_, range(len(self.classes_))))
    yt = self._transform(y, class_to_index)
    return yt.toarray()


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def transform(self, y):
    """Transform the given label sets

    Parameters
    ----------
    y : iterable of iterables
        A set of labels (any orderable and hashable object) for each
        sample. If the `classes` parameter is set, `y` will not be
        iterated.

    Returns
    -------
    y_indicator : array or CSR matrix, shape (n_samples, n_classes)
        A matrix such that `y_indicator[i, j] = 1` iff `classes_[j]` is in
        `y[i]`, and 0 otherwise.
    """
    class_to_index = dict(zip(self.classes_, range(len(self.classes_))))
    yt = self._transform(y, class_to_index)

    if not self.sparse_output:
        yt = yt.toarray()

    return yt
# Buggy code
def inverse_transform(self, yt):
    """Transform the given indicator matrix into label sets

    Parameters
    ----------
    yt : array of shape (n_samples, n_classes)
        A matrix containing only 1s ands 0s.

    Returns
    -------
    y : list of tuples
        The set of labels for each sample such that `y[i]` consists of
        `classes_[j]` for each `yt[i, j] == 1`.
    """
    yt = np.asarray(yt)
    if yt.shape[1] != len(self.classes_):
        raise ValueError(
            "Expected indicator for {0} classes, but got {1}".format(
                len(self.classes_), yt.shape[1]
            )
        )
    unexpected = np.setdiff1d(yt, [0, 1])
    if len(unexpected) > 0:
        raise ValueError(
            "Expected only 0s and 1s in label indicator. Also got {0}".format(
                unexpected
            )
        )

    return [tuple(self.classes_.compress(indicators)) for indicators in yt]


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def inverse_transform(self, yt):
    """Transform the given indicator matrix into label sets

    Parameters
    ----------
    yt : array or sparse matrix of shape (n_samples, n_classes)
        A matrix containing only 1s ands 0s.

    Returns
    -------
    y : list of tuples
        The set of labels for each sample such that `y[i]` consists of
        `classes_[j]` for each `yt[i, j] == 1`.
    """
    if yt.shape[1] != len(self.classes_):
        raise ValueError(
            "Expected indicator for {0} classes, but got {1}".format(
                len(self.classes_), yt.shape[1]
            )
        )

    if sp.issparse(yt):
        yt = yt.tocsr()
        if len(yt.data) != 0 and len(np.setdiff1d(yt.data, [0, 1])) > 0:
            raise ValueError("Expected only 0s and 1s in label indicator.")
        return [
            tuple(self.classes_.take(yt.indices[start:end]))
            for start, end in zip(yt.indptr[:-1], yt.indptr[1:])
        ]
    else:
        unexpected = np.setdiff1d(yt, [0, 1])
        if len(unexpected) > 0:
            raise ValueError(
                "Expected only 0s and 1s in label indicator. Also got {0}".format(
                    unexpected
                )
            )
        return [tuple(self.classes_.compress(indicators)) for indicators in yt]
# Buggy code
def is_sequence_of_sequences(y):
    """Check if ``y`` is in the sequence of sequences format (multilabel).

    This format is DEPRECATED.

    Parameters
    ----------
    y : sequence or array.

    Returns
    -------
    out : bool,
        Return ``True``, if ``y`` is a sequence of sequences else ``False``.
    """
    # the explicit check for ndarray is for forward compatibility; future
    # versions of Numpy might want to register ndarray as a Sequence
    try:
        out = (
            not isinstance(y[0], np.ndarray)
            and isinstance(y[0], Sequence)
            and not isinstance(y[0], string_types)
        )
    except IndexError:
        return False
    if out:
        warnings.warn(
            "Direct support for sequence of sequences multilabel "
            "representation will be unavailable from version 0.17. "
            "Use sklearn.preprocessing.MultiLabelBinarizer to "
            "convert to a label indicator representation.",
            DeprecationWarning,
        )
    return out


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def is_sequence_of_sequences(y):
    """Check if ``y`` is in the sequence of sequences format (multilabel).

    This format is DEPRECATED.

    Parameters
    ----------
    y : sequence or array.

    Returns
    -------
    out : bool,
        Return ``True``, if ``y`` is a sequence of sequences else ``False``.
    """
    # the explicit check for ndarray is for forward compatibility; future
    # versions of Numpy might want to register ndarray as a Sequence
    try:
        out = (
            not isinstance(y[0], np.ndarray)
            and isinstance(y[0], Sequence)
            and not isinstance(y[0], string_types)
        )
    except (IndexError, TypeError):
        return False
    if out:
        warnings.warn(
            "Direct support for sequence of sequences multilabel "
            "representation will be unavailable from version 0.17. "
            "Use sklearn.preprocessing.MultiLabelBinarizer to "
            "convert to a label indicator representation.",
            DeprecationWarning,
        )
    return out
# Buggy code
def download_20newsgroups(target_dir, cache_path):
    """Download the 20 newsgroups data and stored it as a zipped pickle."""
    archive_path = os.path.join(target_dir, ARCHIVE_NAME)
    train_path = os.path.join(target_dir, TRAIN_FOLDER)
    test_path = os.path.join(target_dir, TEST_FOLDER)

    if not os.path.exists(target_dir):
        os.makedirs(target_dir)

    if not os.path.exists(archive_path):
        logger.warn("Downloading dataset from %s (14 MB)", URL)
        opener = urlopen(URL)
        open(archive_path, "wb").write(opener.read())

    logger.info("Decompressing %s", archive_path)
    tarfile.open(archive_path, "r:gz").extractall(path=target_dir)
    os.remove(archive_path)

    # Store a zipped pickle
    cache = dict(
        train=load_files(train_path, encoding="latin1"),
        test=load_files(test_path, encoding="latin1"),
    )
    open(cache_path, "wb").write(pickle.dumps(cache).encode("zip"))
    shutil.rmtree(target_dir)
    return cache


# Traceback (AttributeError)
Downloading dataset from http://people.csail.mit.edu/jrennie/20Newsgroups/20news-bydate.tar.gz (14 MB)
Traceback (most recent call last):
File "/Users/hop/VirtualEnvs/data_vis/lib/python3.3/site-packages/IPython/core/interactiveshell.py", line 2828, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-42-bf8e77d5e59e>", line 1, in <module>
news = fetch_20newsgroups(subset='all')
File "/Users/hop/VirtualEnvs/data_vis/lib/python3.3/site-packages/sklearn/datasets/twenty_newsgroups.py", line 207, in fetch_20newsgroups
cache_path=cache_path)
File "/Users/hop/VirtualEnvs/data_vis/lib/python3.3/site-packages/sklearn/datasets/twenty_newsgroups.py", line 95, in download_20newsgroups
open(cache_path, 'wb').write(pickle.dumps(cache).encode('zip'))
AttributeError: 'bytes' object has no attribute 'encode'

# Fixed code
def download_20newsgroups(target_dir, cache_path):
    """Download the 20 newsgroups data and stored it as a zipped pickle."""
    archive_path = os.path.join(target_dir, ARCHIVE_NAME)
    train_path = os.path.join(target_dir, TRAIN_FOLDER)
    test_path = os.path.join(target_dir, TEST_FOLDER)

    if not os.path.exists(target_dir):
        os.makedirs(target_dir)

    if not os.path.exists(archive_path):
        logger.warn("Downloading dataset from %s (14 MB)", URL)
        opener = urlopen(URL)
        open(archive_path, "wb").write(opener.read())

    logger.info("Decompressing %s", archive_path)
    tarfile.open(archive_path, "r:gz").extractall(path=target_dir)
    os.remove(archive_path)

    # Store a zipped pickle
    cache = dict(
        train=load_files(train_path, encoding="latin1"),
        test=load_files(test_path, encoding="latin1"),
    )
    compressed_content = codecs.encode(pickle.dumps(cache), "zlib_codec")
    open(cache_path, "wb").write(compressed_content)

    shutil.rmtree(target_dir)
    return cache
# Buggy code
def emission_coeff(self, seasonal_indicators: Tensor):
    raise NotImplementedError


# Traceback (mxnet.base.MXNetError)
Traceback (most recent call last):
File "D:/python/DeepSSM/deep ISSM.py", line 53, in <module>
predictor = estimator.train(dataset.train)
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 254, in train
training_data, validation_data, num_workers, num_prefetch, **kwargs
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 233, in train_model
validation_iter=validation_data_loader,
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 308, in __call__
epoch_loss = loop(epoch_no, train_iter)
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 242, in loop
output = net(*inputs)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 540, in __call__
out = self.forward(*args)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 917, in forward
return self.hybrid_forward(ndarray, x, *args, **params)
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 193, in hybrid_forward
length=self.past_length,
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 151, in compute_lds
) = self.issm.get_issm_coeff(seasonal_indicators)
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 132, in get_issm_coeff
self.innovation_coeff(seasonal_indicators),
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 247, in innovation_coeff
axis=2
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\ndarray\ndarray.py", line 1695, in squeeze
return op.squeeze(self, *args, **kwargs)
File "<string>", line 45, in squeeze
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\_ctypes\ndarray.py", line 92, in _imperative_invoke
ctypes.byref(out_stypes)))
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\base.py", line 252, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [13:47:56] c:\jenkins\workspace\mxnet-tag\mxnet\src\operator\tensor\./matrix_op-inl.h:2178: Check failed: dshape[axes[i]] == 1 (2 vs. 1) cannot select an axis to squeeze out which has size=2 not equal to one

# Fixed code
def emission_coeff(self, features: Tensor) -> Tensor:
    raise NotImplementedError
# Buggy code
def transition_coeff(self, seasonal_indicators: Tensor):
    raise NotImplementedError


# Traceback (mxnet.base.MXNetError)
Traceback (most recent call last):
File "D:/python/DeepSSM/deep ISSM.py", line 53, in <module>
predictor = estimator.train(dataset.train)
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 254, in train
training_data, validation_data, num_workers, num_prefetch, **kwargs
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 233, in train_model
validation_iter=validation_data_loader,
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 308, in __call__
epoch_loss = loop(epoch_no, train_iter)
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 242, in loop
output = net(*inputs)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 540, in __call__
out = self.forward(*args)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 917, in forward
return self.hybrid_forward(ndarray, x, *args, **params)
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 193, in hybrid_forward
length=self.past_length,
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 151, in compute_lds
) = self.issm.get_issm_coeff(seasonal_indicators)
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 132, in get_issm_coeff
self.innovation_coeff(seasonal_indicators),
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 247, in innovation_coeff
axis=2
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\ndarray\ndarray.py", line 1695, in squeeze
return op.squeeze(self, *args, **kwargs)
File "<string>", line 45, in squeeze
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\_ctypes\ndarray.py", line 92, in _imperative_invoke
ctypes.byref(out_stypes)))
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\base.py", line 252, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [13:47:56] c:\jenkins\workspace\mxnet-tag\mxnet\src\operator\tensor\./matrix_op-inl.h:2178: Check failed: dshape[axes[i]] == 1 (2 vs. 1) cannot select an axis to squeeze out which has size=2 not equal to one

# Fixed code
def transition_coeff(self, features: Tensor) -> Tensor:
    raise NotImplementedError
# Buggy code
def innovation_coeff(self, seasonal_indicators: Tensor):
    raise NotImplementedError


# Traceback (mxnet.base.MXNetError)
Traceback (most recent call last):
File "D:/python/DeepSSM/deep ISSM.py", line 53, in <module>
predictor = estimator.train(dataset.train)
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 254, in train
training_data, validation_data, num_workers, num_prefetch, **kwargs
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 233, in train_model
validation_iter=validation_data_loader,
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 308, in __call__
epoch_loss = loop(epoch_no, train_iter)
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 242, in loop
output = net(*inputs)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 540, in __call__
out = self.forward(*args)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 917, in forward
return self.hybrid_forward(ndarray, x, *args, **params)
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 193, in hybrid_forward
length=self.past_length,
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 151, in compute_lds
) = self.issm.get_issm_coeff(seasonal_indicators)
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 132, in get_issm_coeff
self.innovation_coeff(seasonal_indicators),
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 247, in innovation_coeff
axis=2
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\ndarray\ndarray.py", line 1695, in squeeze
return op.squeeze(self, *args, **kwargs)
File "<string>", line 45, in squeeze
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\_ctypes\ndarray.py", line 92, in _imperative_invoke
ctypes.byref(out_stypes)))
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\base.py", line 252, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [13:47:56] c:\jenkins\workspace\mxnet-tag\mxnet\src\operator\tensor\./matrix_op-inl.h:2178: Check failed: dshape[axes[i]] == 1 (2 vs. 1) cannot select an axis to squeeze out which has size=2 not equal to one

# Fixed code
def innovation_coeff(self, features: Tensor) -> Tensor:
    raise NotImplementedError
# Buggy code
def get_issm_coeff(self, seasonal_indicators: Tensor) -> Tuple[Tensor, Tensor, Tensor]:
    return (
        self.emission_coeff(seasonal_indicators),
        self.transition_coeff(seasonal_indicators),
        self.innovation_coeff(seasonal_indicators),
    )


# Traceback (mxnet.base.MXNetError)
Traceback (most recent call last):
File "D:/python/DeepSSM/deep ISSM.py", line 53, in <module>
predictor = estimator.train(dataset.train)
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 254, in train
training_data, validation_data, num_workers, num_prefetch, **kwargs
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 233, in train_model
validation_iter=validation_data_loader,
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 308, in __call__
epoch_loss = loop(epoch_no, train_iter)
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 242, in loop
output = net(*inputs)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 540, in __call__
out = self.forward(*args)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 917, in forward
return self.hybrid_forward(ndarray, x, *args, **params)
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 193, in hybrid_forward
length=self.past_length,
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 151, in compute_lds
) = self.issm.get_issm_coeff(seasonal_indicators)
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 132, in get_issm_coeff
self.innovation_coeff(seasonal_indicators),
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 247, in innovation_coeff
axis=2
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\ndarray\ndarray.py", line 1695, in squeeze
return op.squeeze(self, *args, **kwargs)
File "<string>", line 45, in squeeze
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\_ctypes\ndarray.py", line 92, in _imperative_invoke
ctypes.byref(out_stypes)))
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\base.py", line 252, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [13:47:56] c:\jenkins\workspace\mxnet-tag\mxnet\src\operator\tensor\./matrix_op-inl.h:2178: Check failed: dshape[axes[i]] == 1 (2 vs. 1) cannot select an axis to squeeze out which has size=2 not equal to one

# Fixed code
def get_issm_coeff(self, features: Tensor) -> Tuple[Tensor, Tensor, Tensor]:
    return (
        self.emission_coeff(features),
        self.transition_coeff(features),
        self.innovation_coeff(features),
    )
# Buggy code
def emission_coeff(
    self,
    seasonal_indicators: Tensor,  # (batch_size, time_length)
) -> Tensor:
    F = getF(seasonal_indicators)

    _emission_coeff = F.ones(shape=(1, 1, 1, self.latent_dim()))

    # get the right shape: (batch_size, seq_length, obs_dim, latent_dim)
    zeros = _broadcast_param(
        F.zeros_like(
            seasonal_indicators.slice_axis(axis=-1, begin=0, end=1).squeeze(axis=-1)
        ),
        axes=[2, 3],
        sizes=[1, self.latent_dim()],
    )

    return _emission_coeff.broadcast_like(zeros)


# Traceback (mxnet.base.MXNetError)
Traceback (most recent call last):
File "D:/python/DeepSSM/deep ISSM.py", line 53, in <module>
predictor = estimator.train(dataset.train)
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 254, in train
training_data, validation_data, num_workers, num_prefetch, **kwargs
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 233, in train_model
validation_iter=validation_data_loader,
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 308, in __call__
epoch_loss = loop(epoch_no, train_iter)
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 242, in loop
output = net(*inputs)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 540, in __call__
out = self.forward(*args)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 917, in forward
return self.hybrid_forward(ndarray, x, *args, **params)
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 193, in hybrid_forward
length=self.past_length,
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 151, in compute_lds
) = self.issm.get_issm_coeff(seasonal_indicators)
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 132, in get_issm_coeff
self.innovation_coeff(seasonal_indicators),
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 247, in innovation_coeff
axis=2
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\ndarray\ndarray.py", line 1695, in squeeze
return op.squeeze(self, *args, **kwargs)
File "<string>", line 45, in squeeze
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\_ctypes\ndarray.py", line 92, in _imperative_invoke
ctypes.byref(out_stypes)))
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\base.py", line 252, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [13:47:56] c:\jenkins\workspace\mxnet-tag\mxnet\src\operator\tensor\./matrix_op-inl.h:2178: Check failed: dshape[axes[i]] == 1 (2 vs. 1) cannot select an axis to squeeze out which has size=2 not equal to one

# Fixed code
def emission_coeff(
    self,
    feature: Tensor,  # (batch_size, time_length, 1)
) -> Tensor:
    F = getF(feature)

    _emission_coeff = F.ones(shape=(1, 1, 1, self.latent_dim()))

    # get the right shape: (batch_size, time_length, obs_dim, latent_dim)
    zeros = _broadcast_param(
        feature.squeeze(axis=2),
        axes=[2, 3],
        sizes=[1, self.latent_dim()],
    )

    return _emission_coeff.broadcast_like(zeros)
# Buggy code
def transition_coeff(
    self,
    seasonal_indicators: Tensor,  # (batch_size, time_length)
) -> Tensor:
    F = getF(seasonal_indicators)

    _transition_coeff = F.eye(self.latent_dim()).expand_dims(axis=0).expand_dims(axis=0)

    # get the right shape: (batch_size, seq_length, latent_dim, latent_dim)
    zeros = _broadcast_param(
        F.zeros_like(
            seasonal_indicators.slice_axis(axis=-1, begin=0, end=1).squeeze(axis=-1)
        ),
        axes=[2, 3],
        sizes=[self.latent_dim(), self.latent_dim()],
    )

    return _transition_coeff.broadcast_like(zeros)


# Traceback (mxnet.base.MXNetError)
Traceback (most recent call last):
File "D:/python/DeepSSM/deep ISSM.py", line 53, in <module>
predictor = estimator.train(dataset.train)
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 254, in train
training_data, validation_data, num_workers, num_prefetch, **kwargs
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 233, in train_model
validation_iter=validation_data_loader,
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 308, in __call__
epoch_loss = loop(epoch_no, train_iter)
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 242, in loop
output = net(*inputs)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 540, in __call__
out = self.forward(*args)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 917, in forward
return self.hybrid_forward(ndarray, x, *args, **params)
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 193, in hybrid_forward
length=self.past_length,
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 151, in compute_lds
) = self.issm.get_issm_coeff(seasonal_indicators)
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 132, in get_issm_coeff
self.innovation_coeff(seasonal_indicators),
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 247, in innovation_coeff
axis=2
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\ndarray\ndarray.py", line 1695, in squeeze
return op.squeeze(self, *args, **kwargs)
File "<string>", line 45, in squeeze
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\_ctypes\ndarray.py", line 92, in _imperative_invoke
ctypes.byref(out_stypes)))
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\base.py", line 252, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [13:47:56] c:\jenkins\workspace\mxnet-tag\mxnet\src\operator\tensor\./matrix_op-inl.h:2178: Check failed: dshape[axes[i]] == 1 (2 vs. 1) cannot select an axis to squeeze out which has size=2 not equal to one

# Fixed code
def transition_coeff(
    self,
    feature: Tensor,  # (batch_size, time_length, 1)
) -> Tensor:
    F = getF(feature)

    _transition_coeff = F.eye(self.latent_dim()).expand_dims(axis=0).expand_dims(axis=0)

    # get the right shape: (batch_size, time_length, latent_dim, latent_dim)
    zeros = _broadcast_param(
        feature.squeeze(axis=2),
        axes=[2, 3],
        sizes=[self.latent_dim(), self.latent_dim()],
    )

    return _transition_coeff.broadcast_like(zeros)
# Buggy code
def innovation_coeff(
    self,
    seasonal_indicators: Tensor,  # (batch_size, time_length)
) -> Tensor:
    return self.emission_coeff(seasonal_indicators).squeeze(axis=2)


# Traceback (mxnet.base.MXNetError)
Traceback (most recent call last):
File "D:/python/DeepSSM/deep ISSM.py", line 53, in <module>
predictor = estimator.train(dataset.train)
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 254, in train
training_data, validation_data, num_workers, num_prefetch, **kwargs
File "D:\python\DeepSSM\gluonts\model\estimator.py", line 233, in train_model
validation_iter=validation_data_loader,
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 308, in __call__
epoch_loss = loop(epoch_no, train_iter)
File "D:\python\DeepSSM\gluonts\trainer\_base.py", line 242, in loop
output = net(*inputs)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 540, in __call__
out = self.forward(*args)
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\gluon\block.py", line 917, in forward
return self.hybrid_forward(ndarray, x, *args, **params)
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 193, in hybrid_forward
length=self.past_length,
File "D:\python\DeepSSM\gluonts\model\deepstate\_network.py", line 151, in compute_lds
) = self.issm.get_issm_coeff(seasonal_indicators)
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 132, in get_issm_coeff
self.innovation_coeff(seasonal_indicators),
File "D:\python\DeepSSM\gluonts\model\deepstate\issm.py", line 247, in innovation_coeff
axis=2
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\ndarray\ndarray.py", line 1695, in squeeze
return op.squeeze(self, *args, **kwargs)
File "<string>", line 45, in squeeze
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\_ctypes\ndarray.py", line 92, in _imperative_invoke
ctypes.byref(out_stypes)))
File "C:\Anaconda\envs\time_series\lib\site-packages\mxnet\base.py", line 252, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [13:47:56] c:\jenkins\workspace\mxnet-tag\mxnet\src\operator\tensor\./matrix_op-inl.h:2178: Check failed: dshape[axes[i]] == 1 (2 vs. 1) cannot select an axis to squeeze out which has size=2 not equal to one

# Fixed code
def innovation_coeff(
    self,
    feature: Tensor,  # (batch_size, time_length, 1)
) -> Tensor:
    return self.emission_coeff(feature).squeeze(axis=2)