# Packages used
import numpy
from matplotlib import pyplot as pl
from sklearn.linear_model import LinearRegression
import pandas

dat = pandas.read_csv("dat.csv") #Read data

e = dat["Estimated effort"].values.reshape(-1,1) #Actual effort (minimum cost to be met to avoid overscoping)

i=0
l=[]
for size in dat["Team size"].tolist(): #Setting the resource parameter as the team size put to the coefficient of a reduced experience rating
    personsrequired = size
    time = dat["Actual duration"][i]*365
    l.append(personsrequired * time)
    i=1+1
s=pandas.DataFrame(l).values.reshape(-1,1) #Team size and programmer's capability (resources)

lr = LinearRegression() #Create LinearRegression instance
lr.fit(s, e) #Load the data into the instance
lobf = lr.predict(s) #Create the line of best fit

pl.scatter(s, e) #Graph the data points
pl.plot(s, lobf, color="red") #Plot the line of best fit
pl.show() #Show the graph
