I am trying following code:
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import StandardScaler
scaler=StandardScaler()
from sklearn.linear_model import LogisticRegression
from sklearn import linear_model
model = linear_model.LogisticRegression()
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error, r2_score
X=scaler.fit_transform(X)
X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.2)
model.fit(X_train,y_train)
# Make predictions using the testing set
powerOutput_y_pred = model.predict(X_test)
print (powerOutput_y_pred)
# The coefficients
print('Coefficients: \n', model.coef_)
# The mean squared error
print("Mean squared error: %.2f"
% mean_squared_error(y_test, powerOutput_y_pred))
# Explained variance score: 1 is perfect prediction
print('Variance score: %.2f' % r2_score(y_test, powerOutput_y_pred))
plt.scatter(X_test, y_test, color='black')
plt.plot(X_test, powerOutput_y_pred, color='blue', linewidth=3)
plt.xticks(())
plt.yticks(())
plt.show()
But i am getting the following error for the scatter plot:
ValueError: x and y must be the same size
If i run df.head(), i get following table:
The features X and y are as below:
X=df.values[:,[0,1,2,3,4,5,7]]
y=df.values[:,6]
Running X.shape gives (25,7) and y.shape gives (25, ) as output. So how to fix this shape mismatch?

scatterwithplotthen everything should work as is. If you set a few options correctly (ls,marker, andms), callingplotwill produce a scatter plot.