# UserScoreCard **Repository Path**: ljtyxl/UserScoreCard ## Basic Information - **Project Name**: UserScoreCard - **Description**: 用户信用评分卡制作项目 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2019-12-29 - **Last Updated**: 2021-08-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README python .\setup.py install 数据源: 1)企业案件信息 2)企业工商信息 3)企业招聘信息 4)企业失信信息 5)裁判文书 6)开庭公告 7)法院公告 8)股东变更信息 9)行业信息 10)商标注册信息 11) 动产拍卖信息 12)失信被执行信息 ![image-20191231232225963](Pictures/image-20191231232225963.png) ### 项目架构 ![image-20200102190032815](Pictures/image-20200102190032815.png) ## step1: 数据准备与迁移 利用sqoop从postgresql的mpp集群greenplum里面导出数据到hdfs。 [Window 安装Sqoop 环境](https://blog.csdn.net/zhouzhiwengang/article/details/88132653) PS C:\Users\13293> cd E:\bigdata\hadoop-3.1.3\sbin PS E:\bigdata\hadoop-3.1.3\sbin> .\start-all.cmd hdfs: http://127.0.0.1:9870/explorer.html#/ hadoop: http://127.0.0.1:8088/cluster/apps/RUNNING **example:** ```bash sqoop import \ --connect jdbc:postgresql://127.0.0.1:5433/matchs?currentSchema=xmgjyh \ --username postgres --password postgres --query \ 'select * from test where $CONDITIONS' \ --split-by id \ --target-dir hdfs://127.0.0.1:9000/matchs/xmgjyh/test.csv \ --m 1 ``` ## step2: 将一些pg库里面没有的文件上传到hdfs, 参考:[hdfs命令操作](http://hadoop.apache.org/docs/r1.0.4/cn/hdfs_shell.html#) example: hadoop fs -mkdir -p hdfs://127.0.0.1:9000/matchs/xmgjyh hadoop fs -put ./* hdfs://127.0.0.1:9000/matchs/xmgjyh/ ## step3:数据探索 #### 公司经营状态是存续是什么意思 存续是指:企业依法存在并继续正常运营。也被称作开业、正常、登记 经营状态一般分为八种:存续、在业、吊销、注销、迁入、迁出、停业、清算。 1、经营状态存续是指:企业依法存在并继续正常运营。也被称作开业、正常、登记。 2、经营状态在业是指:企业正常开工生产,新建企业包括部分投产或试营业。 因不同省份可能有细微的区别,一般在营、正常、经营、在营在册、有效、在业在册也是在业的意思。 3、经营状态吊销;未注销是指:吊销企业营业执照,是工商局对违法企业作出的行政处罚。企业被吊销执照后,应当依法进行清算,清算结束并办理工商注销登记后,该企业法人才归于消灭。 4、经营状态注销是指:企业已不复存在,丧失法人资格。 5、经营状态迁出是指:企业登记主管机关的变更,迁离某主管机关。 6、经营状态迁入是指:企业登记主管机关的变更,迁入某主管机关。 7、经营状态停业是指:由某种原因,企业在期末处于停止生产经营活动待条件改变后仍恢复生产。 8、经营状态清算是指:按章程规定解散以及由于破产、被吊销等其他原因宣布终止经营后,对企业的财产、债权、债务进行全面清查,并进行收取债权,清偿债务和分配剩余财产的经济活动。 ## step4:数据图标分析以及相关性分析 ## step5:ETL(数据抽取(extract)、转换(transform)、加载(load)) ## step6:特征工程 ## step7:抽样 ## step8:模型选择 ## step9:模型训练与特征选择 ## step10: 构建人工黑名单 由于模型预测的准确性难以保证,所以加入人工干预,模型上线先进入人工黑名单 ## step10:模型上线部署 1. 调取mpp(分布式数据仓库集群),生成特征 2. 将特征输入模型,得到预测结果,得到失信、吊销、破产的概率P 3. 对P进行评分卡处理,得到该企业的相应的风险评级。 4. 用tornado构建API。 5. 用setup打包模型,安装到集群环境,进行定时批量识别。 ## 模型部署 yum install gcc libffi-devel python-devel openssl-devel -y; yum install postgresql-devel pip install setuptools -U pip freeze or pip list pip freeze > ./requirements.txt pip install -r requirements.txt nohup python ner_svc_main.py >/dev/null 2>&1 & pkill -f ner_svc_main.py pkill -f batch_insert_entities.py nohup python batch_insert_entities.py >/dev/null 2>&1 & tail -fn200 /root/ljt/python/prod/zhulong_ner_idcnn_predict_v1/log/logs/2 1351 python setup.py install --record log cat log | xagrs rm -rf ./neo4j console 2020-01-06 11:55:49.964+0000 INFO ======== Neo4j 3.5.6 ======== 2020-01-06 11:55:50.027+0000 INFO Starting... 2020-01-06 11:56:00.247+0000 INFO Bolt enabled on 127.0.0.1:7687. 2020-01-06 11:56:06.636+0000 INFO Started. 2020-01-06 11:56:11.433+0000 INFO Remote interface available at http://localhost:7474/ 442 postgres 2020/01/06 19:59:08 iptables -I INPUT -p tcp --dport 7474 -j ACCEPT 443 postgres 2020/01/06 19:59:18 iptables -I INPUT -p tcp --dport 7687 -j ACCEPT 444 postgres 2020/01/06 19:59:33 iptables-save 445 postgres 2020/01/06 19:59:52 netfilter-persistent save 446 postgres 2020/01/06 20:00:03 netfilter-persistent reload http://180.76.159.157:7474/ 配置Neo4j服务器允许远程访问 https://www.cnblogs.com/xcyz/p/8622103.html lsof -i:7474 使用netstat -aptn命令行,查看所有开启的端口号, neo4j: http://180.76.159.157:7474/browser/ neo4j ljtlrh