In [1]:
from gensim.models import AuthorTopicModel
model = AuthorTopicModel.load('model.atmodel')
C:\ProgramData\Anaconda3\lib\site-packages\gensim\utils.py:860: UserWarning: detected Windows; aliasing chunkize to chunkize_serial
warnings.warn("detected Windows; aliasing chunkize to chunkize_serial")
In [3]:
model.show_topics(num_topics=10)
Out[3]:
[(18,
'0.017*"el" + 0.014*"a" + 0.014*"mazo" + 0.013*"paso" + 0.012*"edomex" + 0.011*"ieem" + 0.010*"gobernador" + 0.009*"elección" + 0.009*"pan" + 0.007*"Del Mazo"'),
(12,
'0.026*"columna" + 0.010*"enlared" + 0.007*"vía" + 0.005*"venezuela" + 0.005*"fernando" + 0.004*"apoyar" + 0.003*"poesía" + 0.003*"TU VOZ" + 0.003*"notieress" + 0.003*"editor"'),
(9,
'0.007*"mesaparatodos" + 0.006*"we" + 0.005*"go" + 0.004*"vocesendirecto" + 0.004*"lipton" + 0.004*"fmi" + 0.004*"David Lipton" + 0.004*"obamacare" + 0.004*"espalda" + 0.004*"still"'),
(15,
'0.033*"laprimeramvs" + 0.009*"alaire_laprimeramvs" + 0.008*"yosoitu" + 0.006*"Pascual Castro" + 0.004*"antony" + 0.004*"carbonell" + 0.004*"Cristina Carbonell" + 0.003*"opiniónlsr" + 0.002*"freno" + 0.002*"femenina"'),
(10,
'0.015*"enfoque_noticias" + 0.006*"or" + 0.005*"excélsiorinforma" + 0.005*"its" + 0.004*"excélsiorinforma_excélsiortv" + 0.004*"sandoval" + 0.003*"Baja California Sur" + 0.003*"some" + 0.003*"down" + 0.003*"them"'),
(17,
'0.019*"despiertaconloret" + 0.018*"enfoque" + 0.016*"lasnoticiascondanielle" + 0.012*"audiontx" + 0.009*"videontx" + 0.007*"alaireconpaola" + 0.004*"interurbano" + 0.004*"vagón" + 0.003*"infografíantx" + 0.003*"dañan"'),
(1,
'0.081*"a" + 0.039*"y" + 0.022*"el" + 0.015*"méxico" + 0.009*"mil" + 0.008*"entérate" + 0.007*"cdmx" + 0.007*"años" + 0.006*"gobierno" + 0.005*"video"'),
(5,
'0.042*"the" + 0.033*"a" + 0.025*"to" + 0.023*"of" + 0.019*"in" + 0.014*"and" + 0.012*"is" + 0.009*"trump" + 0.008*"for" + 0.008*"it"'),
(0,
'0.038*"pri" + 0.017*"el_pri" + 0.017*"columna" + 0.016*"asamblea" + 0.013*"y" + 0.010*"epn" + 0.010*"el" + 0.009*"a" + 0.008*"escribe" + 0.007*"candados"'),
(16,
'0.075*"a" + 0.040*"el" + 0.036*"y" + 0.010*"video" + 0.008*"trump" + 0.008*"méxico" + 0.007*"norte" + 0.007*"eu" + 0.006*"corea" + 0.006*"corea_el"')]
In [4]:
aut_top = {}
for key, value in model.id2author.items():
aut_top[value] = model.get_author_topics(value)
In [5]:
aut_top
Out[5]:
{'ADNPolitico': [(16, 0.99929650810007709)],
'ActualidadRT': [(16, 0.99971426158086563)],
'Adela_Micha': [(2, 0.99550011550942041)],
'Amsalazar': [(2, 0.99311653655557697)],
'AnaPOrdorica': [(18, 0.99702327433593396)],
'AristeguiOnline': [(7, 0.99960485729453841)],
'AztecaNoticias': [(14, 0.99873227708280488)],
'Canal22': [(2, 0.99910215267298641)],
'CanalOnceTV': [(6, 0.9981340187304123)],
'CarlosLoret': [(17, 0.99050695173763437)],
'CiroGomezL': [(5, 0.99896284724184703)],
'DeniseDresserG': [(5, 0.99878556471165814)],
'DeniseMaerker': [(2, 0.99920302349447487)],
'DiegoEOsorno': [(0, 0.14999666910894646),
(8, 0.14999705419968132),
(13, 0.14999719492515337),
(15, 0.14999708595593339),
(16, 0.29285363591085511)],
'E_Q_': [(1, 0.091824800570482673),
(2, 0.027273594297190385),
(6, 0.21067892517508072),
(7, 0.3797903686329398),
(14, 0.034884057604243242),
(16, 0.1832342347084242),
(19, 0.055287684101352895)],
'EfektoNoticias': [(1, 0.18564323882958397),
(2, 0.059747015749215204),
(3, 0.052717737469838093),
(5, 0.060055718837340732),
(6, 0.047198422272772475),
(7, 0.11864437114851543),
(14, 0.027438953267363394),
(16, 0.12488245997421815),
(18, 0.014906303380322698),
(19, 0.30374408679219189)],
'EjeCentral': [(1, 0.099923812102874557),
(2, 0.072537967905715872),
(3, 0.02018708686409101),
(7, 0.24358821950672793),
(14, 0.089549682303683778),
(16, 0.1926993222004485),
(18, 0.01835065152165568),
(19, 0.25660648207470027)],
'ElFinanciero_Mx': [(1, 0.10284949996232538),
(2, 0.047218000045037553),
(5, 0.094117373336345206),
(7, 0.10651024581189231),
(14, 0.039770714841465167),
(16, 0.26860707276130191),
(18, 0.019773139745941772),
(19, 0.30191493391257612)],
'ElHuffPost': [(0, 0.013029119956858366),
(1, 0.04173357809330714),
(2, 0.01158952274738256),
(6, 0.029619624539321016),
(7, 0.16052413413983277),
(12, 0.017103355813380537),
(14, 0.037829954623840499),
(16, 0.28740297206507487),
(19, 0.39209494018810975)],
'El_Universal_Mx': [(1, 0.18557445068496289),
(2, 0.2052159755448105),
(3, 0.025287528102209706),
(5, 0.084258796216968315),
(6, 0.022831236116206386),
(7, 0.084497565673614439),
(10, 0.19297688395939072),
(14, 0.022579665923064825),
(16, 0.11088384771702896),
(18, 0.065162022861669527)],
'EnfoqueNoticias': [(1, 0.10940968718950568),
(2, 0.037776054276459609),
(5, 0.017415066279582645),
(6, 0.055538644686016922),
(7, 0.24852310174610975),
(10, 0.20875023876853807),
(14, 0.018977081248131727),
(16, 0.085205909518182382),
(17, 0.10359801975069677),
(18, 0.10888885028236259)],
'Excelsior': [(1, 0.042391685457805792),
(2, 0.21894115162664601),
(5, 0.034026528530283498),
(6, 0.11374685175014522),
(7, 0.22873211743347491),
(10, 0.066561483475176181),
(14, 0.042586851700056876),
(16, 0.14387484615920879),
(18, 0.10756994365962426)],
'ExpansionMx': [(0, 0.010985314507198073),
(1, 0.15776948053720261),
(2, 0.093184084898080305),
(3, 0.055739324695470265),
(6, 0.036034096738034038),
(7, 0.10891942117424119),
(14, 0.059622950957282012),
(16, 0.45955953579263431),
(17, 0.011542149040730901)],
'FedericoArreola': [(0, 0.17422079722808836),
(1, 0.020172099856251215),
(2, 0.12058514150001849),
(3, 0.11641414846297417),
(5, 0.01735291188676311),
(6, 0.23040459465377786),
(7, 0.15163104565847901),
(14, 0.094863726879767504),
(16, 0.072402828859375809)],
'FernandoDworak': [(0, 0.034256824764461596),
(1, 0.12177247180388244),
(2, 0.087165957242482106),
(5, 0.1008565823275456),
(6, 0.022728773606036763),
(7, 0.077247474887853926),
(11, 0.1897854465630687),
(14, 0.015991851157370757),
(16, 0.33790813642106843)],
'Foro_TV': [(0, 0.012977926154936807),
(1, 0.20978968085162966),
(2, 0.24445957785524441),
(4, 0.094552672047578015),
(6, 0.0259479116193751),
(7, 0.19690488042082549),
(14, 0.020613673780226757),
(16, 0.078207624295753342),
(18, 0.061350314070729092),
(19, 0.03602315730797042)],
'Imagen_Mx': [(1, 0.12492261532867097),
(2, 0.062536490929950866),
(4, 0.32573940500427379),
(6, 0.28018557722987425),
(7, 0.048369107503186612),
(16, 0.079133805102336946),
(19, 0.070545664791315937)],
'J_Fdz_Menendez': [(0, 0.15448920063933155),
(1, 0.031473664268349744),
(2, 0.26728489183186732),
(5, 0.061335091715856598),
(6, 0.020984307724039954),
(7, 0.03821745124920968),
(14, 0.012132115409068863),
(16, 0.38448589331043431)],
'JavierSolorzano': [(0, 0.068158793965872044),
(1, 0.031798818203748677),
(2, 0.23374230628849468),
(5, 0.06263614640546343),
(6, 0.22811381969844047),
(7, 0.14942822468751876),
(11, 0.1106967037167837),
(14, 0.078725170113893544),
(16, 0.033873176305158445)],
'JohnMAckerman': [(2, 0.042795291263658573),
(4, 0.081947705362074449),
(5, 0.047243129546055786),
(6, 0.077156276346078523),
(7, 0.13340361184239513),
(8, 0.053209020010714404),
(14, 0.078848678997669883),
(16, 0.23498722938618968),
(18, 0.24133642127101895)],
'JoseCardenas1': [(0, 0.071239857537134035),
(1, 0.087739778609409),
(2, 0.048054056960719981),
(5, 0.076738746577094022),
(6, 0.015789681397042274),
(7, 0.25163466154980452),
(14, 0.10702276895246937),
(16, 0.18016446153522891),
(18, 0.15271753826502102)],
'LaRazon_mx': [(0, 0.011952749577630933),
(1, 0.21598438972660014),
(2, 0.059332994926205862),
(3, 0.04683779264809057),
(5, 0.017230470197783569),
(6, 0.029591479480798089),
(7, 0.32635955735642769),
(13, 0.013769167541925042),
(14, 0.09832999586001355),
(15, 0.031783094803180728),
(16, 0.12378032527344533),
(17, 0.015041188887813218)],
'LeonKrauze': [(1, 0.02652331743601169),
(2, 0.047796744596468897),
(3, 0.034528950624640883),
(5, 0.35587840800614412),
(6, 0.037664015080410881),
(7, 0.02779139970694702),
(14, 0.014561537845041017),
(15, 0.25082092309933396),
(16, 0.17593101629964467),
(19, 0.012328445932080897)],
'LeonardoCurzio': [(0, 0.078867340234902703),
(1, 0.16806599335411238),
(2, 0.031789302685637691),
(5, 0.14731862527325557),
(6, 0.018033924693447962),
(7, 0.1787871505624625),
(12, 0.13221257509339648),
(16, 0.1699902450849948),
(18, 0.061389518848548388)],
'LuisCardenasMx': [(1, 0.11691145898612866),
(2, 0.031836286866428247),
(5, 0.038408424594382547),
(6, 0.29303028206234011),
(7, 0.2016633161208467),
(14, 0.011964135651671088),
(15, 0.1859111389501274),
(16, 0.10740736644087386),
(18, 0.010975894896860476)],
'MarioBeteta': [(0, 0.088532660636570767),
(1, 0.085087414279801737),
(2, 0.054956783653605179),
(5, 0.10074861356160164),
(6, 0.2025093744570643),
(7, 0.29077245582170835),
(14, 0.036555058899941976),
(16, 0.10765941190322123),
(18, 0.032174784158232113)],
'MexicanTimes': [(1, 0.18263841909926226),
(2, 0.10534936827333828),
(3, 0.057108809069698847),
(5, 0.050204126021387872),
(6, 0.044342971311795425),
(7, 0.090715139978320106),
(14, 0.065343530572233466),
(15, 0.060874028425340114),
(16, 0.22906394183837586),
(18, 0.067175514713026907),
(19, 0.045373048602784911)],
'Milenio': [(0, 0.022840662271347061),
(1, 0.11232384859180033),
(2, 0.041650671622116699),
(5, 0.011893786253351716),
(7, 0.087418317037074991),
(12, 0.011837045043243562),
(13, 0.010202783984973341),
(14, 0.39011236944929462),
(16, 0.16236418669092434),
(18, 0.040866544592756918),
(19, 0.098572701642200888)],
'NTelevisa_com': [(1, 0.1196202172095821),
(2, 0.075854549185688236),
(5, 0.043776805649850578),
(6, 0.069177861132451973),
(7, 0.10504547840277238),
(14, 0.053632566156120894),
(16, 0.25725533825836405),
(17, 0.087909331943413244),
(18, 0.16622501742520868),
(19, 0.020986517378956942)],
'NoticiasMVS': [(0, 0.02782512976586678),
(1, 0.08705985006385622),
(2, 0.12591172186934843),
(5, 0.011678127836325417),
(6, 0.16287205335794314),
(7, 0.27985587140224966),
(9, 0.062102821289151566),
(13, 0.030698248996255201),
(14, 0.033776669347100045),
(16, 0.10320951862678565),
(18, 0.074331164800611124)],
'Notimex': [(1, 0.13765539468416138),
(2, 0.13370829680318322),
(5, 0.043447884832275012),
(6, 0.092593253544827642),
(7, 0.17132534560682416),
(13, 0.076342197373044041),
(14, 0.17860492694808572),
(16, 0.06131863623158549),
(17, 0.044888675180336832),
(18, 0.012618449394744101),
(19, 0.034030771413404631)],
'PPmerino': [(0, 0.041330954998126272),
(1, 0.12543367991625842),
(2, 0.063618504469708459),
(5, 0.13873555474613117),
(6, 0.027462735031499787),
(7, 0.091811718171128556),
(10, 0.014914948425274452),
(11, 0.19798085247409755),
(14, 0.01735552164116452),
(16, 0.16355359015918591),
(18, 0.043034528259854411),
(19, 0.063754404167081266)],
'PabloHiriart': [(0, 0.1726553955608788),
(1, 0.1068726104707641),
(2, 0.047983282616022353),
(3, 0.011632421966915921),
(7, 0.10599595860971901),
(12, 0.28603341568629809),
(14, 0.034568326262259336),
(16, 0.084916676610737304),
(18, 0.052792468339018413),
(19, 0.08683003205186382)],
'Pajaropolitico': [(1, 0.20923628323173873),
(2, 0.056202016669082748),
(3, 0.01639123420491485),
(5, 0.011740200790682451),
(6, 0.044417258187482107),
(7, 0.088127602304113442),
(10, 0.1135111176619579),
(14, 0.068932786088289941),
(16, 0.19371950042628786),
(17, 0.04779253736198627),
(18, 0.066497310531997839),
(19, 0.072151179767824578)],
'PaolaRojas': [(1, 0.28229873505725167),
(2, 0.1817616891370423),
(5, 0.034926867114397853),
(7, 0.24899869683534961),
(14, 0.072348955879563137),
(16, 0.097774936589986386),
(17, 0.03277090801626785),
(18, 0.027173710839664047),
(19, 0.013066038030222826)],
'PedroFerriz': [(1, 0.15796273069950323),
(2, 0.079052174611240714),
(5, 0.069799926763503314),
(6, 0.23651213327308812),
(11, 0.22497325272719082),
(14, 0.020417098049440932),
(16, 0.17387827736777589)],
'Pizu': [(0, 0.080696386662442304),
(1, 0.11698957565925475),
(2, 0.17530310653386078),
(5, 0.069204659535816462),
(6, 0.17103371407207243),
(9, 0.32240991150704057),
(19, 0.045303749100535765)],
'PublimetroMX': [(1, 0.11281121543738669),
(2, 0.11340993293715952),
(6, 0.054534357188620326),
(7, 0.17886493131299674),
(9, 0.021425817878681478),
(14, 0.21371540947602566),
(16, 0.12525835275986921),
(17, 0.018034322952922104),
(18, 0.067097823665911813),
(19, 0.080410022139770249)],
'Radio_Formula': [(0, 0.14189431513493572),
(1, 0.078532622190870066),
(2, 0.047234030327009381),
(5, 0.09707693926339156),
(6, 0.28959100827458678),
(7, 0.15840459399575077),
(16, 0.088622912699139009),
(18, 0.057007493241100951),
(19, 0.013669182693836376)],
'Reforma': [(1, 0.11126292477314706),
(2, 0.084566294417128637),
(5, 0.039446667591026149),
(6, 0.029281503839449823),
(7, 0.1516850124634806),
(11, 0.11283254396852876),
(14, 0.04586682126085663),
(16, 0.26389083189634943),
(18, 0.1395341153866039)],
'Reporte_Indigo': [(1, 0.30462511839115253),
(2, 0.11015114658287178),
(5, 0.015795282986989109),
(6, 0.02382610072172214),
(7, 0.074792721888792796),
(8, 0.18393480500379994),
(14, 0.0327468827860872),
(16, 0.12320293863951982),
(18, 0.023227771279157271),
(19, 0.096976122890637909)],
'RicardoAlemanMx': [(0, 0.13218652314585935),
(1, 0.094581724131744205),
(2, 0.15311694836419734),
(5, 0.063545737475707492),
(6, 0.042469306419974012),
(7, 0.11309635187137826),
(8, 0.25029695712803679),
(10, 0.025356597429445016),
(14, 0.032900421857603571),
(16, 0.06556827021657953),
(19, 0.017141834619744882)],
'RoyCampos': [(0, 0.028839709040845148),
(1, 0.10869728930309613),
(2, 0.096556263722137367),
(3, 0.10197875013141056),
(5, 0.024662504564460452),
(6, 0.052705697830042815),
(7, 0.12123002341060023),
(9, 0.16696352340334031),
(14, 0.031448914137353089),
(16, 0.10925236454904015),
(19, 0.156086395694705)],
'SGarciaSoto': [(0, 0.36152276290195096),
(1, 0.015006645509582301),
(2, 0.13398787064931877),
(5, 0.022102949412786958),
(6, 0.15425808119217588),
(7, 0.13163220188006433),
(16, 0.061298042926188241),
(18, 0.098773768629298861),
(19, 0.017477191730095036)],
'SalCamarena': [(0, 0.22392393926389059),
(1, 0.064140446250543298),
(2, 0.025736089391026822),
(3, 0.027757831496481509),
(5, 0.0617714597775001),
(6, 0.098295507938644028),
(7, 0.09071330201346868),
(8, 0.016318342079668011),
(14, 0.12212025018371986),
(18, 0.21089665580223707),
(19, 0.048708086663394407)],
'SanjuanaMtz': [(0, 0.13910972482576658),
(1, 0.10239384438396819),
(2, 0.098326711034073144),
(5, 0.019799195309702637),
(6, 0.079005076722190121),
(7, 0.13594450067100528),
(12, 0.13396087765498263),
(14, 0.032086559140687018),
(15, 0.024998273061923582),
(16, 0.12602801455669424),
(18, 0.079671799502341309),
(19, 0.0114460509455564)],
'SergioSarmiento': [(0, 0.014142247024298756),
(1, 0.14512944786943974),
(2, 0.073011286973895306),
(5, 0.068767066157769369),
(6, 0.046072991133578885),
(7, 0.048360152925685872),
(9, 0.27680175045768063),
(12, 0.01230522051524449),
(14, 0.02486712262761406),
(16, 0.17506477690077385),
(17, 0.032180842832843781),
(18, 0.028760977528696677),
(19, 0.04370463784401047)],
'SinEmbargoMX': [(0, 0.067569590117879455),
(1, 0.19147840023307089),
(2, 0.10646451845375095),
(3, 0.054146591205804735),
(5, 0.026686386593705012),
(6, 0.012902656757617152),
(7, 0.050840134664564191),
(9, 0.094018732048500045),
(14, 0.027529919922158017),
(16, 0.26933726866878238),
(17, 0.014189904182918586),
(18, 0.041928127168052741),
(19, 0.033032420897001764)],
'TapiaFernanda': [(1, 0.078260489960363944),
(2, 0.055402591026324589),
(3, 0.13932334149540276),
(4, 0.10684987257903236),
(5, 0.058104009684491413),
(6, 0.023994737816299117),
(7, 0.075992282532280866),
(16, 0.45119221266671844)],
'UnoNoticias': [(0, 0.087698484842425511),
(1, 0.12907586644345548),
(2, 0.089499643477061588),
(5, 0.045993697336892),
(6, 0.061101933300391195),
(7, 0.11704038860912527),
(8, 0.019208281260459897),
(14, 0.16363554753386608),
(16, 0.21782548190887424),
(18, 0.050812780976279316),
(19, 0.017733139243643614)],
'VILLALVAZO13': [(0, 0.013930590825874726),
(1, 0.13275714808724359),
(2, 0.12494990382631815),
(5, 0.031764464142535705),
(6, 0.038228186652540963),
(7, 0.23045411567158236),
(8, 0.015299142303163064),
(10, 0.14825140742453971),
(11, 0.027691298687860497),
(14, 0.047479131374385343),
(16, 0.12388714758262866),
(19, 0.054134410586210366)],
'WRADIOMexico': [(1, 0.10566516766202716),
(2, 0.14504706323312916),
(3, 0.01022837243017613),
(4, 0.22048970871559184),
(5, 0.011126829798075758),
(6, 0.05614866506046215),
(7, 0.10103007656570215),
(14, 0.11438179657985581),
(16, 0.16224575990443438),
(19, 0.066144066828439527)],
'Yoinfluyo': [(0, 0.035703294269675744),
(1, 0.13612073564041052),
(2, 0.016912521082463678),
(5, 0.023718639684849486),
(6, 0.052333711287413667),
(7, 0.10439125931503904),
(12, 0.26713479528760392),
(16, 0.28500480200504313),
(18, 0.054733487887121506)],
'YuririaSierra': [(0, 0.12654743985295938),
(1, 0.084741185291164006),
(2, 0.2059744074814569),
(4, 0.066030888655487924),
(5, 0.014407758476729215),
(6, 0.10438151614935734),
(7, 0.14103363993810253),
(11, 0.057054043578852374),
(12, 0.10311893184008505),
(16, 0.044527435218799254),
(18, 0.029667930994555485),
(19, 0.01984656165038708)],
'aguilarcamin': [(12, 0.99177709489430699)],
'ahope71': [(0, 0.98987405636644421)],
'alvaro_delgado': [(8, 0.98892813691891568)],
'andreslajous': [(16, 0.98469840710580425)],
'arturoangel20': [(3, 0.99361070468924773)],
'beltrandelrio': [(6, 0.99737682329578925)],
'carloselizondom': [(13, 0.84166666394249789)],
'carlosramirezh': [(0, 0.99788960803974436)],
'diario24horas': [(0, 0.01002062895882834),
(1, 0.26188714265549795),
(2, 0.092043470690457499),
(6, 0.021161652391851155),
(7, 0.1352941068742976),
(13, 0.24154811020323069),
(14, 0.099817312644455716),
(16, 0.097946023229237039),
(18, 0.032452386196183958)],
'dmorenochavez': [(0, 0.08004823228843766),
(1, 0.13572157465223988),
(2, 0.093664362521096167),
(3, 0.13772409353806594),
(5, 0.057110758930602315),
(6, 0.063788224863102219),
(7, 0.04214407735134016),
(12, 0.02425712855034939),
(15, 0.20134806396342822),
(16, 0.16146980553441168)],
'el_pais': [(0, 0.01795690721715627),
(1, 0.1544993460599175),
(2, 0.079624129699610122),
(3, 0.03719703130309749),
(5, 0.016490579639147684),
(6, 0.033454891011777524),
(7, 0.018266403337368963),
(10, 0.21474734150251609),
(14, 0.15567150898932564),
(16, 0.23841280394978706),
(18, 0.010351480821739742),
(19, 0.023150574972770066)],
'eleconomista': [(1, 0.14129780778376866),
(2, 0.10254247167542961),
(3, 0.024542854984058761),
(5, 0.013070254413454638),
(6, 0.042291485838279574),
(7, 0.2748151809755372),
(9, 0.24503370360786561),
(14, 0.051981625511686919),
(16, 0.09957451147365394)],
'elsolde_mexico': [(0, 0.079454146253583158),
(1, 0.201373135087866),
(2, 0.071184610525095213),
(5, 0.11397189148536263),
(6, 0.12815115408753974),
(7, 0.12528686882402643),
(12, 0.095413821773994961),
(14, 0.036879193079235616),
(16, 0.14759389784031227)],
'epigmenioibarra': [(1, 0.12467544259930811),
(2, 0.066022074871755876),
(5, 0.25800699067535088),
(6, 0.1263289988757727),
(8, 0.2644760618742652),
(14, 0.094748585163973817),
(16, 0.054421127627964271)],
'esquivelgerardo': [(0, 0.11616215665644811),
(2, 0.085739961113137045),
(5, 0.019665575548188746),
(6, 0.46092699599347714),
(7, 0.23167145129206126),
(16, 0.053357445350538518),
(18, 0.020725167416596118)],
'estarc62': [(1, 0.09344028538612642),
(2, 0.16167853538426372),
(5, 0.025120491945157575),
(6, 0.30803375621339313),
(7, 0.1378585716343014),
(10, 0.01059525713235443),
(12, 0.2210404263182098),
(19, 0.033040068068869478)],
'genarolozano': [(1, 0.091379031263474533),
(2, 0.12797857664138321),
(5, 0.038639182865919178),
(6, 0.2112206013639544),
(7, 0.10395314763450098),
(11, 0.21768138814949531),
(16, 0.14896163676009122),
(18, 0.035562605639261433),
(19, 0.015815920221097162)],
'hdemauleon': [(0, 0.026020210607816976),
(1, 0.19533459692903185),
(2, 0.11104072832866232),
(3, 0.01000250039221698),
(4, 0.18255419315107488),
(5, 0.061022869098649547),
(6, 0.081311145013864383),
(7, 0.030091336639893308),
(14, 0.036087660995295007),
(16, 0.18125829574033123),
(18, 0.077435524342325895)],
'informador': [(0, 0.02025084486703313),
(1, 0.16210714818631639),
(2, 0.071932922332886423),
(4, 0.15691642389743704),
(6, 0.034786901476929519),
(7, 0.18004364039388318),
(14, 0.098415952465478476),
(16, 0.20990403866864402),
(18, 0.02135865104476331),
(19, 0.033554320876730499)],
'jairocalixto': [(1, 0.1707420237308927),
(2, 0.0264407447453247),
(3, 0.023333261918343562),
(5, 0.057334454934745566),
(6, 0.12674634094076823),
(7, 0.084043341068993666),
(11, 0.30947563110983239),
(14, 0.11398727112111166),
(16, 0.079451445182956326)],
'javieraparicio': [(0, 0.16539114698440485),
(4, 0.27690366154789725),
(6, 0.1086919819058155),
(7, 0.031309476671971273),
(14, 0.047382092643039997),
(16, 0.32593734842830729),
(19, 0.02722894077597502)],
'jenarovillamil': [(0, 0.010741703446219934),
(1, 0.17568221143675225),
(2, 0.11080427579433437),
(4, 0.089935951290862834),
(5, 0.038925161200744338),
(6, 0.032977036618901882),
(7, 0.23286481376986345),
(14, 0.094644391306782746),
(16, 0.18904134046656842),
(17, 0.012607318800867108)],
'jorgeramosnews': [(1, 0.18022159276831065),
(4, 0.11528187182615431),
(5, 0.13234262669896887),
(12, 0.39899446389682142),
(14, 0.14429121362383956)],
'jrisco': [(1, 0.062995086083667898),
(2, 0.034244136119052679),
(3, 0.03493806809378544),
(5, 0.48054140389934569),
(6, 0.084566573097982253),
(7, 0.067112766651962433),
(14, 0.103950455524515),
(16, 0.058354602928984103),
(19, 0.063960405305633711)],
'jshm00': [(1, 0.054618262617965152),
(5, 0.46406639583250314),
(6, 0.1056580845588954),
(7, 0.040921096222737638),
(11, 0.26101611226033661),
(16, 0.037999668721533174),
(19, 0.023439749246051404)],
'julioastillero': [(0, 0.063963684412440699),
(1, 0.021519858947806218),
(2, 0.016530691906071839),
(5, 0.093815894685736381),
(6, 0.075425520204373736),
(7, 0.24637068140937468),
(11, 0.15952151020128391),
(14, 0.17612626169303724),
(16, 0.14318535305513785)],
'karlaiberia': [(1, 0.038191098213462289),
(2, 0.20985212576048598),
(4, 0.22422312674177985),
(5, 0.13753842598808896),
(6, 0.045291299350704868),
(7, 0.081151901793096948),
(14, 0.011732232572934464),
(16, 0.21063690025409956),
(18, 0.025029733929602969)],
'kdartigues': [(2, 0.39239464848800831),
(5, 0.071709490036699769),
(7, 0.084564231718226815),
(10, 0.056756837869209875),
(11, 0.23440852936828122),
(15, 0.056756838194999965),
(17, 0.065788302320697795)],
'lacronicadehoy': [(1, 0.10131966008653864),
(2, 0.071293755689108979),
(5, 0.020055231198749749),
(6, 0.035175871830788005),
(7, 0.19653077529863358),
(12, 0.16310304477913773),
(14, 0.099452352657117687),
(16, 0.1765305491186214),
(18, 0.096098603157903723),
(19, 0.03555704672683771)],
'lajornadaonline': [(0, 0.017754076787516473),
(1, 0.18829811208930963),
(2, 0.13253282102216268),
(5, 0.047602494164894246),
(7, 0.12953956598439292),
(14, 0.065257600809593697),
(16, 0.19702028932188434),
(17, 0.21136338535161148)],
'lasillarota': [(1, 0.26264775333363227),
(2, 0.059697827175289056),
(6, 0.04196716575007195),
(7, 0.1243593847292515),
(13, 0.010310027212245942),
(14, 0.056327533300413395),
(15, 0.13763652639067223),
(16, 0.27642501982518786)],
'lopezdoriga': [(0, 0.025714291874339358),
(1, 0.2814803406795226),
(2, 0.066809405336680894),
(5, 0.039230421858205786),
(6, 0.018703780195260065),
(7, 0.13346577287551495),
(14, 0.027914700895860897),
(16, 0.36308072560366766),
(18, 0.043301347924593656)],
'lydiacachosi': [(0, 0.029804259440761083),
(1, 0.09197065859854181),
(2, 0.052284988079077284),
(5, 0.13886344090658009),
(6, 0.19841531849188579),
(7, 0.12729389417585296),
(15, 0.31914439589943516),
(16, 0.01724029844187407),
(18, 0.012359120125090758)],
'macariomx': [(0, 0.033468201730933671),
(1, 0.017378359110498547),
(2, 0.035552343520950894),
(3, 0.036514128789869212),
(5, 0.4001656447396838),
(6, 0.018884287687054541),
(7, 0.049238103985772608),
(9, 0.31062294506087451),
(16, 0.083827650808965606)],
'mariocampos': [(0, 0.17444412965378717),
(1, 0.040267371077039704),
(2, 0.10570172958599587),
(6, 0.091938780709424239),
(7, 0.26118579411175713),
(16, 0.068292723435038019),
(17, 0.24718711329714069)],
'mileniotv': [(0, 0.023407597199884281),
(1, 0.15816437329379668),
(2, 0.099856579203703097),
(5, 0.022854690163690607),
(6, 0.1432530271963996),
(7, 0.070245313620947103),
(8, 0.018005416317871836),
(13, 0.055226183221824869),
(14, 0.27078679629739733),
(16, 0.1244036991049583)],
'nacholozano': [(1, 0.1059306050402687),
(2, 0.050112258163444973),
(5, 0.15589576958065229),
(6, 0.068229361407546318),
(7, 0.15445747848518793),
(13, 0.26476419853187694),
(14, 0.038748002804066817),
(16, 0.032019410365894112),
(18, 0.11010824075795059),
(19, 0.014831557320519419)],
'nexosmexico': [(0, 0.021117372314896361),
(1, 0.086301028673665195),
(2, 0.055932240345408009),
(6, 0.0592629280802143),
(7, 0.12420601544027186),
(10, 0.01331338372690301),
(12, 0.3643739164496525),
(13, 0.021347939724196203),
(14, 0.057854317124571397),
(16, 0.11892863391313625),
(17, 0.021642947925187665),
(18, 0.051335255320117783)],
'nytimes': [(2, 0.027378468731653179),
(3, 0.010085926642470815),
(5, 0.74038683747560052),
(7, 0.014357063998434243),
(9, 0.010943487937304206),
(10, 0.018349171767471688),
(13, 0.14330875404074156),
(16, 0.010512811706756057)],
'panchogarfias': [(1, 0.3225216646918696),
(6, 0.26146344925103671),
(10, 0.10306213108152226),
(16, 0.23903945577958166)],
'politicomx': [(0, 0.10566548108901722),
(1, 0.18679394753202108),
(2, 0.071505662571832787),
(5, 0.054058472606430458),
(6, 0.013205171108336041),
(7, 0.25294309679664523),
(10, 0.011135888846846098),
(14, 0.046088527615783803),
(16, 0.17478071987334254),
(18, 0.068870094297892523),
(19, 0.014406858365065375)],
'puigcarlos': [(0, 0.48085820087292952),
(3, 0.035965884180388409),
(6, 0.047100781063970393),
(7, 0.052158047476694384),
(11, 0.057667296822059365),
(18, 0.22704030790750493),
(19, 0.076549498773552382)],
'revistaproceso': [(0, 0.012028385317287294),
(1, 0.13946050152324388),
(2, 0.079333007070849004),
(3, 0.014197812710871689),
(6, 0.050226614310107984),
(7, 0.31321800440591063),
(12, 0.082299044812956551),
(14, 0.038828004127029747),
(16, 0.12390612354325745),
(18, 0.10234096306500604),
(19, 0.030513255925664343)],
'rivapa': [(0, 0.21744184301689126),
(1, 0.16006495520767591),
(2, 0.041882752215231148),
(5, 0.063257438276537917),
(7, 0.10865286069868967),
(8, 0.16051615192458854),
(14, 0.11835673849957479),
(16, 0.070077738474151177),
(19, 0.050950377955819796)],
'sacroprofano': [(0, 0.049574978636578802),
(2, 0.080919428352859687),
(7, 0.17690116831188984),
(8, 0.2544233871113647),
(14, 0.053319948862637204),
(16, 0.34973924714247595)],
'sdpnoticias': [(0, 0.041602502201605461),
(1, 0.12400432707994206),
(2, 0.18765337290539627),
(5, 0.06988286913803532),
(6, 0.035406696807398205),
(7, 0.15576724318589757),
(14, 0.12921632477114239),
(16, 0.095427558459729181),
(17, 0.10408346514586786),
(18, 0.045358556615497182)],
'sergioaguayo': [(0, 0.20175607782924168),
(2, 0.031450537782464032),
(4, 0.27338864459531675),
(6, 0.22939231878583377),
(7, 0.12647057650790866),
(11, 0.036209051087326916),
(18, 0.047292331416823416),
(19, 0.036209049789709742)],
'sopitas': [(1, 0.063906299233386976),
(2, 0.043620679116602896),
(3, 0.022919877713530018),
(5, 0.031848293331666291),
(6, 0.041250205143155944),
(7, 0.048976026483466537),
(13, 0.025706400785722797),
(14, 0.57002259046185866),
(16, 0.10764272396723598),
(19, 0.027337616361581638)],
'soyfdelrincon': [(1, 0.082719178076942235),
(2, 0.070442778986353677),
(5, 0.048818437704819098),
(6, 0.14292428234321544),
(7, 0.10375369065236263),
(8, 0.3861999642210478),
(16, 0.15334203119883724)],
'voxdotcom': [(2, 0.019128199554207154),
(3, 0.018624967398600794),
(5, 0.5275598549106264),
(7, 0.013918510098964337),
(9, 0.029962437744461019),
(10, 0.015204984330770476),
(13, 0.36825653571296507)],
'warkentin': [(0, 0.042017802814569981),
(1, 0.16208571866006438),
(2, 0.033861107229952114),
(6, 0.15739407125931526),
(7, 0.032057023947538961),
(8, 0.3588865513879928),
(16, 0.11240817135968408),
(17, 0.022309511117440162),
(18, 0.041507057014081757),
(19, 0.024836874667332535)]}
In [6]:
%%time
from sklearn.manifold import TSNE
tsne = TSNE(n_components=2, random_state=0)
smallest_author = 0 # Ignore authors with documents less than this.
authors = [model.author2id[a] for a in model.author2id.keys() if len(model.author2doc[a]) >= smallest_author]
_ = tsne.fit_transform(model.state.gamma[authors, :]) # Result stored in tsne.embedding_
Wall time: 1.19 s
In [ ]:
from bokeh.io import output_file
output_file('grafica.html')
In [ ]:
from bokeh.models import HoverTool
from bokeh.plotting import figure, show, ColumnDataSource
x = tsne.embedding_[:, 0]
y = tsne.embedding_[:, 1]
author_names = [model.id2author[a] for a in authors]
scale = 0.01
author_sizes = [len(model.author2doc[a]) for a in author_names]
radii = [size * scale for size in author_sizes]
source = ColumnDataSource(
data=dict(
x=x,
y=y,
author_names=author_names,
author_sizes=author_sizes,
radii=radii,
)
)
hover = HoverTool(
tooltips=[
("author", "@author_names"),
("size", "@author_sizes"),
]
)
p = figure(tools=[hover, 'crosshair,pan,wheel_zoom,box_zoom,reset,save,lasso_select'])
p.scatter('x', 'y', radius='radii', source=source, fill_alpha=0.6, line_color=None)
show(p)
In [ ]:
from gensim.similarities import MatrixSimilarity
index = MatrixSimilarity(model[list(model.id2author.values())])
In [ ]:
from gensim import matutils
import pandas as pd
author_vecs = [model.get_author_topics(author) for author in model.id2author.values()]
def similarity(vec1, vec2):
dist = matutils.hellinger(matutils.sparse2full(vec1, model.num_topics), \
matutils.sparse2full(vec2, model.num_topics))
sim = 1.0 / (1.0 + dist)
return sim
def get_sims(vec):
sims = [similarity(vec, vec2) for vec2 in author_vecs]
return sims
def get_table(name, top_n=10, smallest_author=1):
sims = get_sims(model.get_author_topics(name))
table = []
for elem in enumerate(sims):
author_name = model.id2author[elem[0]]
sim = elem[1]
author_size = len(model.author2doc[author_name])
if author_size >= smallest_author:
table.append((author_name, sim, author_size))
df = pd.DataFrame(table, columns=['Author', 'Score', 'Size'])
df = df.sort_values('Score', ascending=False)[:top_n]
return df
In [ ]:
get_table('Pajaropolitico',top_n=136)
In [ ]:
import pickle
dictionary = pickle.load(open("dictionary.p", "rb"))
In [ ]:
import pyLDAvis.gensim
pyLDAvis.enable_notebook()
In [ ]:
pyLDAvis.gensim.prepare(model, model.corpus,dictionary)
In [ ]:
Content source: jadm333/aut-top
Similar notebooks: