吳裕雄
# This Python 3 environment comes with many helpful analytics libraries installed# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python# For example,here‘s several helpful packages to load in import numpy as np # linear algebraimport pandas as pd # data processing,CSV file I/O (e.g. pd.read_csv) # Input data files are available in the "../input/" directory.# For example,running this (by clicking run or pressing Shift+Enter) will list the files in the input directory
df=pd.read_csv(‘F:\kaggleDataSet\Key_indicator_districtwise\Key_indicator_districtwise.csv‘)df.head()
x=df[‘AA_Sample_Units_Total‘]y=df[‘AA_Sample_Units_Rural‘]z=df[‘AA_Population_Urban‘]import matplotlib.pyplot as pltimport seaborn as snsplt.title(‘State_district_Name vs AA_Sample_Units_Total ‘)plt.xlabel(‘State_district_Name‘)plt.ylabel(‘AA_Sample_Units_Total‘)plt.scatter(x,y)
plt.hist(x)plt.title(‘AA_Sample_Units_Total vs Frequency‘)plt.xlabel(‘AA_Sample_Units_Total‘)plt.ylabel(‘Frequency‘)
plt.hist(y)plt.title(‘AA_Sample_Units_Rural vs frequency‘)plt.xlabel(‘AA_Sample_Units_Rural‘)plt.ylabel(‘Frequency‘)
plt.hist(z)plt.title(‘AA_Population_Urban vs Frequency‘)plt.xlabel(‘AA_Population_Urban‘)plt.ylabel(‘Frequency‘)
q=df[‘AA_Ever_Married_Women_Aged_15_49_Years_Total‘]qw=q.sort_values()w
plt.Boxplot(w)
plt.Boxplot(y)
import matplotlib.pyplot as plt import numpy as np from sklearn import datasets,linear_model,metrics # load the boston dataset boston = datasets.load_boston(return_X_y=False) # defining feature matrix(X) and response vector(y) X = boston.data y = boston.target # splitting X and y into training and testing sets from sklearn.model_selection import train_test_split X_train,X_test,y_train,y_test = train_test_split(X,y,test_size=0.4,random_state=1) # create linear regression object reg = linear_model.LinearRegression() # train the model using the training sets reg.fit(X_train,y_train) # regression coefficients print(‘Coefficients: n‘,reg.coef_) # variance score: 1 means perfect prediction print(‘Variance score: {}‘.format(reg.score(X_test,y_test))) # plot for residual error ## setting plot style plt.style.use(‘fivethirtyeight‘) ## plotting residual errors in training data plt.scatter(reg.predict(X_train),reg.predict(X_train) - y_train,color = "green",s = 10,label = ‘Train data‘) ## plotting residual errors in test data plt.scatter(reg.predict(X_test),reg.predict(X_test) - y_test,color = "blue",label = ‘Test data‘) ## plotting line for zero residual error plt.hlines(y = 0,xmin = 0,xmax = 50,linewidth = 2) ## plotting legend plt.legend(loc = ‘upper right‘) ## plot title plt.title("Residual errors") ## function to show plot plt.show()
版權(quán)聲明:本文內(nèi)容由互聯(lián)網(wǎng)用戶自發(fā)貢獻,該文觀點與技術(shù)僅代表作者本人。本站僅提供信息存儲空間服務,不擁有所有權(quán),不承擔相關(guān)法律責任。如發(fā)現(xiàn)本站有涉嫌侵權(quán)/違法違規(guī)的內(nèi)容, 請發(fā)送郵件至 dio@foxmail.com 舉報,一經(jīng)查實,本站將立刻刪除。
相關(guān)知識
?裕利健康 (Zuellig)
英雄式瑜珈
雄安宣武醫(yī)院首臺手術(shù)開臺!新區(qū)醫(yī)療服務水平再上新臺階
第30屆“腫瘤周”前夕,何裕民淺談新視域下的癌癥防治及康復
徐小鳳同框鄭裕玲!一個又胖又矮卻滿身貴氣,一個病態(tài)瘦太顯老!
2024年度吳階平醫(yī)學獎、吳階平醫(yī)藥創(chuàng)新獎獲獎者名單公布
昆明雄激素高的常見表現(xiàn)
吃這7種水果 讓男人重振雄風
成都雄性激素對男性生育有何影響
端午最常見的四大來源傳說
網(wǎng)址: 吳裕雄 http://www.u1s5d6.cn/newsview46244.html
推薦資訊
- 1發(fā)朋友圈對老公徹底失望的心情 12775
- 2BMI體重指數(shù)計算公式是什么 11235
- 3補腎吃什么 補腎最佳食物推薦 11199
- 4性生活姿勢有哪些 盤點夫妻性 10425
- 5BMI正常值范圍一般是多少? 10137
- 6在線基礎(chǔ)代謝率(BMR)計算 9652
- 7一邊做飯一邊躁狂怎么辦 9138
- 8從出汗看健康 出汗透露你的健 9063
- 9早上怎么喝水最健康? 8613
- 10五大原因危害女性健康 如何保 7826