VK Friends recommendations: ML on ego graphs

Friendship is one of the most important mechanics of any social network. The vast majority of interactions occur between users who are friends: we see and comment on each other's posts in the feeds, go to the friends list to find acquaintances and write a message. This is why the growth of the social graph is so important.





My name is Zhenya Zamyatin, I work in the Core ML team on VKontakte. I want to tell you how the recommendations are arranged that bring users closer to the largest social network on the Russian Internet. 





Overview

, . โ€” ( ). . โ€” . . , โ€” , . โ€” .





, : k , . , , โ€” recall@k. : , .





, , . โ€” . . .





โ€” Adamic/Adar. , : ยซยป . , .





, . : VK. โ€” . , .





EGOML

Adamic/Adar. E(u, v)



, , u



v



. โ€” : ez_c(u, v)



.





ยซยป ez_c(u, v)



. , c



: ยซ , , u



v



, ?ยป , . , c



, : ยซ , , ยป. u



v



( c



) 1/log(n)



, n



โ€” . Adamic/Adar. c



?





, , ez_c(u, v)



c



. , . , . , E(u, v)



. E(u, v)



MapReduce:





  • . c



    , . , Adamic/Adar .





  • Map. ยซยป c



    , . , ez_c(u, v)



    (u, v) โ†’ ez_c(u, v)



    u, v in N(c)



    . Adamic/Adar: (u, v) โ†’ 1/log|N(c)|



    .





  • Reduce. (u, v)



    . , u



    v



    .





E(u, v)



. : , E(u, v) > 0



, โ€” u



v



.





Hopper's ego graph
-

c



ez_c



, . -. , - x



โ€” , x



x



, โ€” . - .





ez_c



, . c



, - u



, v



, :





  • u



    v



    - c



    ;





  • u



    c



    ;





  • v



    c



    ;





  • , u



    - - c



    ;





  • - c



    ;





  • .





. . T



. , T



, T + โ–ณT



. โ€” , , . : , , T



, , .





:





  • u



    v



    , c



    , - c



    ;





  • u



    v



    , ;





  • T



    ;





  • u



    v



    โ€” T



    .





ez_c



. pairwise , u



.

, ez_c(u, v)



. : pairwise- . , ez_c(u, v)



ยซยป , , E(u, v)



, . โ€” , E(u, v)



. :





. , . : - โ€” . . , , : u



, v



. : A



, u



, B



โ€” v



. :





, - . A



B



, . , - n



O(n^2)



O(n)



. , ? :





  1. , u



    v



    . , ยซ u



    v



    - c



    ยป .





  2. A



    , u



    , c



    - c



    .





  3. B



    v



    , c



    - c



    . A



    .





A



B



, : u



, โ€” v



. , B



ยซยป A



. . ez_c(u, v)



E(u, v)



:





E

, E(u, v)



:





โ€” , , โ€” . u



โ€” . 





. key-value . E(u, v)



. E(u, v)



.





EGOML :





  1. . O(|E|)



    , |E|



    โ€” . 250 .





  2. E(u, v)



    . O(|N(u)| + |N(v)|)



    .





  3. , ( , , ) . , , , , .





Adamic/Adar EGOML E(u, v)



. .





Core ML , Core ML โ€” .








All Articles