Reputation: 3271
Given:
predict
function that takes a numpy array of shape [n_samples, n_features] and returns an array of shape [n_samples], which contains 1 if the model said yes
and 0 otherwise. Expected output: for each data point how many models emitted yes.
out = np.zeros((n, m))
for i, m in enumerate(m_models):
out[:, i] = m.predict(X) # Doesn't seem to work
scores = np.mean(out, axis=1)
Upvotes: 0
Views: 73
Reputation: 2427
You trying assign array of shape n
to the column with shape m
. Change your out
declaration on:
out = np.zeros((m, n))
Or assign predictions to the row:
for i, m in enumerate(m_models):
out[i, :] = m.predict(X)
Upvotes: 1