text_plain_output_1.png
from sklearn import datasets, linear_model

from sklearn.metrics import mean_squared_error

import numpy as np

import os

import pandas as pd

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import datasets, linear_model
from sklearn.metrics import mean_squared_error
import os
bmi = pd.read_csv('../input/bmidataset/bmi.csv')

bmi_x = bmi.Weight[:, np.newaxis]

bmi_x_train = bmi_x[:-30]

bmi_x_test = bmi_x[-30:]

bmi_y_train = bmi.Index[:-30]
bmi_y_test = bmi.Index[-30:]

model = linear_model.LinearRegression()

model.fit(bmi_x_train, bmi_y_train)

bmi_y_predicted = model.predict(bmi_x_test)

print('The mean Squared error is ', mean_squared_error(bmi_y_test, bmi_y_predicted))