Я получаю код ошибки: объект numpy .ndarray не имеет атрибута 'append' из приведенного ниже кода.
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax = plt.subplot(111)
#colors = ['blue', 'green', 'red', 'cyan', 'magenta', 'yellow', 'black', 'pink', 'lightgreen', 'lightblue', 'gray', 'indigo', 'orange']
colors = ['blue', 'green', 'red', 'cyan', 'magenta', 'yellow']
weights, params = [], []
for c in np.arange(-4, 6, 1):
lr = LogisticRegression(penalty='l2', C=1.0, solver='lbfgs', multi_class='auto', random_state=0)
lr.fit(X_train, y_train)
weights.append(lr.coef_[1])
params.append(1*c)
weights = np.array(weights)
for column, color in zip(range(weights.shape[1]), colors):plt.plot(params, weights[:, column], label=df.columns[column + 1], color=color)
plt.axhline(0, color='black', linestyle='--', linewidth=3)
plt.xlim([xx1.min, xx1.max])
plt.ylabel('weight coefficient')
plt.xlabel('C')
plt.xscale('log')
plt.legend(loc='upper left')
ax.legend(loc='upper center', bbox_to_anchor=(1.38, 1.03), ncol=1, fancybox=True)
plt.show()
Вся помощь приветствуется.