1

# inconsistent shapes

Package:
scipy
8546
Exception Class:
ValueError

## Raise code

``````        return A

def _divide_sparse(self, other):
"""
Divide this matrix by a second sparse matrix.
"""
if other.shape != self.shape:
raise ValueError('inconsistent shapes')

r = self._binopt(other, '_eldiv_')

if np.issubdtype(r.dtype, np.inexact):
# Eldiv leaves entries outside the combined sparsity
# pattern empty, so they must be filled manually.
# Everything outside of other's sparsity is NaN, and everything``````
😲  Walkingbet is Android app that pays you real bitcoins for a walking. Withdrawable real money bonus is available now, hurry up! 🚶

## Ways to fix

1

X_train, X_test, d_train, d_test = train_test_split(x, d, test_size=0.33, random_state=20, stratify=dt.iloc[:,-1:])

y_predict_train = np.zeros(d_train.shape, dtype=float)

y_predict_test = np.zeros(d_test.shape, dtype=float)

for i in range(d_test.shape[1]):

regresion = LinearRegression().fit(X_train, d_train[:,i])

y_predict_train[:,i] = regresion.predict(X_train)

y_predict_test[:,i] = regresion.predict(X_test)

def OneCold(y):

encoder = LabelBinarizer()

return encoder.fit_transform(np.argmax(y, axis=1))

accuracy_score(OneCold(y_predict_train), d_train)

May 09, 2022
1

X_train, X_test, d_train, d_test = train_test_split(x, d, test_size=0.33, random_state=20, stratify=dt.iloc[:,-1:])

y_predict_train = np.zeros(d_train.shape, dtype=float)

y_predict_test = np.zeros(d_test.shape, dtype=float)

for i in range(d_test.shape[1]):

regresion = LinearRegression().fit(X_train, d_train[:,i])

y_predict_train[:,i] = regresion.predict(X_train)

y_predict_test[:,i] = regresion.predict(X_test)

def OneCold(y):

encoder = LabelBinarizer()

return encoder.fit_transform(np.argmax(y, axis=1))
accuracy_score(OneCold(y_predict_train), d_train)
May 09, 2022