<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 The belowing code in azure can't work, because 403 error
boston = load_boston()
california = fetch_california_housing()
In local machine å¦èµ·çç¤ï¼ä¸è½½boston,californiaå­æcsvï¼ç¶åä¼ å
¥azure
dataset = pd.DataFrame(boston.data, columns=boston.feature_names)
dataset['target'] = boston.target
dataset.to_csv('boston.csv')
Step1:  ä»¥ä¸ä»£ç æ¯å®ç°æ­£æåå¸
Step2:  åå¼çä¸¤ç§è®¡ç®æ¹æ³
SSE ----è¯¯å·®å¹³æ¹å/åæ¹å·®
ç´æ¹å¾çåæ³ï¼ç¬¬ä¸æ è¡¨ç¤ºåæ¹å·®å¨0-100ä»¥å
çæå¤§çº¦350ç»
Step3:  æ åå
æ ååè¿å,åå¼ä¸º0,æ¹å·®ä¸º1
Step4:  è¿ä¸ªå½æ°è®¡ç®å
±åæ§
Step5:  è¿ä¸ªå½æ°è®¡ç®ç¸å
³æ§,åºå«å°±æ¯è¾å
¥ç»è¿æ åå
Step6:  Let's graph what happens when we correlate two variables. Using a scatterplot, we can easily visualize the two involved variables. A scatterplot is a graph where the values of two variables are treated as Cartesian coordinates; thus, for every (x, y) value a point is represented in the graph
<ASSISTANT_TASK:>
Python Code:
from azureml import Workspace
ws = Workspace(
    workspace_id='3c64d445b4c840dca9683dd47522eba3',
    authorization_token='JaC5E2q5FouX14JhvCmcvmzagqV63q0oVIbu2jblLBdQ5e5wf/Y24Ed6uXLvbSUgbiao5iF85C3uufYKQgXoNw==',
    endpoint='https://studioapi.azureml.net'
)
ds = ws.datasets['boston.csv']
df = ds.to_dataframe()
df.head()
import numpy as np  
import pandas as pd  
import matplotlib.pyplot as plt  
import matplotlib as mpl
%matplotlib inline  
# If you are using IPython, this will make the images available in the Notebook
Explanation: The belowing code in azure can't work, because 403 error
boston = load_boston()
california = fetch_california_housing()
In local machine å¦èµ·çç¤ï¼ä¸è½½boston,californiaå­æcsvï¼ç¶åä¼ å
¥azure
dataset = pd.DataFrame(boston.data, columns=boston.feature_names)
dataset['target'] = boston.target
dataset.to_csv('boston.csv')
End of explanation
import matplotlib.mlab as mlab
x=np.linspace(-4,4,100)
for mean,variance in [(0,0.7),(1,1.5),(-2,0.5)]:
    plt.plot(x,mlab.normpdf(x,mean,variance))
plt.show()
y=mlab.normpdf(x,0,1)
type(y)
Explanation: ä»¥ä¸ä»£ç æ¯å®ç°æ­£æåå¸
End of explanation
print(df['target'].mean())
print(np.mean(df['target']))
mean_expected_value=np.mean(df['target'])
df.ix[:,'target'].mean()
Square_errors=pd.Series(mean_expected_value-df['target'])**2
SSE=np.sum(Square_errors)
print('Sum of Squared Errors (SSE): %f'%SSE)
density_plot=Square_errors.plot('hist')
Explanation: åå¼çä¸¤ç§è®¡ç®æ¹æ³
SSE ----è¯¯å·®å¹³æ¹å/åæ¹å·®
ç´æ¹å¾çåæ³ï¼ç¬¬ä¸æ è¡¨ç¤ºåæ¹å·®å¨0-100ä»¥å
çæå¤§çº¦350ç»
End of explanation
def standardize(x):
    return (x-np.mean(x))/np.std(x)
standardize_target=standardize(df['target'])
standardize_target.std()
standardize_target.mean()
Explanation: æ åå
æ ååè¿å,åå¼ä¸º0,æ¹å·®ä¸º1
End of explanation
def covariance(variable_1, variable_2, bias=0):       
    observations = float(len(variable_1))      
    return np.sum((variable_1 - np.mean(variable_1)) * (variable_2 - np.mean(variable_2)))/(observations-min(bias,1))  
Explanation: è¿ä¸ªå½æ°è®¡ç®å
±åæ§
End of explanation
def correlation(var1,var2,bias=0):      
    return covariance(standardize(var1), standardize(var2),bias) 
from scipy.stats.stats import pearsonr  
print ('Our correlation estimation: %0.5f' % (correlation(df['RM'], df['target'])))  
print ('Correlation from Scipy pearsonr estimation: %0.5f' % pearsonr(df['RM'], df['target'])[0])
print(pearsonr(df['RM'],df['target']))
Explanation: è¿ä¸ªå½æ°è®¡ç®ç¸å
³æ§,åºå«å°±æ¯è¾å
¥ç»è¿æ åå
End of explanation
x_range = [df['RM'].min(),df['RM'].max()]  
y_range = [df['target'].min(),df['target'].max()]  
scatter_plot = df.plot(kind='scatter', x='RM', y='target',xlim=x_range, ylim=y_range)
meanY = scatter_plot.plot(x_range, [df['target'].mean(),df['target'].mean()], '--' , color='red', linewidth=1) 
meanX = scatter_plot.plot([df['RM'].mean(),df['RM'].mean()], y_range, '--', color='red', linewidth=1)
Explanation: Let's graph what happens when we correlate two variables. Using a scatterplot, we can easily visualize the two involved variables. A scatterplot is a graph where the values of two variables are treated as Cartesian coordinates; thus, for every (x, y) value a point is represented in the graph
End of explanation
<END_TASK>