首页 > 资讯 > 吴裕雄

吴裕雄

# 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()

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关知识

​裕利健康 (Zuellig)
英雄式瑜珈
雄安宣武医院首台手术开台!新区医疗服务水平再上新台阶
第30届“肿瘤周”前夕,何裕民浅谈新视域下的癌症防治及康复
徐小凤同框郑裕玲!一个又胖又矮却满身贵气,一个病态瘦太显老!
2024年度吴阶平医学奖、吴阶平医药创新奖获奖者名单公布
昆明雄激素高的常见表现
吃这7种水果 让男人重振雄风
成都雄性激素对男性生育有何影响
端午最常见的四大来源传说

网址: 吴裕雄 https://m.trfsz.com/newsview46244.html