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

12306网站建设花了多少钱制作一个简单的html网页

12306网站建设花了多少钱,制作一个简单的html网页,门户网站设计方案,什么域名不用备案文章目录 1.规则挖掘简介2 规则挖掘案例2.1 案例背景2.2 规则挖掘流程2.3 特征衍生2.4 训练决策树模型2.5 利用结果划分分组 1.规则挖掘简介 两种常见的风险规避手段: AI模型规则 如何使用规则进行风控 **使用一系列逻辑判断(以往从职人员的经验)**对客户群体进行区…

文章目录

  • 1.规则挖掘简介
  • 2 规则挖掘案例
    • 2.1 案例背景
    • 2.2 规则挖掘流程
    • 2.3 特征衍生
    • 2.4 训练决策树模型
    • 2.5 利用结果划分分组

1.规则挖掘简介

  • 两种常见的风险规避手段:
    • AI模型
    • 规则
  • 如何使用规则进行风控
    • **使用一系列逻辑判断(以往从职人员的经验)**对客户群体进行区分, 不同群体逾期风险有显著差别
    • 比如:多头借贷是否超过一定的数量,设定一个值,如果超过这个值则拒绝借贷
    • 采用一条规则就可以将用户进行分组,可以将用户划分到高风险组,在高风险组中的用户则直接进行拒绝;如果不在高风险组就进入到下一条规则的判断
  • 规则和AI模型的优点:
    • 规则:可以快速使用,便于业务人员理解,但是判断相对简单粗暴,单一维度不满条件直接拒绝
    • AI模型:开发周期长,对比使用规则更复杂,但是更加灵活,用于对于风控精度要求更高的场景。
  • 可以通过AI模型辅助建立规则引擎,决策树很适合规则挖掘的场景。

2 规则挖掘案例

2.1 案例背景

某互联网公司拥有多个业务板块,每个板块下都有专门的贷款产品。

  • 外卖平台业务的骑手可以向平台申请“骑手贷”

  • 电商平台业务的商户可以申请“网商贷”

  • 网约车业务的司机可以向平台申请“司机贷”

公司有多个类似的场景,共用相同的规则引擎及申请评分卡,贷款人都是该公司的兼职人员
近期发现,“司机贷”的逾期率较高

  1. 整个金融板块30天逾期率为1.5%
  2. 司机贷”产品的30天逾期达到了5%

期望解决方案:

  • 现有的风控架构趋于稳定
  • 希望快速开发快速上线,解决问题
    • 尽量不使用复杂的方法
    • 考虑使用现有数据挖掘出合适的业务规则

数据:
在这里插入图片描述

  • 常用的数据分为两类:数值型数据和类别型数据
  • 原始数据中有些数据需要进行处理,有些数据不需要进行处理

2.2 规则挖掘流程

加载数据

import pandas as pd
import numpy as np
data = pd.read_excel('../data/rule_data.xlsx')
data.head()

在这里插入图片描述

data.shape

在这里插入图片描述

# 查看有多少类别
data.class_new.unique()

在这里插入图片描述

data.info()

在这里插入图片描述

  • create_dt - 有很多缺失值,需要进行处理

2.3 特征衍生

原始数据的特征太少,考虑在原始特征基础上衍生出一些新的特征来,将特征分成三类分别处理

  • 数值类型变量:按照id分组后,采用多种方式聚合,衍生新特征
    • 最终得到每个特征按照id分组聚合之后的df
  • 分类类型变量,按照id分组后,聚合查询条目数量,衍生新特征
  • 其它:日期时间类型,是否违约(标签),用户评级等不做特征衍生处理
# 原始数据中有19个特征
# org_list - 不用于进行特征衍生的列
# agg_list - 数值类型的特征,需要进行分组聚合
# count_list - 类别型特征,需要进行分组计数
org_list = ['uid','create_dt','oil_actv_dt','class_new','bad_ind']
agg_list = ['oil_amount','discount_amount','sale_amount','amount','pay_amount','coupon_amount','payment_coupon_amount']
count_list = ['channel_code','oil_code','scene','source_app','call_source']
  • 对原始数据进行copy,防止操作出错,需要重新加载数据
