<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Setting things up
Let's load the data and give it a quick look.
Step1:  Checking out correlations
Let's start looking at how variables in our dataset relate to each other so we know what to expect when we start modeling.
Step2:  The percentage of students enrolled in free/reduced-price lunch programs is often used as a proxy for poverty.
Step3:  Conversely, the education level of a student's parents is often a good predictor of how well a student will do in school.
Step4:  Running the regression
Like we did last week, we'll use scikit-learn to run basic single-variable regressions. Let's start by looking at California's Academic Performance index as it relates to the percentage of students, per school, enrolled in free/reduced-price lunch programs.
Step5:  In our naive universe where we're only paying attention to two variables -- academic performance and free/reduced lunch -- we can clearly see that some percentage of schools is overperforming the performance that would be expected of them, taking poverty out of the equation.
A handful, in particular, seem to be dramatically overperforming. Let's look at them
Step6:  Let's look specifically at Solano Avenue Elementary, which has an API of 922 and 80 percent of students being in the free/reduced lunch program. If you were to use the above regression to predict how well Solano would do, it would look like this
<ASSISTANT_TASK:>
Python Code:
df = pd.read_csv('data/apib12tx.csv')
df.describe()
Explanation: Setting things up
Let's load the data and give it a quick look.
End of explanation
df.corr()
Explanation: Checking out correlations
Let's start looking at how variables in our dataset relate to each other so we know what to expect when we start modeling.
End of explanation
df.plot(kind="scatter", x="MEALS", y="API12B")
Explanation: The percentage of students enrolled in free/reduced-price lunch programs is often used as a proxy for poverty.
End of explanation
df.plot(kind="scatter", x="AVG_ED", y="API12B")
Explanation: Conversely, the education level of a student's parents is often a good predictor of how well a student will do in school.
End of explanation
data = np.asarray(df[['API12B','MEALS']])
x, y = data[:, 1:], data[:, 0]
lr = LinearRegression() 
lr.fit(x, y)
# plot the linear regression line on the scatter plot
lr.coef_
lr.score(x, y)
plt.scatter(x, y, color='blue')
plt.plot(x, lr.predict(x), color='red', linewidth=1)
Explanation: Running the regression
Like we did last week, we'll use scikit-learn to run basic single-variable regressions. Let's start by looking at California's Academic Performance index as it relates to the percentage of students, per school, enrolled in free/reduced-price lunch programs.
End of explanation
df[(df['MEALS'] >= 80) & (df['API12B'] >= 900)]
Explanation: In our naive universe where we're only paying attention to two variables -- academic performance and free/reduced lunch -- we can clearly see that some percentage of schools is overperforming the performance that would be expected of them, taking poverty out of the equation.
A handful, in particular, seem to be dramatically overperforming. Let's look at them:
End of explanation
lr.predict(80)
Explanation: Let's look specifically at Solano Avenue Elementary, which has an API of 922 and 80 percent of students being in the free/reduced lunch program. If you were to use the above regression to predict how well Solano would do, it would look like this:
End of explanation
<END_TASK>