建设网站的心得体会,使用html做网站的网页,智加设计,甘肃网站开发公司案例实战需求之大数据下的用户画像标签去重
介绍 用户画像 英文为User Profile#xff0c;是根据用户基本属性、社会属性、行为属性、心理属性等真实信息⽽抽象出的⼀个标签化的、虚拟的⽤户模型。“⽤户画像”的实质是对 “⼈”的数字化。应⽤场景有很多#xff0c;比如个性…案例实战需求之大数据下的用户画像标签去重
介绍 用户画像 英文为User Profile是根据用户基本属性、社会属性、行为属性、心理属性等真实信息⽽抽象出的⼀个标签化的、虚拟的⽤户模型。“⽤户画像”的实质是对 “⼈”的数字化。应⽤场景有很多比如个性化推荐、精准营销、⾦融⻛控、精细化运营等等 举个例⼦来理解⽤户画像的实际应⽤价值我们经常⽤⼿机⽹购淘宝⾥⾯的千⼈千⾯通过“标签 tag”来对⽤户的多维度特征进⾏提炼和标识那每个⼈的⽤户画像就需要存储set集合就适合去重⽤户画像不⽌针对某个⼈也可以某⼀⼈群或⾏业的画像利⽤redis可以很好的去重 SpringBootTest
class XdclassRedisApplicationTests {Autowiredprivate RedisTemplate redisTemplate;Testpublic void userProfile(){BoundSetOperations operations redisTemplate.boundSetOps(user:tags:1);operations.add(car,student,rich,dog,guangdong,rich);SetString set1 operations.members();System.out.println(set1);operations.remove(dog);SetString set2 operations.members();System.out.println(set2);}
}
社交应用里面的知识关注、粉丝、共同好友案例
SpringBootTest
class XdclassRedisApplicationTests {Autowiredprivate RedisTemplate redisTemplate;/*** 社交应用*/Testpublic void testSocial(){BoundSetOperations operationsLW redisTemplate.boundSetOps(user:lw);operationsLW.add(A,B,C,D,E);System.out.println(老王的粉丝operationsLW.members());BoundSetOperations operationsXD redisTemplate.boundSetOps(user:xd);operationsXD.add(A,B,F,G,H,K,J,W);System.out.println(小d的粉丝operationsXD.members());//差集Set lwSet operationsLW.diff(user:xd);System.out.println(老王的专属用户lwSet);//差集Set xdSet operationsXD.diff(user:lw);System.out.println(小D的专属用户xdSet);//交集Set interSet operationsLW.intersect(user:xd);System.out.println(同时关注了两个人的用户interSet);//并集Set unionSet operationsLW.union(user:xd);System.out.println(两个人的并集unionSet);//判断A用户是不是老王的粉丝boolean flag operationsLW.isMember(A);System.out.println(A用户是不是老王的粉丝:flag);}
}