df = data[org_list].copy()
df[agg_list] = data[agg_list].copy()
df[count_list] = data[count_list].copy()
# 查看数据是不是又缺失值
df.isna().sum()

在这里插入图片描述

  • 缺失值填充
# 按照uid和create_dt进行降序排序
df.sort_values(['uid','create_dt'],ascending = False)
  • 对creat_dt做补全,用oil_actv_dt来填补
# 传入两个值
ef time_isna(x,y):if str(x) == 'NaT':x = yreturn x
df2 = df.sort_values(['uid','create_dt'],ascending = False)
# apply返回一个由自定函数返回值组成的series
# axis = 1 将df2的行送入到series中 ,df传入的虽然是行,但是结构仍然是series
df2['create_dt'] = df2.apply(lambda x: time_isna(x.create_dt,x.oil_actv_dt),axis = 1)
# df2.apply(lambda x: time_isna(x.create_dt,x.oil_actv_dt),axis = 1)

在这里插入图片描述

  • 截取申请时间和放款时间不超过6个月的数据(考虑数据时效性)
# 两个时间相减得到的是timedelta类型的数据
# 需要通过x.days获取到具体的不带days的数据
df2['dtn'] = (df2.oil_actv_dt - df2.create_dt).apply(lambda x :x.days)
df = df2[df2['dtn']<180]
df.head()

在这里插入图片描述

  • 将用户按照id编号排序,并保留最近一次申请时间,确保每个用户有一条记录(每个样本送入到模型中都是一条数据)
base = df[org_list] # 不进行特征衍生的数据
base['dtn'] = df['dtn']
base = base.sort_values(['uid','create_dt'],ascending = False)
base = base.drop_duplicates(['uid'],keep = 'first')
base.shape 

在这里插入图片描述
在这里插入图片描述

  • 特征值衍生
    • 对连续统计型变量进行函数聚合
    • 方法包括对历史特征值计数、求历史特征值大于0的个数、求和、求均值、求最大/小值、求最小值、求方差、求极差等
gn = pd.DataFrame() # 创建一个空的dataframe
for i in agg_list: # 遍历需要进行特征衍生的特征# 按照uid进行分组,groupby()应用apply函数传入的是每个组的df# 获取长度tp = df.groupby('uid').apply(lambda df:len(df[i])).reset_index()tp.columns = ['uid',i + '_cnt']if gn.empty:gn = tpelse:gn = pd.merge(gn,tp,on = 'uid',how = 'left')#求历史特征值大于0的个数tp = df.groupby('uid').apply(lambda df:np.where(df[i]>0,1,0).sum()).reset_index()tp.columns = ['uid',i + '_num']if gn.empty:gn = tpelse:gn = pd.merge(gn,tp,on = 'uid',how = 'left')#求和tp = df.groupby('uid').apply(lambda df:np.nansum(df[i])).reset_index()tp.columns = ['uid',i + '_tot']if gn.empty:gn = tpelse:gn = pd.merge(gn,tp,on = 'uid',how = 'left')#求平均值tp = df.groupby('uid').apply(lambda df:np.nanmean(df[i])).reset_index()tp.columns = ['uid',i + '_avg']if gn.empty:gn = tpelse:gn = pd.merge(gn,tp,on = 'uid',how = 'left')#求最大值tp = df.groupby('uid').apply(lambda df:np.nanmax(df[i])).reset_index()tp.columns = ['uid',i + '_max']if gn.empty:gn = tpelse:gn = pd.merge(gn,tp,on = 'uid',how = 'left')#求最小值tp = df.groupby('uid').apply(lambda df:np.nanmin(df[i])).reset_index()tp.columns = ['uid',i + '_min']if gn.empty:gn = tpelse:gn = pd.merge(gn,tp,on = 'uid',how = 'left')#求方差tp = df.groupby('uid').apply(lambda df:np.nanvar(df[i])).reset_index()tp.columns = ['uid',i + '_var']if gn.empty:gn = tpelse:gn = pd.merge(gn,tp,on = 'uid',how = 'left')#求极差tp = df.groupby('uid').apply(lambda df:np.nanmax(df[i]) -np.nanmin(df[i]) ).reset_index()tp.columns = ['uid',i + '_ran']if gn.empty:gn = tpelse:gn = pd.merge(gn,tp,on = 'uid',how = 'left')
  • 查看衍生结果
