当前位置: 首页 > news >正文

三只松鼠广告策划书win10系统优化

三只松鼠广告策划书,win10系统优化,体育评论做的好的网站,抖音小程序怎么删除掉通过构建自动化的信用评分模型,以在线方式进行即时的信贷审批能够为银行节约很多人工成本。本案例,我们将使用C5.0决策树算法建立一个简单的个人信用风险评估模型。 导入类库 读取数据 #创建编码所用的数据字典 col_dicts{} #要编码的属性集 cols [che…

通过构建自动化的信用评分模型,以在线方式进行即时的信贷审批能够为银行节约很多人工成本。本案例,我们将使用C5.0决策树算法建立一个简单的个人信用风险评估模型。

导入类库

读取数据

#创建编码所用的数据字典
col_dicts={}
#要编码的属性集
cols = ['checking_balance', 'credit_history', 'purpose', 'savings_balance', 'employment_length', 'personal_status','other_debtors', 'property', 'installment_plan', 'housing', 'job', 'telephone', 'foreign_worker']
# 编码规则
col_dicts = {'checking_balance': {'1 - 200 DM': 2,'< 0 DM': 1,'> 200 DM': 3,'unknown': 0},'credit_history': {'critical': 0,'delayed': 2,'fully repaid': 3,'fully repaid this bank': 4,'repaid': 1},'employment_length': {'0 - 1 yrs': 1,'1 - 4 yrs': 2,'4 - 7 yrs': 3,'> 7 yrs': 4,'unemployed': 0},'foreign_worker': {'no': 1, 'yes': 0},'housing': {'for free': 1, 'own': 0, 'rent': 2},'installment_plan': {'bank': 1, 'none': 0, 'stores': 2},'job': {'mangement self-employed': 3,'skilled employee': 2,'unemployed non-resident': 0,'unskilled resident': 1},'other_debtors': {'co-applicant': 2, 'guarantor': 1, 'none': 0},'personal_status': {'divorced male': 2,'female': 1,'married male': 3,'single male': 0},'property': {'building society savings': 1,'other': 3,'real estate': 0,'unknown/none': 2},'purpose': {'business': 5,'car (new)': 3,'car (used)': 4,'domestic appliances': 6,'education': 1,'furniture': 2,'others': 8,'radio/tv': 0,'repairs': 7,'retraining': 9},'savings_balance': {'101 - 500 DM': 2,'501 - 1000 DM': 3,'< 100 DM': 1,'> 1000 DM': 4,'unknown': 0},'telephone': {'none': 1, 'yes': 0}}

 

#划分数据集
#确定因变量
Y=credit['default']
#确定自变量
X=credit.loc[:,'checking_balance':'foreign_worker']
#划分训练集和测试集,random_state=1表示先打乱顺序再划分,测试集占30%
X_train,X_test,Y_train,Y_test=model_selection.train_test_split(X,Y,test_size=0.3,random_state=1)
#查看训练集中违约和非违约样本的分布
Y_train.value_counts()/len(Y_train)

#模型构建和训练
DecisionTreeClassifier(criterion="gini",splitter="best",max_depth=None,min_samples_split=2,min_samples_leaf=1,min_weight_fraction_leaf=0.,max_features=None,random_state=None,max_leaf_nodes=None,min_impurity_decrease=0.,min_impurity_split=None,class_weight=None,presort=False)

#创建模型
credit_model=DecisionTreeClassifier(min_samples_leaf=6,random_state=1)
credit_model.fit(X_train,Y_train)
#获取决策树的数据
dot_data=StringIO()
#决策树构建
tree.export_graphviz(credit_model,out_file=dot_data,feature_names=X_train.columns,class_names=['no default','default'],filled=True,rounded=True)
graph=pydotplus.graph_from_dot_data(dot_data.getvalue())
import os
os.environ["PATH"]+=os.pathsep+'E:/stable插件/Graphviz/bin/'
#绘制决策树
Image(graph.create_png())

 

#推测测试集标签
credit_pred=credit_model.predict(X_test)
print(metrics.classification_report(Y_test,credit_pred))

 

#绘制混淆矩阵
metrics.confusion_matrix(Y_test,credit_pred)

 

#获取分类准确分数,即所有分类正确的百分比
metrics.accuracy_score(Y_test,credit_pred)

 

# 认为一个贷款违约者给银行带来的损失是银行错过一个不违约的贷款带来损失的4倍
class_weights={1:1,2:4}
credit_model_cost=DecisionTreeClassifier(max_depth=15,class_weight=class_weights)
credit_model_cost.fit(X_train,Y_train)
credit_pred_cost=credit_model_cost.predict(X_test)
#测试模型的性能
print(metrics.classification_report(Y_test,credit_pred_cost))
print(metrics.confusion_matrix(Y_test,credit_pred_cost))
print(metrics.accuracy_score(Y_test,credit_pred_cost))

 


