基于deepwalk图嵌入的match解读

目录

一、deepwalk解读

1. deepwalk介绍

2. deepwalk优势

2.1 online学习

2.2 并行

2.3 信息缺失

2.4 graph embedding

3. deepwalk算法和流程实现

二、deepwalk在推荐应用

1. 目标

2. 代码说明

2.1 数据格式

2.2 代码说明

3. 实验输出


目前推荐系统常用的召回方法有itemCF、userCF、simRank、标签体系(关键词、主题等),graph embedding引入deepwalk,使用短随机游走来学习图形中顶点的表示,来评估和比较来自用户项关系的异构信息网络中的偏好传播算法,给召回算法带来了新的思路。

一、deepwalk解读

1. deepwalk介绍

paper指出deepwalk是一种学习网络中节点的表示的新的方法,是把language modeling的方法用在了social network里面,从而可以用deep learning的方法,不仅能表示节点,还能表示出节点之间的拓扑关系,也就是表现出社会网络的社会关系。说白了就是用一个低维向量去表示网络中的每个节点。

如下图示,输入的是一个网络,其中颜色相同的结点表示拓扑关系上更为相近的结点。输出的是每个节点的二维向量,每个节点对应的向量关系如图所示。我们可以从这个图看出,越是拓扑结构相近的点,其对应的二维向量在二维空间上距离与近。

2. deepwalk优势

2.1 online学习

deepwalk是可扩展的(scalable),它是一个online的学习算法,仅需要local的信息,可以在后续有添加的新的信息的时候,无需从头学习,只需要学习新的结点的信息就可以了(因为使用了random walk)。

2.2 并行

使用random walk,它可以同时从不同的结点处开始random walk从而开始学习的过程。

2.3 信息缺失

deepwalk相比于其他方法有更好的效果,特别是在信息缺失,labeled data稀疏,以及training data较少的时候。

2.4 graph embedding

便于将一些机器学习的算法应用到网络中。网络数据不同于传统的数据,它不仅包含了节点的信息,还包含了节点间的关系,对于传统的机器学习算法,很难将其应用于网络中。例如网络中的社团发现算法,大多数情况下我们都针对网络做大量的游走,不断改变网络的社团结构,以使网络获得最优的模块度,但是如果我们能将拓扑信息嵌入到低维向量中,那么每个节点我们都可以看做是一个样本,每个维度都可以看做一个feature,那么只需要跑个聚类算法,就可以得到很好的结果。除了聚类,还有链路预测、推荐等一系列网络中的问题,都可以直接扔到机器学习的相关算法中跑出来。

3. deepwalk算法和流程实现

用random walk(随机游走)生成多个网络,然后送到word2vec去训练。 
主要步骤:Network/graph->random walk(见下图)->得到节点序列(representation mapping)->放到skip-gram模型中(word2vec模型,见下图)->output:representation。

图1 random walk算法流程

图2 word2Vec算法流程

二、deepwalk在推荐应用

以最经典的电影推荐场景为例,数据集在data中,包括用户对电影评分、电影与对应实体(导演、演员、类型)关系。开发环境为python2.7。graph中节点是用户、电影、演员、流派、导演和评分。graph中边表示实体关系。如下图所示。

1. 目标

  • 预测用户对某些项目的偏好,他们尚未使用基于图形的协同过滤技术,DeepWalk对用户电影评级数据集进行评级。
  • 首先,使用电影评论数据集,创建了具有节点作为用户,电影及其相关实体(演员,导演)的异构图形网络。
  • DeepWalk用于在此图表上生成随机游走。
  • 使用Word2Vec将这些随机游走嵌入低维空间。
  • 通过找到与用户节点具有最高相似性的电影评级节点来完成对用户 - 电影对的评级的预测。

2. 代码说明

2.1 数据格式

2.1.1 user-item对应的rating(click)

加载每个用户对物品评分数据,数据格式如下:

userId-itemId-rating(click)

产出用户对一系列电影评分对字典,key为userId,value为dict,包含(itemId, rating),如下:

