import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error


df = pd.read_csv("/content/Book1.csv")

X=df.drop('target_column', axis=1)
Y=df['time_to_failure']
X_simple=X.iloc[:,[0]]
X_train, X_test, y_train, y_test = train_test_split(X_simple, y,test_size=0.3, random_state=42)

model = LinearRegression()
model.fit(X_train, y_train)

y_pred = model.predict(X_test)
print(y_pred,"\n\n")

mse = mean_squared_error(y_test, y_pred)
print(f'Mean squared error:',mse)
print("Model score:",model.score(X_test, y_test))
