How to correct the graph - urgent

Tron Orino Yeong

Junior Member
Apr 20, 2018
4
0
11
May I know how to correct my graph as refer to attached image file -



Code:
from sklearn import datasets
#load data
iris=datasets.load_iris()
X=iris.data[:,[2,3]]
y=iris.target
from sklearn.model_selection import train_test_split
X_train, X_test,y_train, y_test=train_test_split(X,y,test_size=0.3, random_state=0,stratify=y)
#feature scaling
from sklearn.preprocessing import StandardScaler
sc=StandardScaler()
sc.fit(X_train)
X_train_std=sc.transform(X_train)
X_test_std=sc.transform(X_test)
#Logistic regression
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
C1=[]
A=[]
C1=[0.001,0.01,0.1,1,10,100,1000]
for i in range(len(C1)):
    lr=LogisticRegression(C=C1[i], random_state=0)
    lr.fit(X_train_std,y_train)
    y_pred=lr.predict(X_test_std)
    A.append(accuracy_score(y_test,y_pred))

#draw figure
import matplotlib.pyplot as plt
plt.plot(C1,A)
plt.gca().set_xscale('log')
plt.title('Logistic Regression')
plt.xlabel('C')
plt.ylabel('Accuracy')
plt.show()



Logistic Regression.jpg





Please tell me how to modify the coding so that get the same picture as refer to the attached image file