ratings[75] = [(3,1), (32,4.5), ...]

2.1.2 item

加载item数据产出字典,key为itemId,value为item object(包含item相关entity),同时产出entity对应set

2.1.3 graph中node数据

构建graph不同实体对应的节点字典,key为nodeId,value为node object

例如,节点u75的id为12,nodedict['u75'].id=12

更新node中user和item rating邻近边连接、movie-entity邻近边连接

例如,itemTag_node.neighbors.append(item_node)

itemKs_node.neighbors.append(item_node)

记录graph

a. node.id node.name node.type

b. node.id与邻近node.id列表

2.2 代码说明

random walk(随机游走)生成多个网络

walk = graph.build_deepwalk_corpus(G, args.number_walks, args.walk_length, alpha=0,rand=random.Random(0))

 word2vec训练

model = Word2Vec(walk, size=args.representation_size, window=args.window_size, min_count=0, workers=args.workers)

 测试集预测输出(rating,probability)

pr = [predict_rating(model, nodedict, "u"+g[0], "m"+g[1]) for g in groundtruth]

测试评估

cm = confusion_matrix(tr, [x for x,y in pr], labels=range(1,6))

考虑到召回排序概率输出,修改主函数predict_rating方法如下

def predict_rating(model, nodedict, user, movie):
    user_id = nodedict[user].id
    max_sim = -5
    rating = 1
    for i in range(1,6):
        mv_rating_id = nodedict[movie+ '_'+str(i)].id
        print(user_id + ' ' + mv_rating_id)
        sim = model.similarity(user_id,mv_rating_id)
        if sim > max_sim:
            max_sim = sim
            rating = i
    # print max_sim
    return rating,max_sim

3. 实验输出

在根目录下运行如下命令

python -m rec2vec --walk-length 2 --number-walks 2 --workers 4

输出结果