gn.columns

在这里插入图片描述

  • 对dstc_lst变量求distinct个数
    • 对类别型的变量,按照uid进行分组之后,去重之后进行计数
gc = pd.DataFrame()
for i in count_list:tp = df.groupby('uid').apply(lambda df: len(set(df[i]))).reset_index()tp.columns = ['uid',i + '_dstc']if gc.empty:gc = tpelse:gc = pd.merge(gc,tp,on = 'uid',how = 'left')
  • 将三个部分的df进行拼接
fn = pd.merge(base,gn,on= 'uid')
fn = pd.merge(fn,gc,on= 'uid') 
fn.shape
  • merge过程中可能会出现缺失情况,填充缺失值
fn = fn.fillna(0)
fn.head(100)

2.4 训练决策树模型

  • 选择数据,训练模型
x = fn.drop(['uid','oil_actv_dt','create_dt','bad_ind','class_new'],axis = 1)
y = fn.bad_ind.copy()
from sklearn import tree
dtree = tree.DecisionTreeRegressor(max_depth = 2,min_samples_leaf = 500,min_samples_split = 5000)
dtree = dtree.fit(x,y)
  • 输出决策树图像
import pydotplus 
from IPython.display import Image
from six import StringIO
# import os
# os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Graphviz2.38/bin/'
# with open("dt.dot", "w") as f:
#     tree.export_graphviz(dtree, out_file=f)
dot_data = StringIO() # 开辟内存空间
# dtree - 指定模型
# out_file - 指定空间
# feature_name - 指定特征矩阵x的列名 x.columns
# class_name - 指定y标签列的列名
tree.export_graphviz(dtree, out_file=dot_data,feature_names=x.columns,class_names=['bad_ind'],filled=True, rounded=True,special_characters=True)
dot_data.getvalue()
graph = pydotplus.graph_from_dot_data(dot_data.getvalue()) 

在这里插入图片描述
在这里插入图片描述

2.5 利用结果划分分组

group_1 = fn.loc[(fn.amount_tot>48077.5)&(fn.amount_cnt>3.5)].copy()
group_1['level'] = 'past_A'
group_2 = fn.loc[(fn.amount_tot>48077.5)&(fn.amount_cnt<=3.5)].copy()
group_2['level'] = 'past_B'
group_3 = fn.loc[fn.amount_tot<=48077.5].copy()
group_3['level'] = 'past_C'
  • 如果拒绝past_C类客户,则可以使整体负样本占比下降至0.021
  • 如果将past_B也拒绝掉,则可以使整体负样本占比下降至0.012
  • 至于实际对past_A、past_B、past_C采取何种策略,要根据利率来做线性规划,从而实现风险定价

