I'm kinda new in the area of ML. There is something I wonder.. when I use 'random_state=10' the variables remain same and nothing changes also it doesn't effect the accuracy of the model.. everythings fine until now.. but when I don't use it, the variables change and it changes the accuracy of the model, the variables are different now but they're still in the same data frame, I thought the accuracy still would be same.. is that how the things work in ML? or am I missing something? Here is my code.
X =df[["Mileage","Age(yrs)"]]
y=df["Sell Price($)"]
from sklearn.model_selection import train_test_split
X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.2)
from sklearn.linear_model import LinearRegression
clf=LinearRegression()
clf.fit(X_train,y_train)
clf.predict(X_test)
>>>array([ 38014.9266005 , 14240.40458389, 33695.58936258, 29870.44475795])
y_test
>>>3 40000
8 12000
1 34000
4 31500
clf.score(X_test,y_test)
>>>0.97343231831177046