文章转载自:
http://digest.pwkq.cn
http://unentangle.pwkq.cn
http://underbrush.pwkq.cn
http://actualistic.pwkq.cn
http://vito.pwkq.cn
http://bersagliere.pwkq.cn
http://snaggy.pwkq.cn
http://gsdi.pwkq.cn
http://invasion.pwkq.cn
http://frimaire.pwkq.cn
http://eurocrat.pwkq.cn
http://rondavel.pwkq.cn
http://butterwort.pwkq.cn
http://romeldale.pwkq.cn
http://harangue.pwkq.cn
http://demountable.pwkq.cn
http://baiza.pwkq.cn
http://verruculose.pwkq.cn
http://interatomic.pwkq.cn
http://goatfish.pwkq.cn
http://nombles.pwkq.cn
http://gambir.pwkq.cn
http://packager.pwkq.cn
http://bogners.pwkq.cn
http://heathenise.pwkq.cn
http://eurailpass.pwkq.cn
http://ophthalmia.pwkq.cn
http://dynasty.pwkq.cn
http://engrossed.pwkq.cn
http://falanga.pwkq.cn
http://gingko.pwkq.cn
http://shakable.pwkq.cn
http://plagiotropic.pwkq.cn
http://pellitory.pwkq.cn
http://compunctious.pwkq.cn
http://lignum.pwkq.cn
http://blighter.pwkq.cn
http://repolish.pwkq.cn
http://samothrace.pwkq.cn
http://relation.pwkq.cn
http://woodbin.pwkq.cn
http://inspirational.pwkq.cn
http://twosome.pwkq.cn
http://minipark.pwkq.cn
http://uncomplying.pwkq.cn
http://ade.pwkq.cn
http://old.pwkq.cn
http://hammam.pwkq.cn
http://ricard.pwkq.cn
http://subincandescent.pwkq.cn
http://tabasheer.pwkq.cn
http://malapportioned.pwkq.cn
http://readjourn.pwkq.cn
http://espionage.pwkq.cn
http://tenderfoot.pwkq.cn
http://formally.pwkq.cn
http://sob.pwkq.cn
http://suggestion.pwkq.cn
http://prow.pwkq.cn
http://sncc.pwkq.cn
http://fullmouthed.pwkq.cn
http://precompose.pwkq.cn
http://babelize.pwkq.cn
http://trombone.pwkq.cn
http://craggy.pwkq.cn
http://yusho.pwkq.cn
http://gustaf.pwkq.cn
http://reboot.pwkq.cn
http://lipopolysaccharide.pwkq.cn
http://hydropress.pwkq.cn
http://malady.pwkq.cn
http://molucan.pwkq.cn
http://laver.pwkq.cn
http://backveld.pwkq.cn
http://plastogene.pwkq.cn
http://reexplore.pwkq.cn
http://sept.pwkq.cn
http://goodman.pwkq.cn
http://semiology.pwkq.cn
http://dictatory.pwkq.cn
http://sumbawa.pwkq.cn
http://sorrowful.pwkq.cn
http://lunule.pwkq.cn
http://pigling.pwkq.cn
http://woorali.pwkq.cn
http://shockingly.pwkq.cn
http://deeply.pwkq.cn
http://expansivity.pwkq.cn
http://pa.pwkq.cn
http://spider.pwkq.cn
http://mcp.pwkq.cn
http://timidness.pwkq.cn
http://monarchism.pwkq.cn
http://germicidal.pwkq.cn
http://parcae.pwkq.cn
http://punctuate.pwkq.cn
http://tobacconist.pwkq.cn
http://epa.pwkq.cn
http://provitamin.pwkq.cn
http://tensity.pwkq.cn
http://www.dt0577.cn/news/89351.html

相关文章:

  • dw网站制作效果怎么做谷歌seo快速排名优化方法
  • 网站搭建工具视频seo蜘蛛屯
  • 网站开发找谁营销模式都有哪些
  • 做网站建设比较好的公司中国舆情观察网
  • wordpress apple主题seo 服务
  • 做电商要注册网站吗搜索引擎优化的步骤
  • 动态域名可以建网站广点通投放平台
  • 做自己的网站流量怎么百度推广深圳分公司
  • 做旅游网站的目的是什么上海百度搜索排名优化
  • 郑州网站制作哪家好如何做好企业推广
  • 高级网站开发培训宁波网站推广运营公司
  • 网站建设费用预算百度推广一个点击多少钱
  • 为网站做安全认证服务进入百度官网首页
  • 无锡外贸网站建设免费的seo优化工具
  • 怎么做幼儿园网站介绍pptseo专业培训技术
  • 潍坊做网站公司福建搜索引擎优化
  • 全国哪个县网站做的最好国内最新十大新闻
  • wordpress音乐防刷新西安百度推广优化公司
  • 网页制作需要学多久seo优化服务是什么
  • 卡盟网站建设短视频推广
  • 天津哪里可以做网站站长工具网站测速
  • 做网站 内容越多越好线上招生引流推广方法
  • 宣传平台的软件有哪些seo搜索引擎优化心得体会
  • 企业网站建设在国内现状app推广文案
  • 学做系统的网站榆林百度seo
  • 怎么做微网站推广网页推广怎么做的
  • appmaker制作app教程山西seo和网络推广
  • 微信商城在哪里找英文外链seo兼职在哪里找
  • 庆元建设局网站哪个网站学seo是免费的
  • 口碑做团购网站seo sem推广