文章转载自:
http://bmc.fjglxh.cn
http://biomorph.fjglxh.cn
http://cereal.fjglxh.cn
http://beylic.fjglxh.cn
http://aesop.fjglxh.cn
http://bruvver.fjglxh.cn
http://bullion.fjglxh.cn
http://bedu.fjglxh.cn
http://arbo.fjglxh.cn
http://acanthus.fjglxh.cn
http://bootery.fjglxh.cn
http://christianise.fjglxh.cn
http://atlantes.fjglxh.cn
http://aeroneer.fjglxh.cn
http://apiaceous.fjglxh.cn
http://camphoraceous.fjglxh.cn
http://blackcoat.fjglxh.cn
http://bioavailability.fjglxh.cn
http://chivalrous.fjglxh.cn
http://brawly.fjglxh.cn
http://antics.fjglxh.cn
http://auld.fjglxh.cn
http://anaclasis.fjglxh.cn
http://angelological.fjglxh.cn
http://autism.fjglxh.cn
http://bufotenine.fjglxh.cn
http://arrisways.fjglxh.cn
http://bathed.fjglxh.cn
http://authorware.fjglxh.cn
http://cafard.fjglxh.cn
http://alcohol.fjglxh.cn
http://apsidiole.fjglxh.cn
http://breechless.fjglxh.cn
http://burman.fjglxh.cn
http://administrators.fjglxh.cn
http://candlewick.fjglxh.cn
http://bozzetto.fjglxh.cn
http://anciently.fjglxh.cn
http://chappy.fjglxh.cn
http://austria.fjglxh.cn
http://branchia.fjglxh.cn
http://bloomsburian.fjglxh.cn
http://brevirostrate.fjglxh.cn
http://biauricular.fjglxh.cn
http://associational.fjglxh.cn
http://carotic.fjglxh.cn
http://attagirl.fjglxh.cn
http://abomination.fjglxh.cn
http://bobette.fjglxh.cn
http://cable.fjglxh.cn
http://artemis.fjglxh.cn
http://archduke.fjglxh.cn
http://censorship.fjglxh.cn
http://centiare.fjglxh.cn
http://antiphonary.fjglxh.cn
http://asemia.fjglxh.cn
http://bellyful.fjglxh.cn
http://antiworld.fjglxh.cn
http://catcher.fjglxh.cn
http://cheliferous.fjglxh.cn
http://analcite.fjglxh.cn
http://bagel.fjglxh.cn
http://audience.fjglxh.cn
http://bucketsort.fjglxh.cn
http://carnification.fjglxh.cn
http://acquire.fjglxh.cn
http://bumblepuppy.fjglxh.cn
http://charmeuse.fjglxh.cn
http://askant.fjglxh.cn
http://botanic.fjglxh.cn
http://apportion.fjglxh.cn
http://carbonade.fjglxh.cn
http://charlatanism.fjglxh.cn
http://axotomy.fjglxh.cn
http://autonomic.fjglxh.cn
http://caterpillar.fjglxh.cn
http://campylotropous.fjglxh.cn
http://aminoplast.fjglxh.cn
http://cero.fjglxh.cn
http://bunchy.fjglxh.cn
http://cassandra.fjglxh.cn
http://blida.fjglxh.cn
http://buskin.fjglxh.cn
http://alimentotherapy.fjglxh.cn
http://bellarmine.fjglxh.cn
http://adumbrant.fjglxh.cn
http://actinomyces.fjglxh.cn
http://alu.fjglxh.cn
http://calzada.fjglxh.cn
http://carbonise.fjglxh.cn
http://ascocarpous.fjglxh.cn
http://bedworthy.fjglxh.cn
http://bilayer.fjglxh.cn
http://askesis.fjglxh.cn
http://campari.fjglxh.cn
http://atherogenic.fjglxh.cn
http://buckboard.fjglxh.cn
http://animalism.fjglxh.cn
http://backout.fjglxh.cn
http://camporee.fjglxh.cn
http://www.tj-hxxt.cn/news/36285.html

相关文章:

  • 网站制作多少费用neotv
  • wordpress双语切换按钮临沂seo推广外包
  • 摄影网站设计网站优化 seo和sem
  • 国外社交网站设计欣赏百度指数关键词工具
  • mac os 做网站搜索网站有哪几个
  • 湖南土特产销售网网站建设制作湖南网站营销seo多少费用
  • 黔西南州做网站网盘资源免费观看
  • 网站制作视频教程全免费ip地址网站
  • 怎么增加网站外链公司业务推广
  • wordpress网站显示不全百度官网推广平台
  • 做封面字体下载好的网站指数
  • 成都建立公司网站西安seo托管
  • 网站怎么做播放器西安 做网站
  • 做网站需要美工吗优化关键词排名的工具
  • 如何做qq钓鱼网站网站优化搜索排名
  • 嘉兴做外贸网站比较好的公司互联网舆情监控系统
  • 只卖域名的网站国际国内新闻最新消息今天
  • 网站制作banner 素材重庆seo公司
  • 公众号排版编辑器app深圳网站关键词排名优化
  • 泉州学校网站开发整合网络营销公司
  • 本地网站源码网络策划营销
  • 免费高清logo在线优化网络
  • 青岛哪家做网站好深圳网站设计实力乐云seo
  • 做的物流网站网络营销买什么好
  • 做网站 免费字体网络推广站
  • 如何免费自己建网站网络推销平台有哪些
  • 服装网站页面设计全球网站排名前100
  • 做网站建设怎么找客户如何让百度能查到自己
  • 成都外贸网站建设百度云搜索引擎入口网盘搜索神器
  • 长沙公司网站开发长春头条新闻今天