('pr:', [(5, 0.21816131), (4, 0.20109792), (5, 0.034278974), (1, 0.0817812), (1, 0.1895898), (4, 0.14069618), (4, 0.12413461), (1, 0.20211244), (4, 0.16178176), (1, 0.09314764), (5, 0.2
3614138), (4, 0.02361415), (4, -0.016169287), (1, 0.12822491), (5, 0.16889313), (1, 0.23871139), (1, 0.09779738), (5, 0.17009582), (2, 0.21155474), (2, 0.18502049), (5, 0.27953783), (5,
 0.100041725), (3, 0.07343325), (1, 0.08252329), (3, 0.26863274), (3, 0.34024507), (2, 0.103544936), (2, 0.11577217), (4, 0.15979269), (3, 0.30636942), (1, 0.25730887), (4, 0.061695002)
, (2, 0.20840712), (2, 0.13220808), (3, 0.23808427), (2, 0.14603713), (1, 0.11540766), (1, 0.13575834), (5, 0.059446838), (1, 0.07711147), (4, 0.14923696), (4, 0.2722487), (2, 0.2346659
9), (3, 0.19906865), (1, 0.14096469), (5, 0.14809427), (1, 0.27588558), (2, 0.049835917), (3, 0.22439061), (4, 0.26521543), (5, 0.084800266), (5, 0.22411942), (3, 0.08701491), (1, 0.276
06452), (3, 0.14768085), (4, 0.18523756), (5, 0.21913356), (4, 0.14610341), (2, -0.00232796), (1, 0.18832827), (4, 0.24060583), (1, 0.13566783), (2, 0.10522525), (2, -0.022895731), (2,
0.1528495), (2, 0.22059903), (1, 0.18788002), (3, 0.12985392), (5, 0.20362195), (2, 0.15624195), (5, 0.015708663), (4, 0.09150217), (1, 0.10535277), (5, 0.29844967), (4, 0.032513976), (
3, 0.04269788), (4, 0.21425033), (5, 0.2109319), (1, 0.04806234), (1, 0.03421749), (4, 0.09020723), (1, 0.1988868), (5, 0.084368914), (5, 0.13037832), (3, 0.2060321), (1, 0.18835515), (
3, 0.088122), (4, 0.10270446), (1, 0.00046277046), (4, 0.10155096), (2, 0.19855878), (4, 0.08657752), (3, 0.19608632), (3, 0.1202642), (1, 0.11801123), (2, 0.10863748), (3, 0.20957142),
 (1, 0.29679668), (1, 0.31492934), (5, 0.16466765), (4, 0.06138492), (2, 0.11375506), (2, -0.007489592), (2, 0.03196878), (3, 0.084200725), (4, 0.017001187), (1, 0.08951633), (3, 0.0839
5792), (3, 0.13884424), (3, 0.15994956), (4, 0.342631), (1, 0.18296947), (2, 0.14880049), (5, 0.2684232), (5, 0.051952906), (5, 0.18990274), (3, 0.12617008), (5, 0.18614042), (3, 0.0455
6681), (5, 0.27489257), (2, 0.2231451), (5, 0.26258737), (1, 0.19376503), (4, 0.08457033), (5, 0.123674154), (3, -0.0063731894), (3, 0.17616285), (2, 0.23088284), (1, -0.01068541), (3,
0.16207498), (5, 0.053388447), (5, 0.050843887), (1, 0.17820688), (5, 0.20822495), (5, 0.17167237), (2, 0.24977536), (4, 0.123614445), (1, 0.3075183), (3, 0.080922134), (1, 0.013895277)
, (3, 0.017329933), (1, -0.021159858), (3, 0.29671937), (5, 0.074710086), (3, 0.20030534), (2, 0.15873557), (1, 0.21483278), (3, 0.2165505), (3, 0.19273187), (5, 0.17925854), (2, 0.1507
6035), (3, 0.19059706), (1, 0.14070553), (5, 0.1775071), (1, 0.13031097), (5, 0.085311405), (4, 0.12753496), (1, 0.08845517), (2, 0.1353336), (4, 0.1441082), (5, 0.073139444), (3, 0.214
94135), (2, 0.02128306), (4, 0.1538286), (5, 0.23735538), (3, 0.19050908), (1, 0.08713859), (4, 0.13740018), (1, 0.12787805), (4, 0.17423905), (1, 0.19951484), (2, 0.13757001), (4, 0.03
1362798), (5, 0.12463115), (5, 0.2578966), (5, 0.21448083), (1, 0.18083008), (1, 0.28816417), (1, 0.24632607), (2, 0.30158502), (1, 0.31293115), (1, 0.094477326), (3, 0.115177415), (5,
0.14438748), (1, 0.27524439), (1, 0.1842051), (3, 0.19450381), (4, 0.35496825), (5, 0.09325806), (5, 0.19271731), (3, 0.08929752), (3, 0.0045700073), (4, 0.15969041), (4, -0.014291994),
 (3, 0.15290177), (2, 0.16745171), (1, 0.1293597), (2, 0.07012263), (4, 0.27942258), (1, 0.079426385), (2, 0.11384687), (2, 0.09437539), (5, 0.16971792), (1, 0.2036725), (4, 0.105627805
), (3, 0.2639934), (3, 0.20161262), (1, 0.21982545), (3, 0.22584116), (2, 0.31147254), (4, 0.19017792), (4, 0.09382077), (2, 0.19933856), (1, 0.26786482), (3, 0.25363925), (1, 0.1552078
), (3, 0.07694785), (1, 0.11198787), (3, 0.12250619), (4, 0.26072007), (1, 0.20808263), (4, 0.18883303), (2, 0.11193773), (3, 0.07373013), (1, 0.07577308), (3, 0.11675087), (3, 0.302308
9), (4, 0.054347187), (3, 0.22047992), (3, 0.14740135), (4, 0.1622066), (4, 0.04669784), (1, 0.15336086), (1, 0.24133927), (4, -0.0021706335), (4, 0.081205234), (1, 0.24734727), (1, 0.2
0000756), (4, 0.063037425), (1, 0.11106023), (1, 0.1734642), (4, 0.31718957), (3, 0.11896736), (3, 0.14219648), (2, 0.11649312), (2, 0.091636285), (5, 0.19646621), (3, 0.100293726), (2,
 0.37355578), (4, 0.30815482), (1, 0.03521269), (3, 0.31610578), (4, 0.071553566), (5, 0.06822196), (4, 0.030617476), (3, 0.11699201), (5, 0.18080503), (4, 0.21890192), (1, 0.07576093),
 (1, 0.20664755), (4, 0.11371016), (2, 0.23809673), (3, 0.16400945), (2, 0.26033786), (1, 0.14217708), (5, -0.00067877397), (1, 0.15977417), (2, 0.319161), (4, 0.2369632), (3, 0.0247773
45), (3, 0.22936185), (2, 0.04639913), (3, 0.22453552), (1, 0.18700382), (5, 0.07391004), (2, 0.16498145), (2, 0.1169599), (4, 0.30541867), (2, 0.19140558), (1, 0.16878137), (1, 0.18917
711), (2, 0.12884183), (1, 0.11587468), (5, 0.12812695), (4, 0.11499435), (5, 0.28076252), (4, 0.15078825), (4, 0.21074799), (3, 0.03541722), (5, 0.20991008), (4, 0.045722425), (2, 0.35
532284), (5, 0.057033926), (1, 0.18294954), (3, 0.21958742), (4, 0.100919805), (4, 0.06933588), (4, 0.016932681), (1, 0.09636212), (3, 0.15291478), (2, 0.1203253), (5, 0.102916986), (5,
 0.096363604), (4, 0.18717396), (1, 0.12784661), (5, 0.13674304), (1, 0.082834356), (2, 0.25134432), (3, 0.28607863), (5, 0.102933414), (2, 0.15709956), (3, 0.1754892), (1, 0.061570693)
, (2, 0.18702352), (5, 0.1885113), (1, 0.25197443), (1, -0.06756012), (4, 0.14790666), (4, 0.08924671), (2, 0.072606966), (1, 0.14800742), (1, 0.120617226), (4, 0.13691652), (3, 0.13947
365), (5, 0.1876937), (5, 0.14674154), (5, 0.032142762), (5, 0.006960973), (5, 0.1605773), (1, 0.21655774), (4, 0.19649123), (5, 0.16793214), (2, 0.29418632), (5, 0.17750135), (3, 0.112
22335), (1, 0.21497172), (5, 0.061423052), (2, 0.14069626), (3, 0.21288031), (5, 0.21811429), (2, 0.17711769), (5, 0.17799331), (3, 0.019438269), (4, 0.15911222), (5, 0.17638193), (5, 0
.22661248), (4, 0.0126395915), (3, 0.07078837), (5, 0.18787509), (2, 0.05199638), (2, 0.25011823), (3, 0.1890558), (1, 0.25685415), (3, 0.17848898), (1, -0.009719856), (4, -0.039005123)
, (5, 0.14849833), (3, 0.19349098), (5, 0.37085313), (2, 0.29527593), (1, 0.16922833), (2, 0.2932027), (1, 0.30389866), (2, 0.11634572), (3, 0.19545603), (4, 0.18068293), (1, 0.06132693
6), (3, 0.097818166), (1, 0.1206724), (3, 0.19063818), (2, 0.18082207), (3, 0.09661825), (5, 0.1800197), (3, 0.25451225), (4, 0.13649338), (4, 0.054450236), (1, 0.17042688), (4, 0.14862
82), (2, 0.058739893), (3, 0.15602693), (3, 0.097326234), (1, 0.07460761), (4, 0.14200494), (1, 0.14670196), (5, 0.10726295), (4, 0.07173052), (1, 0.14724214), (4, 0.048008144), (1, 0.1
807193), (2, 0.17268635), (4, 0.14584693), (2, 0.1275903), (5, 0.102712095), (1, 0.07129334), (2, 0.14147732), (4, 0.14394106), (5, 0.111515224), (2, 0.19245665), (3, 0.19533549), (4, 0
.1579197), (3, 0.15098171), (2, 0.13326493), (4, 0.19158895), (3, 0.03437779), (2, 0.13867405), (2, 0.11331645), (3, 0.12698722), (1, 0.03733074), (1, 0.097034216), (2, 0.18252902), (1,
 0.22841588), (1, 0.15631078), (3, 0.20651267), (5, 0.0695567), (3, 0.16345459), (2, 0.124408886), (2, 0.13388517), (2, 0.1424464), (1, 0.11532164), (5, 0.14926729), (2, 0.09753678), (2
, 0.07735514), (1, -0.041438695), (2, 0.13634747), (3, 0.09889061), (3, 0.21301061), (1, 0.25176686), (4, 0.008460121), (2, 0.10999752), (2, 0.11675982), (4, 0.018968707), (5, 0.1430986
), (5, 0.05575361), (5, -0.0052082017), (2, 0.1611993), (1, 0.18056107), (5, 0.119257554), (1, 0.11375291), (5, 0.12525466), (3, 0.0809456), (4, 0.07455471), (4, 0.25821656), (3, 0.2579
6527), (2, 0.1463536), (5, 0.1099333), (1, 0.14906903), (4, 0.11252696), (2, 0.0067453235), (3, 0.14177734), (5, 0.18845876), (5, 0.22354114), (5, 0.07709133), (3, 0.051935345), (4, 0.0
6109525), (4, 0.14686196), (1, 0.0640319), (4, 0.2518434), (2, 0.21182023), (3, 0.089264035), (5, 0.11324333), (3, 0.12506121), (5, 0.17711715), (5, 0.006076865), (2, 0.12242938), (4, 0
.07770117), (3, 0.20457771), (4, 0.08699021), (2, 0.2164577), (3, 0.105829604), (5, 0.060142342), (2, 0.10044432), (2, 0.07593567), (3, 0.203795), (1, 0.14981823), (2, 0.0767544), (5, 0
.14422897), (5, 0.09010744), (1, 0.15796687), (2, 0.030947387), (3, 0.12287019), (2, 0.104032904), (3, 0.1672854), (5, 0.044725325), (5, 0.15153967), (3, 0.11143564), (2, -0.095833436),
 (2, 0.06915021), (1, 0.313274), (4, 0.12510344), (5, 0.03319484), (3, 0.19324894), (5, -0.12448349), (5, 0.24207821), (1, 0.11015023), (4, 0.055411197), (3, 0.050641082), (1, 0.0657534
45), (1, 0.13163531), (1, 0.35598174), (1, 0.17307048), (5, 0.05728905), (5, 0.15256743), (2, 0.24028367), (3, 0.16901061), (2, 0.119202614), (2, 0.15047908), (3, 0.121857524), (5, 0.28
258538), (5, 0.12717947), (5, 0.15666166), (4, 0.18157263), (2, 0.11752444), (3, -0.12893867), (2, 0.14782679), (4, 0.2710132), (5, 0.07475789), (5, 0.15503684), (3, 0.21236882), (3, 0.
2285816), (5, 0.15899074), (3, 0.17930806), (5, 0.05748733), (5, 0.08455777), (2, 0.18876159), (2, 0.113560244), (5, 0.13441384), (3, 0.21320292), (5, 0.10615743), (5, 0.05991133), (1,
0.07553083), (2, 0.08952987), (4, 0.18125078), (4, 0.26526135), (1, 0.052370638), (5, 0.14682706), (5, 0.10558613), (4, 0.436755), (4, 0.23253432), (4, 0.059923217), (5, 0.14364381), (4
, 0.13304818), (3, 0.2792371), (4, 0.11398822), (1, 0.0027283374), (4, 0.07193121), (1, 0.1808818), (4, 0.049680114), (5, 0.19352789), (1, 0.09445676), (2, 0.045803107), (4, 0.0812491),
 (5, 0.044616953), (4, 0.20646554), (5, 0.15315384), (5, 0.11321557), (4, 0.15085855), (2, 0.066294976), (1, 0.17071514), (5, 0.10340521), (4, 0.101762734), (3, 0.111566365), (1, 0.3434
9093), (1, 0.17052014), (3, 0.105207846), (5, 0.18159007), (3, 0.18138061), (4, 0.057889596), (5, 0.2578139), (2, 0.023944482), (4, 0.0074856356), (5, 0.104918), (4, 0.3194982), (5, 0.2
2877651), (5, 0.053996988), (2, 0.18125774), (1, 0.118075214), (1, 0.13062117), (4, 0.12553525), (2, 0.039375566), (1, 0.090436175), (1, 0.103749014), (1, 0.051823214), (3, 0.06587759),
 (1, 0.22331354), (5, 0.09660363), (5, 0.07784081), (2, 0.11956377), (2, 0.1989904), (1, 0.13442518), (1, 0.25298834), (4, 0.08652968), (5, 0.03328624), (3, 0.16566142), (2, 0.15494113)
, (5, 0.2314096), (3, -0.0016691498), (2, 0.18187484), (2, 0.1551536), (3, 0.16754133), (5, 0.12389716), (4, -0.0193413), (4, 0.06419954), (2, 0.34322718), (3, 0.08649354), (2, 0.085514
51), (3, 0.19795784), (2, 0.13961516), (1, -6.246567e-05), (1, 0.22123852), (1, 0.05991626), (5, 0.25454617), (4, 0.2627213), (3, 0.25272122), (1, 0.23446661), (3, 0.12837774), (5, 0.12
509543), (1, 0.11492131), (1, 0.10460806), (2, -0.032336127), (5, 0.08164783), (4, 0.10789485), (3, 0.34308392), (3, 0.07487746), (1, 0.24572855), (2, 0.01855481), (3, 0.20625617), (5,
0.15533194), (4, -0.0027513802), (2, 0.09578468), (1, 0.11245113), (5, 0.12827215), (1, 0.3383854), (3, 0.0947983), (2, 0.08974339), (4, 0.15413098), (5, 0.28738454), (3, 0.1976165), (3
, 0.14459768), (1, 0.16415496), (3, 0.006493412), (3, 0.16446877), (4, 0.16152537), (4, 0.11341628), (1, 0.09779508), (2, 0.043013617), (1, 0.13965543), (2, 0.2265504), (2, -0.04922881)
, (3, 0.12429341), (5, 0.39905363), (3, 0.17065749), (2, 0.22624338), (3, 0.0695349), (5, 0.113958), (1, 0.27387333), (1, 0.1739932), (5, 0.13961138), (2, 0.029010288), (5, 0.12817231),
 (5, 0.09210054), (2, 0.14309181), (4, 0.0743984), (2, 0.1723716), (5, 0.15179282), (3, -0.0060843974), (3, 0.20345941), (1, 0.2654695), (3, 0.068751365), (4, 0.12793235), (4, 0.3146927
4), (5, 0.0861329), (5, 0.10623141), (4, 0.2877973), (5, 0.23571223), (2, 0.09697114), (2, 0.104443945), (2, 0.23917234), (2, 0.12633903), (2, 0.13321275), (2, 0.09391786), (4, 0.077377
35), (2, 0.075202376), (3, 0.05085279), (5, 0.08237587), (4, 0.08401398), (4, 0.18482375), (3, 0.1084384), (2, 0.108730815), (1, 0.19696066), (1, 0.03853216), (5, 0.1204455), (4, 0.1440
2586), (3, 0.10808208), (5, 0.2077719), (4, 0.13977401), (2, 0.24000598), (5, 0.12770563), (3, 0.17959732), (2, -0.015797958), (2, 0.21574944), (2, 0.04120606), (5, 0.20060825), (2, 0.0
5181527), (5, 0.12572594), (4, 0.1457076), (5, 0.23594429), (2, 0.19924097), (3, 0.22131689), (2, 0.06781016), (5, 0.0728882), (1, 0.2743342), (3, 0.327725), (5, 0.26241794), (5, 0.0929
3746), (1, 0.099945374), (5, 0.21663651), (4, 0.0010820553), (2, 0.10013774), (2, 0.14807904), (5, 0.01908806), (4, 0.19622293), (4, 0.18764102), (5, 0.1352438), (4, 0.015163317), (1, 0
.04345812), (2, 0.26539654), (3, 0.12682827), (5, 0.19988573), (2, 0.1227909), (3, 0.06895025), (5, 0.055395298), (5, 0.034197822), (3, 0.07114875), (5, 0.113323316), (2, 0.04375164), (
2, 0.13420644), (1, 0.11167153), (3, 0.12998104), (1, 0.19049409), (2, 0.07852906), (1, -0.020163395), (3, 0.10000369), (4, 0.23963374), (5, 0.029045127), (5, 0.2791002), (3, 0.19099182
), (4, 0.15396503), (3, 0.07847809), (3, 0.12811807), (4, 0.24272789), (1, 0.07055864), (5, 0.110551775), (2, 0.024080142), (4, 0.11631779), (1, 0.15951729), (2, 0.08298406), (3, 0.0527
42142), (5, 0.1922698), (1, 0.24001175), (4, 0.122754544), (1, 0.04046601), (4, 0.067693815), (4, 0.08886192), (2, 0.094204), (3, 0.2622779), (5, 0.13195685), (5, 0.112128116), (5, 0.23
344284), (1, 0.08422374), (1, 0.098976955), (1, 0.12915465), (3, 0.20014022), (2, 0.15162179), (3, 0.14853849), (2, 0.1613465), (2, 0.21542767), (5, 0.16992527), (5, 0.10140214), (4, 0.
10272836), (4, 0.18342108), (2, 0.08408554), (1, 0.20563407), (2, 0.13417605), (1, 0.107600525), (3, -0.012937576), (5, 0.14545831), (1, 0.14877093), (3, 0.15306875), (1, 0.08009188), (
5, 0.25879085), (3, 0.1930242), (4, 0.09779415), (5, 0.15513712), (3, 0.122762054), (5, 0.13898216), (2, 0.1231606), (1, 0.27521238), (4, 0.090109825), (1, 0.044761308), (1, 0.090590686
), (4, 0.012622148), (5, 0.1848656), (2, 0.18613426), (4, 0.06478113), (2, 0.30589893), (3, 0.07642689), (4, 0.1610907), (1, 0.22014768), (1, 0.12929447), (1, 0.07659802), (3, 0.1320208
3), (1, 0.15030253), (4, 0.26991358), (1, 0.25571746), (1, 0.2306928), (2, 0.16356678), (5, 0.15511099), (1, 0.10024691), (5, 0.18996009), (5, 0.15336898), (3, 0.063900106), (3, 0.05161
076), (5, 0.12362455), (4, 0.14349785), (2, 0.29415482), (5, -0.0070621707), (4, 0.0860431), (3, 0.04288929), (3, 0.18069243), (1, 0.265643), (3, 0.15393724), (1, 0.0075522885), (4, 0.2
5530675), (5, 0.1240942), (1, 0.17445038), (4, 0.07237303), (4, 0.24799836), (1, 0.18315437), (4, 0.17778847), (5, 0.117372155), (2, 0.15345854), (4, 0.2054658), (1, 0.06618585), (3, 0.
1715607), (5, 0.17025599), (5, 0.1595045), (4, 0.12006809), (4, 0.24124643), (1, 0.1427453), (2, 0.11503786), (5, 0.0487523), (2, 0.14652187), (4, 0.2252657), (1, 0.20099986), (5, 0.046
680827), (2, 0.14714055), (5, 0.1539109), (4, 0.12768804), (1, 0.11251433), (5, 0.033178747), (3, 0.14713132), (2, 0.042278446), (3, 0.08812003), (1, 0.039310224), (2, 0.031013194), (5,
 0.17718038), (4, 0.29755443), (1, 0.08322765), (3, 0.07892923), (3, 0.16796982), (2, 0.11792885), (4, 0.116056696), (2, 0.40670633), (2, 0.27048406), (3, 0.10031089), (3, 0.11465276),
(3, 0.07380904), (4, 0.13254686), (4, 0.2430579), (2, 0.110566735), (4, 0.04813756), (2, 0.29551733), (3, 0.26488847), (5, 0.20395921), (4, 0.21600206), (1, 0.12160916), (4, 0.052120045
), (2, 0.33898315), (1, -0.0032448098), (3, 0.23905142), (1, 0.07618111), (5, 0.03267646), (2, 0.06874159), (2, 0.29063818), (5, 0.16543098), (3, 0.12022896), (4, 0.209055), (2, 0.00146
59539), (2, 0.072825395), (5, 0.27890214), (3, 0.1220867), (1, 0.124684356), (2, 0.24095194), (4, 0.18473646), (1, 0.093583286), (1, 0.092360005), (1, 0.09005294), (2, 0.16628239), (3,
0.29856807), (4, 0.16826607), (2, 0.14787601), (3, 0.2472959), (1, 0.17855254), (4, 0.14217025), (3, 0.15582782), (4, 0.22187346), (2, 0.14980505), (3, 0.23822162), (3, 0.15156877), (2,
 0.1174627), (5, -0.0032343194), (3, 0.16754167), (2, 0.16212492), (1, 0.12489031), (1, 0.1967138), (5, 0.12983924), (2, 0.10037573), (3, 0.12491302), (5, 0.16547704), (2, 0.240613), (1
, 0.16573094), (1, 0.21509463), (3, 0.040487), (2, 0.18687136), (4, 0.046292502), (1, 0.1513547), (2, 0.30464783), (2, 0.2986117), (2, 0.27058536), (1, 0.14640157), (1, 0.25155795), (4,
 0.106762074), (4, 0.13508227), (1, 0.18353473), (4, 0.065017425), (1, 0.14370903), (1, 0.0038962737), (2, 0.18587212), (3, 0.026213203), (1, 0.18107156), (3, 0.16156611), (5, 0.1505110
3), (3, 0.22207579), (1, 0.112803526), (1, 0.1040376), (2, 0.114229575), (3, 0.16902901), (3, -0.057462692), (2, 0.39256313), (5, 0.14972827), (5, 0.29906476), (3, 0.068322904), (5, 0.1
3216779), (3, 0.22715554), (5, 0.0815461), (1, 0.22736375), (5, 0.27771103), (5, 0.034957897), (2, 0.14871803), (1, 0.11691217), (2, 0.13393404), (4, -0.028936455), (3, 0.30860788), (4,
 0.10357475), (3, 0.20798174), (1, -0.0474452), (3, 0.12271738), (1, 0.2723724), (1, 0.11151165), (5, 0.09096633), (3, 0.20159909), (3, 0.2000283), (1, 0.052937567), (3, 0.20235854), (5
, 0.108900875), (2, 0.37959832), (4, 0.03115445), (2, 0.15924211), (3, 0.09316775), (5, 0.087941945), (2, 0.2708606), (1, 0.1171788), (3, 0.097612195), (5, 0.26325476), (5, 0.15090244),
 (3, 0.21449164), (5, 0.18697836), (4, 0.18024513), (2, 0.08718211), (5, 0.186903), (4, 0.14059955), (2, 0.08843114), (5, 0.09739367), (5, 0.05075112), (4, 0.14817089), (3, 0.12001087),
 (1, 0.16025767), (1, -0.0016036965), (2, 0.20644133), (1, 0.20639752), (5, 0.043516584)])
MSE = 3.651830
accuracy = 0.197824
[[  6   3   6   1   5]
 [ 13  16  12  10  13]
 [ 44  41  51  51  52]
 [104  90  88  76  92]
 [ 49  49  43  45  51]]
 

参考资料

https://blog.csdn.net/weixin_39915444/article/details/80666037

https://blog.csdn.net/qq_26919935/article/details/76574845

https://blog.csdn.net/wolfblood_zzx/article/details/73088111

  • 2
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值