用于跨信用案件分配的包。

Icics的Python项目详细描述


https://img.shields.io/github/forks/badges/shields.svg?style=social&label=Forkhttps://img.shields.io/badge/Pypi-pip-yellow.svghttps://travis-ci.org/DataXujing/Icics.svg?branch=masterhttps://raw.githubusercontent.com/DataXujing/Icics/master/pic/logo.png

徐静

跨信用智能分类系统(ICICS)。 这是一个相互信任的python包。你可以用它把案子交给你的工薪阶层。

简介

首先简单描述算法的过程:

  1. 首先,定义目标法律“偏好”案例(例如,法律以高回收率操作案例,并在案例中考虑法律“偏好”)
  2. 准备分配的随机中断案例序列(该操作主要削弱了算法使用的缺点)
  3. 聚类算法是针对目标法律“偏好”案例进行的,它将相似的案例集合在一起。并记录每个集群的中心数和每个集群中的案例数
  4. 计算每个案例与目标法则之间的相似度,将案例分配给一个高相似度的聚类,并记录相似度。
  5. 每一类案件的相似性,选择在每一类案件中具有高度相似性的$K(n_i/n)$作为待分配案件的法律案件的对象(其中$K$表示案件为家庭的法律案件的分配,$N_i$表示目标是在每一类案件中“喜欢”案件的数量,$N$表示所有法律历史的目标“喜欢”产品的数量)
  6. 删除法律对象和法律对象指定的案件,并执行下一个目标案件的指定。

更多的细节你可以在你的设备中点击这个包,还有更多关于ICIC的信息。

演示

import numpy as np
import pandas as pd

from  sklearn.cluster import KMeans
from sklearn.cross_validation import StratifiedKFold

import random
import matplotlib.pyplot as plt

import seaborn as sns

from icics import *

#test the model

train = pd.read_csv(u"C:/Users/Administrator.USER-20170417DX/Desktop/test1.csv")
df = train.copy()

dfold0 = train.iloc[range(1000)]
df0 = train.iloc[range(1000,2000)].drop('ywy0',axis=1)

topn0 = pd.DataFrame({'ywy0':np.unique(dfold0.ywy0),'topn_ywy':
     [30,50,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,20,60]})

bhywy0 = pd.DataFrame({'ywy0':dfold0.ywy0})

icic(dfold0,df0,topn0,bhywy0,ncluster=2,shuffle=1,epsilon=0.001,init='k-means++',random_state=123,max_iter=1000,algorithm="auto",path=0)

然后您可以使用acc平均值的方法来训练超参数:

#train the model

train = pd.read_excel(u"C:/Users/Administrator.USER-20170417DX/Desktop/test2.xlsx")

bhywy = pd.DataFrame({'ywy0':train.ywy0})
topn = pd.DataFrame({'ywy0':['cc12','cd17'],'topn_ywy':[30,40]})

pre_mean=[]
for j in np.arange(1,15):
    means = acc_mean(train,bhywy,topn,j)
    pre_mean.append(means)

precies = pd.DataFrame({'ncluster' : np.arange(1,15),'acc_mean' : pre_mean})


plt.figure(1,figsize=(14,14))

with sns.axes_style("ticks"):
    plt.title('The acc_mean of the icics-model')
    sns.pointplot(x='ncluster',y='acc_mean',data=precies)
    plt.xlabel('Number of Cluster')
    plt.ylabel('Mean of accuracy')
plt.show()

结果如下:

https://raw.githubusercontent.com/DataXujing/Icics/master/pic/test.png

这些演示代码csan不适用于新版本>;=3.4.3,您应该在包中看到帮助文档, 你也可以在https://icics-doc.readthedocs.io/en/latest/

支持

在Python2.7、3.5、3.6上测试

您可以登录徐静的主页:https://dataxujing.coding.mehttps://dataxujing.github.io了解更多信息。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
我们应该在测试java代码时模拟黄瓜测试吗。我们应该在多大程度上使用黄瓜?   Hibernate Weblogic 10.3.4 java。lang.NoSuchMethodError:javax/persistence/spi/PersistenceUnitInfo。getValidationMode()Ljavax/persistence/ValidationMode;   java如何在main()中访问私有静态实例变量   java JMockit无法模拟类的公共final字段   java是否可以返回特定控制器操作的输出(html)?   java如何返回正确类型的列表?   rest-OpenUI/Swagger-java-to-API   java组织。springframework。豆。工厂NoSuchBeanDefinitionException或加载ApplicationContext失败   java使用POST将参数从JSP发送到Servlet   java如何监听特定的按钮按下和主视图用户交互?   java如何让gradle在本地maven repo中覆盖库?   如何在Java中“合并”两个URI?   java如何制作一个方法来移动数组中的字符?   使用来自java的命令启动powershell窗口   java垃圾收集器和匿名类   java如何为CellTable(GWT 2.4)中的ImageResourceCell创建PanelPopup?