[54일차] 04. 결정 트리 ( Decision Trees)
plt.figure(figsize=(12,8)) plt.semilogy(data_train.date, data_train.price, color='indigo', linestyle='-', label="Training data") plt.semilogy(data_test.date, data_test.price, color='red', linestyle='--', label="Test data") plt.semilogy(ram_prices.date, price_tree, color='brown', linestyle='-.', label="Tree Prediction") plt.semilogy(ram_prices.date, price_lr, color='green', linestyle=':', label="..
2022. 9. 6.
[54일차] 03. 라소(Lasso)
for C, marker in zip([0.001, 1, 100], ['o', '^', 'v']): lr_l1 = LogisticRegression(C=C, penalty="l1", solver='liblinear').fit(X_train, y_train) print("Training accuracy of l1 logreg with C={:.3f}: {:.2f}".format(C, lr_l1.score(X_train, y_train))) print("Test accuracy of l1 logreg with C={:.3f}: {:.2f}".format(C, lr_l1.score(X_test, y_test))) plt.plot(lr_l1.coef_.T, marker, label="C={:.3f}".forma..
2022. 9. 6.