# Notebook from nur1popcorn/hnswlib
Path: hnswlib-examples/hnswlib-example-pyspark/similarity.ipynb

# Jupyter hnswlib example

This notebook demonstrates how to use hnswlib with pyspark in a jupyter notebook_____no_output_____## Download data

The first line is dropped for it to be readable as csv input_____no_output_____

!curl "https://dl.fbaipublicfiles.com/fasttext/vectors-crawl/cc.en.300.vec.gz" | gunzip | tail -n +2 | gzip > data.gz _____no_output_____from pyspark.ml import Pipeline
from pyspark.ml.feature import VectorAssembler
from pyspark_hnsw.conversion import VectorConverter
from pyspark_hnsw.knn import *
from pyspark_hnsw.linalg import Normalizer_____no_output_____

Read the data as a spark dataframe_____no_output_____

spark.sparkContext.setCheckpointDir('/tmp/checkpoints')_____no_output_____words_df = spark.read \
    .option('delimiter', ' ') \
    .option('inferSchema', 'true') \
    .option("quote", "\u0000") \
    .csv('data.gz') \
    .withColumnRenamed('_c0', 'id')_____no_output_____

Inspect the schema_____no_output_____

words_df.printSchema()root
 |-- id: string (nullable = true)
 |-- _c1: double (nullable = true)
 |-- _c2: double (nullable = true)
 |-- _c3: double (nullable = true)
 |-- _c4: double (nullable = true)
 |-- _c5: double (nullable = true)
 |-- _c6: double (nullable = true)
 |-- _c7: double (nullable = true)
 |-- _c8: double (nullable = true)
 |-- _c9: double (nullable = true)
 |-- _c10: double (nullable = true)
 |-- _c11: double (nullable = true)
 |-- _c12: double (nullable = true)
 |-- _c13: double (nullable = true)
 |-- _c14: double (nullable = true)
 |-- _c15: double (nullable = true)
 |-- _c16: double (nullable = true)
 |-- _c17: double (nullable = true)
 |-- _c18: double (nullable = true)
 |-- _c19: double (nullable = true)
 |-- _c20: double (nullable = true)
 |-- _c21: double (nullable = true)
 |-- _c22: double (nullable = true)
 |-- _c23: double (nullable = true)
 |-- _c24: double (nullable = true)
 |-- _c25: double (nullable = true)
 |-- _c26: double (nullable = true)
 |-- _c27: double (nullable = true)
 |-- _c28: double (nullable = true)
 |-- _c29: double (nullable = true)
 |-- _c30: double (nullable = true)
 |-- _c31: double (nullable = true)
 |-- _c32: double (nullable = true)
 |-- _c33: double (nullable = true)
 |-- _c34: double (nullable = true)
 |-- _c35: double (nullable = true)
 |-- _c36: double (nullable = true)
 |-- _c37: double (nullable = true)
 |-- _c38: double (nullable = true)
 |-- _c39: double (nullable = true)
 |-- _c40: double (nullable = true)
 |-- _c41: double (nullable = true)
 |-- _c42: double (nullable = true)
 |-- _c43: double (nullable = true)
 |-- _c44: double (nullable = true)
 |-- _c45: double (nullable = true)
 |-- _c46: double (nullable = true)
 |-- _c47: double (nullable = true)
 |-- _c48: double (nullable = true)
 |-- _c49: double (nullable = true)
 |-- _c50: double (nullable = true)
 |-- _c51: double (nullable = true)
 |-- _c52: double (nullable = true)
 |-- _c53: double (nullable = true)
 |-- _c54: double (nullable = true)
 |-- _c55: double (nullable = true)
 |-- _c56: double (nullable = true)
 |-- _c57: double (nullable = true)
 |-- _c58: double (nullable = true)
 |-- _c59: double (nullable = true)
 |-- _c60: double (nullable = true)
 |-- _c61: double (nullable = true)
 |-- _c62: double (nullable = true)
 |-- _c63: double (nullable = true)
 |-- _c64: double (nullable = true)
 |-- _c65: double (nullable = true)
 |-- _c66: double (nullable = true)
 |-- _c67: double (nullable = true)
 |-- _c68: double (nullable = true)
 |-- _c69: double (nullable = true)
 |-- _c70: double (nullable = true)
 |-- _c71: double (nullable = true)
 |-- _c72: double (nullable = true)
 |-- _c73: double (nullable = true)
 |-- _c74: double (nullable = true)
 |-- _c75: double (nullable = true)
 |-- _c76: double (nullable = true)
 |-- _c77: double (nullable = true)
 |-- _c78: double (nullable = true)
 |-- _c79: double (nullable = true)
 |-- _c80: double (nullable = true)
 |-- _c81: double (nullable = true)
 |-- _c82: double (nullable = true)
 |-- _c83: double (nullable = true)
 |-- _c84: double (nullable = true)
 |-- _c85: double (nullable = true)
 |-- _c86: double (nullable = true)
 |-- _c87: double (nullable = true)
 |-- _c88: double (nullable = true)
 |-- _c89: double (nullable = true)
 |-- _c90: double (nullable = true)
 |-- _c91: double (nullable = true)
 |-- _c92: double (nullable = true)
 |-- _c93: double (nullable = true)
 |-- _c94: double (nullable = true)
 |-- _c95: double (nullable = true)
 |-- _c96: double (nullable = true)
 |-- _c97: double (nullable = true)
 |-- _c98: double (nullable = true)
 |-- _c99: double (nullable = true)
 |-- _c100: double (nullable = true)
 |-- _c101: double (nullable = true)
 |-- _c102: double (nullable = true)
 |-- _c103: double (nullable = true)
 |-- _c104: double (nullable = true)
 |-- _c105: double (nullable = true)
 |-- _c106: double (nullable = true)
 |-- _c107: double (nullable = true)
 |-- _c108: double (nullable = true)
 |-- _c109: double (nullable = true)
 |-- _c110: double (nullable = true)
 |-- _c111: double (nullable = true)
 |-- _c112: double (nullable = true)
 |-- _c113: double (nullable = true)
 |-- _c114: double (nullable = true)
 |-- _c115: double (nullable = true)
 |-- _c116: double (nullable = true)
 |-- _c117: double (nullable = true)
 |-- _c118: double (nullable = true)
 |-- _c119: double (nullable = true)
 |-- _c120: double (nullable = true)
 |-- _c121: double (nullable = true)
 |-- _c122: double (nullable = true)
 |-- _c123: double (nullable = true)
 |-- _c124: double (nullable = true)
 |-- _c125: double (nullable = true)
 |-- _c126: double (nullable = true)
 |-- _c127: double (nullable = true)
 |-- _c128: double (nullable = true)
 |-- _c129: double (nullable = true)
 |-- _c130: double (nullable = true)
 |-- _c131: double (nullable = true)
 |-- _c132: double (nullable = true)
 |-- _c133: double (nullable = true)
 |-- _c134: double (nullable = true)
 |-- _c135: double (nullable = true)
 |-- _c136: double (nullable = true)
 |-- _c137: double (nullable = true)
 |-- _c138: double (nullable = true)
 |-- _c139: double (nullable = true)
 |-- _c140: double (nullable = true)
 |-- _c141: double (nullable = true)
 |-- _c142: double (nullable = true)
 |-- _c143: double (nullable = true)
 |-- _c144: double (nullable = true)
 |-- _c145: double (nullable = true)
 |-- _c146: double (nullable = true)
 |-- _c147: double (nullable = true)
 |-- _c148: double (nullable = true)
 |-- _c149: double (nullable = true)
 |-- _c150: double (nullable = true)
 |-- _c151: double (nullable = true)
 |-- _c152: double (nullable = true)
 |-- _c153: double (nullable = true)
 |-- _c154: double (nullable = true)
 |-- _c155: double (nullable = true)
 |-- _c156: double (nullable = true)
 |-- _c157: double (nullable = true)
 |-- _c158: double (nullable = true)
 |-- _c159: double (nullable = true)
 |-- _c160: double (nullable = true)
 |-- _c161: double (nullable = true)
 |-- _c162: double (nullable = true)
 |-- _c163: double (nullable = true)
 |-- _c164: double (nullable = true)
 |-- _c165: double (nullable = true)
 |-- _c166: double (nullable = true)
 |-- _c167: double (nullable = true)
 |-- _c168: double (nullable = true)
 |-- _c169: double (nullable = true)
 |-- _c170: double (nullable = true)
 |-- _c171: double (nullable = true)
 |-- _c172: double (nullable = true)
 |-- _c173: double (nullable = true)
 |-- _c174: double (nullable = true)
 |-- _c175: double (nullable = true)
 |-- _c176: double (nullable = true)
 |-- _c177: double (nullable = true)
 |-- _c178: double (nullable = true)
 |-- _c179: double (nullable = true)
 |-- _c180: double (nullable = true)
 |-- _c181: double (nullable = true)
 |-- _c182: double (nullable = true)
 |-- _c183: double (nullable = true)
 |-- _c184: double (nullable = true)
 |-- _c185: double (nullable = true)
 |-- _c186: double (nullable = true)
 |-- _c187: double (nullable = true)
 |-- _c188: double (nullable = true)
 |-- _c189: double (nullable = true)
 |-- _c190: double (nullable = true)
 |-- _c191: double (nullable = true)
 |-- _c192: double (nullable = true)
 |-- _c193: double (nullable = true)
 |-- _c194: double (nullable = true)
 |-- _c195: double (nullable = true)
 |-- _c196: double (nullable = true)
 |-- _c197: double (nullable = true)
 |-- _c198: double (nullable = true)
 |-- _c199: double (nullable = true)
 |-- _c200: double (nullable = true)
 |-- _c201: double (nullable = true)
 |-- _c202: double (nullable = true)
 |-- _c203: double (nullable = true)
 |-- _c204: double (nullable = true)
 |-- _c205: double (nullable = true)
 |-- _c206: double (nullable = true)
 |-- _c207: double (nullable = true)
 |-- _c208: double (nullable = true)
 |-- _c209: double (nullable = true)
 |-- _c210: double (nullable = true)
 |-- _c211: double (nullable = true)
 |-- _c212: double (nullable = true)
 |-- _c213: double (nullable = true)
 |-- _c214: double (nullable = true)
 |-- _c215: double (nullable = true)
 |-- _c216: double (nullable = true)
 |-- _c217: double (nullable = true)
 |-- _c218: double (nullable = true)
 |-- _c219: double (nullable = true)
 |-- _c220: double (nullable = true)
 |-- _c221: double (nullable = true)
 |-- _c222: double (nullable = true)
 |-- _c223: double (nullable = true)
 |-- _c224: double (nullable = true)
 |-- _c225: double (nullable = true)
 |-- _c226: double (nullable = true)
 |-- _c227: double (nullable = true)
 |-- _c228: double (nullable = true)
 |-- _c229: double (nullable = true)
 |-- _c230: double (nullable = true)
 |-- _c231: double (nullable = true)
 |-- _c232: double (nullable = true)
 |-- _c233: double (nullable = true)
 |-- _c234: double (nullable = true)
 |-- _c235: double (nullable = true)
 |-- _c236: double (nullable = true)
 |-- _c237: double (nullable = true)
 |-- _c238: double (nullable = true)
 |-- _c239: double (nullable = true)
 |-- _c240: double (nullable = true)
 |-- _c241: double (nullable = true)
 |-- _c242: double (nullable = true)
 |-- _c243: double (nullable = true)
 |-- _c244: double (nullable = true)
 |-- _c245: double (nullable = true)
 |-- _c246: double (nullable = true)
 |-- _c247: double (nullable = true)
 |-- _c248: double (nullable = true)
 |-- _c249: double (nullable = true)
 |-- _c250: double (nullable = true)
 |-- _c251: double (nullable = true)
 |-- _c252: double (nullable = true)
 |-- _c253: double (nullable = true)
 |-- _c254: double (nullable = true)
 |-- _c255: double (nullable = true)
 |-- _c256: double (nullable = true)
 |-- _c257: double (nullable = true)
 |-- _c258: double (nullable = true)
 |-- _c259: double (nullable = true)
 |-- _c260: double (nullable = true)
 |-- _c261: double (nullable = true)
 |-- _c262: double (nullable = true)
 |-- _c263: double (nullable = true)
 |-- _c264: double (nullable = true)
 |-- _c265: double (nullable = true)
 |-- _c266: double (nullable = true)
 |-- _c267: double (nullable = true)
 |-- _c268: double (nullable = true)
 |-- _c269: double (nullable = true)
 |-- _c270: double (nullable = true)
 |-- _c271: double (nullable = true)
 |-- _c272: double (nullable = true)
 |-- _c273: double (nullable = true)
 |-- _c274: double (nullable = true)
 |-- _c275: double (nullable = true)
 |-- _c276: double (nullable = true)
 |-- _c277: double (nullable = true)
 |-- _c278: double (nullable = true)
 |-- _c279: double (nullable = true)
 |-- _c280: double (nullable = true)
 |-- _c281: double (nullable = true)
 |-- _c282: double (nullable = true)
 |-- _c283: double (nullable = true)
 |-- _c284: double (nullable = true)
 |-- _c285: double (nullable = true)
 |-- _c286: double (nullable = true)
 |-- _c287: double (nullable = true)
 |-- _c288: double (nullable = true)
 |-- _c289: double (nullable = true)
 |-- _c290: double (nullable = true)
 |-- _c291: double (nullable = true)
 |-- _c292: double (nullable = true)
 |-- _c293: double (nullable = true)
 |-- _c294: double (nullable = true)
 |-- _c295: double (nullable = true)
 |-- _c296: double (nullable = true)
 |-- _c297: double (nullable = true)
 |-- _c298: double (nullable = true)
 |-- _c299: double (nullable = true)
 |-- _c300: double (nullable = true)

## Fit the model

The cosine distance is obtained with the inner product after normalizing all vectors to unit norm. This is faster than calculating the cosine distance directly_____no_output_____

vector_assembler = VectorAssembler(inputCols=words_df.columns[1:], outputCol='features_as_vector')

converter = VectorConverter(inputCol='features_as_vector', outputCol='features')

normalizer = Normalizer(inputCol='features', outputCol='normalized_features')

hnsw = HnswSimilarity(identifierCol='id', queryIdentifierCol='id', featuresCol='normalized_features',
                      distanceFunction='inner-product', m=48, ef=5, k=10, efConstruction=200, numPartitions=2,
                      excludeSelf=True, predictionCol='approximate', outputFormat='minimal')

pipeline = Pipeline(stages=[vector_assembler, converter, normalizer, hnsw])

model = pipeline.fit(words_df)_____no_output_____

## Transform the data

Show the most similar words for a 1% sample_____no_output_____

words_df_sample = words_df.sample(0.01)

model.transform(words_df_sample) \
    .show(100, False)+---------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|id                                                 |approximate                                                                                |
+---------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|12,203                                             |[[12,207, 0.18658859], [12,208, 0.19709927], [9,203, 0.2014007], [7,846, 0.2022888], [9,534, 0.20384425], [10,870, 0.20649981], [9,084, 0.20763409], [9,088, 0.20896888], [10,864, 0.21028435], [5,415, 0.21110404]]                                                                                |
|jobsPest                                           |[[jobsQuality, 0.25308883], [jobsAviation, 0.26029062], [jobsPlumbing, 0.26665843], [jobsDiesel, 0.2683605], [jobsPackage, 0.26983005], [jobsLawn, 0.2711926], [jobsElectronics, 0.27372217], [jobsFire, 0.2752136], [jobsPediatrics, 0.2768286], [jobsPRN, 0.27690232]]                                                                                |
|Fabric-Free                                        |[[Contact4, 0.4873442], [RankingsCross-Platform, 0.48872536], [Twistys-, 0.49384797], [PatternsSewing, 0.49997622], [Results---------------------Trio, 0.50160384], [BootsUmbro, 0.5024311], [PostsCrazy, 0.50568044], [E-booksLiquid, 0.50938785], [ShoppingMainResourcesHome, 0.51089483], [IIStar, 0.5164968]]                                                                                |
|MEDLEY                                             |[[SMEDLEY, 0.33541584], [STATON, 0.4237159], [REDMAN, 0.4317326], [INSTRUMENTAL, 0.43596303], [LANDRUM, 0.43741482], [MELODY, 0.43790233], [EARLS, 0.44213486], [REEDY, 0.4467486], [LAKIN, 0.44767928], [CAPELLA, 0.44937247]]                                                                                |
|Cherifa                                            |[[Sherifa, 0.21229106], [Houria, 0.2890727], [Mariem, 0.29752994], [Nesrine, 0.30011368], [Souad, 0.30613774], [Youmna, 0.30868888], [Najat, 0.31098378], [Othmane, 0.3109982], [Aïcha, 0.3119046], [Mounira, 0.3127805]]                                                                                |
|handling.The                                       |[[handlingThe, 0.2960384], [HandlingThe, 0.348755], [acceleration.The, 0.38781983], [performance.The, 0.42423737], [grip.The, 0.4348228], [styling.The, 0.4419613], [reliability.The, 0.442101], [processing.The, 0.44788152], [quality.The, 0.4515201], [preparation.The, 0.4519968]]                                                                                |
|feeding.                                           |[[feeding-, 0.2464127], [breastfeeding., 0.24948114], [pumping., 0.2880875], [feeding.The, 0.2901587], [nursing., 0.30490905], [feed., 0.30967218], [eating., 0.33619535], [feeds., 0.3368044], [feeders., 0.33771157], [bfeeding, 0.34225684]]                                                                                |
|INCREASE                                           |[[DECREASE, 0.17253554], [INCREASES, 0.17714423], [INCREASED, 0.18786818], [INCREASING, 0.23869586], [DECREASED, 0.24525923], [DECREASING, 0.2651623], [DECREASES, 0.2724021], [REDUCES, 0.28129196], [REDUCE, 0.3192544], [increase, 0.33188963]]                                                                                |
|Biedscheid                                         |[[Vasturia, 0.34737885], [McAlarney, 0.3716166], [Abromaitis, 0.37181854], [Cougill, 0.38580287], [Harangody, 0.3867358], [Chrabascz, 0.3958456], [LeDay, 0.39698923], [Mosquera-Perea, 0.40215093], [Swopshire, 0.41246688], [Olekaibe, 0.41323322]]                                                                                |
|StonesBlood                                        |[[StoriesBlood, 0.2574374], [Pain-MigrainesBlood, 0.25935745], [DisordersBlood, 0.27709854], [toothbrushesBlood, 0.2863251], [VaginitisBlood, 0.35550547], [CancerUterine, 0.42338544], [citiesBloomfield, 0.43873364], [ScansBlood, 0.43958473], [DripPulmonary, 0.44069505], [Bubbles17Potty, 0.4551038]]                                                                                |
|Dwyka                                              |[[Ecca, 0.3334368], [Huab, 0.35957432], [Ugab, 0.37153518], [tillite, 0.38799363], [Neocomian, 0.3959421], [Palmwag, 0.39790404], [Tillite, 0.40405828], [calcrete, 0.40923548], [Kuiseb, 0.41476083], [Karroo, 0.41948062]]                                                                                |
|Salmonoid                                          |[[klempie, 0.17076665], [bergshark, 0.20234323], [robdylan, 0.20383084], [MorneN, 0.21372688], [JarsonX, 0.21756864], [rekinek, 0.22028464], [VinChainSaw, 0.22337723], [FireTheLooser, 0.24493623], [rhineshark, 0.2945698], [war1, 0.30755812]]                                                                                |
|Thiruvananthapuram                                 |[[Kozhikode, 0.113474965], [Trivandrum, 0.13436812], [Thrissur, 0.15189129], [Ernakulam, 0.18022627], [Thiruvanathapuram, 0.1967026], [Kannur, 0.1999836], [Kottayam, 0.20828074], [Alappuzha, 0.2144202], [Palakkad, 0.2157821], [Kerala, 0.2218926]]                                                                                |
|411,000                                            |[[314,000, 0.18651259], [382,000, 0.19640517], [542,000, 0.19697678], [243,000, 0.19744879], [246,000, 0.19793433], [661,000, 0.19919282], [483,000, 0.19965571], [311,000, 0.19969779], [787,000, 0.19983482], [687,000, 0.19987303]]                                                                                |
|renormalized                                       |[[renormalize, 0.21896636], [renormalizable, 0.233994], [non-renormalizable, 0.24710214], [renormalization, 0.25644892], [renormalizing, 0.2630415], [perturbatively, 0.26749474], [renormalizability, 0.26908678], [renormalisation, 0.2788254], [one-particle, 0.2796554], [self-energy, 0.28007698]]                                                                                |
|tic-tac-toe                                        |[[Tic-Tac-Toe, 0.2675596], [Tic-tac-toe, 0.27591997], [tick-tack-toe, 0.31125695], [TicTacToe, 0.3837089], [game-board, 0.3997907], [pentomino, 0.40678132], [gameboard, 0.43625218], [pictionary, 0.4396732], [parcheesi, 0.44464827], [pentominoes, 0.44885635]]                                                                                |
|Bordan                                             |[[Casselle, 0.52586204], [Pershin, 0.5260427], [Vernik, 0.5282048], [Pawlo, 0.5297984], [Silley, 0.5305444], [Karidy, 0.53220797], [Lukich, 0.53514373], [Jarvin, 0.54001564], [Romanovitch, 0.5408964], [Vinnik, 0.542225]]                                                                                |
|Trump-like                                         |[[Trump-style, 0.24985683], [Trumpish, 0.32918006], [Trump-inspired, 0.3576998], [Trump-led, 0.3673811], [Trumpist, 0.36998725], [Trumpian, 0.38011009], [pussy-grabbing, 0.41307902], [Trump, 0.4192025], [Trump-, 0.43780744], [Obama-esque, 0.44226766]]                                                                                |
|plural.                                            |[[singular., 0.19377464], [nouns., 0.29209363], [adjectives., 0.33575755], [plural, 0.34617174], [pronouns., 0.3491757], [verbs., 0.35916436], [unnatural., 0.37773985], [singulars, 0.38103175], [punctuation., 0.38695288], [literal., 0.387487]]                                                                                |
|2017AirAsia                                        |[[2017Airport, 0.3248713], [2017Airtel, 0.32582766], [2017Airline, 0.33763862], [2017Air, 0.3726818], [2017Ural, 0.4164347], [2017JAL, 0.44614], [2017S7, 0.47999454], [2016Jetstar, 0.48473775], [2017Airfare, 0.4851548], [2017Lufthansa, 0.49247712]]                                                                                |
|Tygh                                               |[[Wamic, 0.46134633], [Seiad, 0.4715523], [Ohop, 0.47594672], [Walterville, 0.4771896], [Yoncalla, 0.48333758], [Ochoco, 0.4844129], [Westfir, 0.49013948], [Aumsville, 0.49770498], [Santiam, 0.49815756], [Dufur, 0.4989429]]                                                                                |
|Corfield                                           |[[Wakelam, 0.47453016], [Thursfield, 0.47644395], [Relton, 0.47709066], [Darnborough, 0.4790309], [Barker, 0.4950601], [Hunnisett, 0.5000353], [Clare, 0.50022745], [Loveday, 0.5014505], [McCullagh, 0.5016621], [Rushbrook, 0.5021677]]                                                                                |
|off-topicness                                      |[[off-topic, 0.39978695], [off-topics, 0.43869048], [any-other-ism, 0.46748966], [offtopic, 0.46778005], [threadjacking, 0.48088962], [noobishness, 0.48138767], [double-posting, 0.49016875], [thread-jacking, 0.49423033], [nitpickery, 0.49565685], [ailurophobia, 0.51669383]]                                                                                |
|geometricians                                      |[[geometrician, 0.2514078], [geometers, 0.28362888], [dialecticians, 0.3291492], [mathematicians, 0.35669494], [metaphysicians, 0.35981405], [metaphysicists, 0.36269522], [mechanicians, 0.36907917], [topographers, 0.37184918], [topologists, 0.37911403], [philosophers, 0.379712]]                                                                                |
|probe-target                                       |[[12-mer, 0.406626], [unhybridized, 0.4090193], [primer-template, 0.42718935], [intercalator, 0.42875183], [oligonucleotide, 0.42901552], [multimer, 0.42940372], [heteroduplexes, 0.43040854], [RNA-RNA, 0.43168443], [RNA-DNA, 0.43540668], [cross-hybridization, 0.43555927]]                                                                                |
|Gilmores                                           |[[Lorelai, 0.42448652], [Gallaghers, 0.4953835], [Garveys, 0.49884313], [Latimers, 0.5017904], [Bravermans, 0.510707], [Downeys, 0.51435757], [Huxtables, 0.5155351], [Dunphys, 0.52001923], [Donnellys, 0.5225915], [Merediths, 0.528318]]                                                                                |
|re-entrant                                         |[[reentrant, 0.15459806], [Reentrant, 0.4052536], [reentrance, 0.52774024], [radiused, 0.54940414], [lock-based, 0.550535], [reentrancy, 0.5559192], [fipple, 0.5608648], [inverted-V, 0.570162], [ramp-like, 0.5722155], [exception-handling, 0.5789175]]                                                                                |
|retreatEntire                                      |[[RetreatEntire, 0.12567973], [villaEntire, 0.1762833], [flatEntire, 0.18074965], [cottageEntire, 0.18832248], [quietEntire, 0.1888001], [loftEntire, 0.18973964], [houseEntire, 0.19146818], [paradiseEntire, 0.19647264], [condoEntire, 0.19726574], [aptEntire, 0.20008034]]                                                                                |
|TDCC                                               |[[C.I.P., 0.53586763], [Skindred, 0.5382503], [ZBR, 0.54636574], [HDIF, 0.55777407], [10CC, 0.5630076], [DTB, 0.5633284], [NDZ, 0.56419915], [BK3, 0.5651463], [HTDA, 0.5656252], [RXB, 0.5676259]]                                                                                |
|effort-reward                                      |[[U-curve, 0.3932373], [Work-family, 0.43020344], [work-home, 0.44562095], [effort-related, 0.4461912], [work-family, 0.45366144], [effort-based, 0.45776397], [family-work, 0.45854646], [JD-R, 0.46326238], [within-person, 0.46719086], [inverted-U, 0.47469378]]                                                                                |
|--San                                              |[[-San, 0.35914522], [--Los, 0.42107773], [.San, 0.42540854], [theSan, 0.43825322], [San, 0.44703954], [ex-San, 0.4533084], [--Library, 0.45704937], [--Santos, 0.45948273], [--Publishers, 0.46684676], [--Sandy, 0.46889085]]                                                                                |
|self-deceived                                      |[[self-deceiving, 0.22922957], [self-deluded, 0.24861062], [self-deceptive, 0.26969224], [deluded, 0.3012687], [self-delusional, 0.33168864], [deceived, 0.33604693], [self-deception, 0.34932947], [self-deluding, 0.36128765], [self-deceit, 0.3613189], [delusioned, 0.39297193]]                                                                                |
|Gallivan                                           |[[Kearns, 0.4857906], [Halloran, 0.4983012], [Scanlon, 0.5002695], [Dermody, 0.5029112], [Monihan, 0.51301515], [McNaboe, 0.5131852], [Hickey, 0.51328695], [Donahue, 0.51339185], [Conlin, 0.51695275], [Galivan, 0.51788837]]                                                                                |
|knows                                              |[[thinks, 0.21201801], [understands, 0.2261492], [KNOWS, 0.26246667], [wants, 0.27767152], [cares, 0.3033799], [believes, 0.32917213], [know, 0.34224766], [loves, 0.35013437], [realizes, 0.35853004], [sees, 0.38445485]]                                                                                |
|time.com                                           |[[healthland.time.com, 0.31079954], [www.time.com, 0.31666458], [business.time.com, 0.32041848], [Time.com, 0.32402343], [content.time.com, 0.3254763], [cbsnews.com, 0.3340934], [newsfeed.time.com, 0.3349049], [ti.me, 0.3349563], [forbes.com, 0.35376084], [huffingtonpost.com, 0.36056894]]                                                                                |
|Honno                                              |[[Lolfa, 0.39942592], [Gwasg, 0.44998926], [Mabinogion, 0.4501353], [Hiraeth, 0.45157075], [Shinchosha, 0.4525395], [Mslexia, 0.45460403], [Kobunsha, 0.455235], [Cymreig, 0.4695266], [Llandysul, 0.4730023], [Peirene, 0.4730605]]                                                                                |
|295.8                                              |[[495.8, 0.17986465], [277.7, 0.18505645], [277.9, 0.18510514], [279.6, 0.18561989], [259.4, 0.19097263], [302.8, 0.19234681], [315.8, 0.19361043], [331.2, 0.19427317], [236.3, 0.19730085], [307.5, 0.19739395]]                                                                                |
|Sát                                                |[[Tất, 0.21651655], [Sư, 0.22710967], [Nữ, 0.23190814], [Tổ, 0.24468482], [Đạt, 0.24681973], [Tiếp, 0.24921513], [cơ, 0.24926937], [Để, 0.25090778], [Số, 0.251406], [tạo, 0.25180024]]                                                                                |
|linux-firmware                                     |[[gentoo-sources, 0.2748819], [kernel-devel, 0.2809406], [linux-headers, 0.2838297], [linux-ck, 0.2840634], [ati-drivers, 0.2860148], [alsa-driver, 0.2894156], [wireless-tools, 0.29206634], [linux-, 0.2965474], [x11-drivers, 0.29671365], [nvidia-utils, 0.29729158]]                                                                                |
|USNWC                                              |[[ORRC, 0.4963314], [UREC, 0.5053611], [Nantahala, 0.50777054], [Riverfest, 0.515401], [CRWC, 0.51723826], [Canoecopia, 0.5192678], [Whitewater, 0.52118385], [RRGCC, 0.52146745], [Paddlesport, 0.52546215], [SFWDA, 0.5266501]]                                                                                |
|Mizuna                                             |[[mizuna, 0.28863245], [Komatsuna, 0.36378044], [Tatsoi, 0.37227207], [Arugula, 0.39033133], [Radicchio, 0.4118532], [Lettuces, 0.41477716], [Mesclun, 0.43122846], [Shungiku, 0.435322], [Shishito, 0.44291615], [komatsuna, 0.45512182]]                                                                                |
|produire                                           |[[réduire, 0.30024856], [conduire, 0.30443156], [traduire, 0.31812984], [construire, 0.33397806], [quantité, 0.3619085], [comprendre, 0.36905253], [paraît, 0.37056595], [permettre, 0.37167805], [prenez, 0.37477142], [appeler, 0.3760041]]                                                                                |
|Vishvamitra                                        |[[Visvamitra, 0.2109701], [Vasishtha, 0.26352656], [Vishwamitra, 0.26676786], [Viswamitra, 0.2689237], [Vasistha, 0.28435642], [Durvasa, 0.29395294], [Parshurama, 0.3035227], [Angiras, 0.3126335], [Viśvāmitra, 0.31265825], [Lakshamana, 0.3264414]]                                                                                |
|Alaris                                             |[[Kodak, 0.54300165], [Sicor, 0.54351544], [Lumeris, 0.5489408], [Skyra, 0.5492325], [Agfa, 0.551931], [Rotech, 0.55331594], [Eclipsys, 0.5579692], [McKesson, 0.55963635], [Cohera, 0.56248426], [Skytron, 0.5640091]]                                                                                |
|Glib                                               |[[glib, 0.462829], [GLib, 0.48213995], [Gtk2, 0.4969753], [gobject, 0.530207], [GObject, 0.53471434], [Gtk, 0.54887956], [gtkmm, 0.54921776], [PyGTK, 0.5493102], [ocaml, 0.54951996], [pygtk, 0.5542872]]                                                                                |
|.547                                               |[[.508, 0.13394785], [.468, 0.15660906], [.562, 0.15937334], [.459, 0.18963867], [.525, 0.19699472], [.570, 0.20013428], [.485, 0.20840245], [.472, 0.21170974], [.730, 0.2182309], [.515, 0.22378993]]                                                                                |
|GLOSS                                              |[[GLOSSY, 0.3989271], [MATTE, 0.497608], [SUAVE, 0.5245309], [LACQUER, 0.5251291], [SATIN, 0.5333786], [COLOURED, 0.542069], [PIGMENT, 0.5423312], [RIMMEL, 0.55206597], [COLOUR, 0.55828285], [ECRU, 0.55858755]]                                                                                |
|200026th                                           |[[200026, 0.18761241], [200023rd, 0.18821812], [200030th, 0.2668029], [199226th, 0.26723677], [200118th, 0.2696054], [199117th, 0.27169496], [199229th, 0.27382308], [199621st, 0.27706194], [199614th, 0.2772705], [199822nd, 0.27854365]]                                                                                |
|war.When                                           |[[war.As, 0.17672849], [war.While, 0.18371683], [war.But, 0.19178396], [war.And, 0.19600874], [war.Now, 0.19864732], [war.If, 0.2034421], [war.We, 0.20659214], [war.So, 0.20679426], [war.With, 0.21247083], [war.The, 0.2191723]]                                                                                |
|Buto                                               |[[Hermopolis, 0.44407785], [Nekhen, 0.45114744], [Anhur, 0.45315647], [Ombos, 0.45505714], [Waset, 0.4636187], [Ipy, 0.4712559], [Amenmose, 0.47222078], [Piankhi, 0.47222567], [Heracleopolis, 0.4738437], [Khnum, 0.47964293]]                                                                                |
|agoEuro                                            |[[agoEuropean, 0.14380676], [agoEurovision, 0.2558602], [agoExtreme, 0.3950531], [agoGirl, 0.4019295], [agoAsian, 0.40496123], [agoAnal, 0.40714467], [agoPetite, 0.41152078], [agoTight, 0.4160725], [agoYoung, 0.41789395], [agoErotic, 0.42120898]]                                                                                |
|Chegg                                              |[[Chegg.com, 0.28263116], [CourseSmart, 0.38691306], [InstaEDU, 0.38738722], [ValoreBooks, 0.44380403], [Textbooks.com, 0.45656365], [eTextbooks, 0.46011853], [e-textbook, 0.4664542], [chegg, 0.4726361], [Zinch, 0.4732185], [eTextbook, 0.47742146]]                                                                                |
|yoyoing                                            |[[yoyo, 0.51077217], [YoYoFactory, 0.63088036], [yo-yoed, 0.6395584], [degrassi, 0.6421582], [yo-yo-ing, 0.6464759], [168lbs, 0.6467501], [34lbs, 0.64780664], [weightclass, 0.65541697], [yo-yos, 0.65626645], [27lbs, 0.65648466]]                                                                                |
|Psychotherapist                                    |[[psychotherapist, 0.17837918], [Psychologist, 0.25483716], [Hypnotherapist, 0.26325], [Psychoanalyst, 0.2636032], [Therapist, 0.27796215], [Psychotherapy, 0.31045443], [Psychiatrist, 0.32049966], [Psychometrist, 0.34207618], [Neuropsychologist, 0.34612286], [hypnotherapist, 0.34960145]]                                                                                |
|vsg                                                |[[wls, 0.4130748], [pgc, 0.48014772], [l4l, 0.4840045], [cnf, 0.48659766], [ubr, 0.49018586], [bdd, 0.4916944], [sbar, 0.4919929], [flk, 0.49292332], [nsg, 0.49387354], [hba, 0.4952656]]                                                                                |
|Genevan                                            |[[Genevans, 0.29040444], [Genevese, 0.36319685], [Calvinist, 0.44801384], [Zwinglian, 0.45843595], [Vaudois, 0.4630267], [Helvetian, 0.46329576], [Genevois, 0.46833795], [Romanist, 0.47816467], [Zwingli, 0.48320568], [Castellio, 0.4834407]]                                                                                |
|PackagesAll                                        |[[beveragesAll, 0.36015803], [ImagesAll, 0.36921114], [ImagesAlthough, 0.45730734], [PackagesThe, 0.47000843], [PackagesWe, 0.48384595], [Packages-, 0.4847052], [PackagesAbout, 0.48732245], [Packages, 0.5011395], [KidsAll, 0.51534486], [OptionsAll, 0.5155984]]                                                                                |
|Respiration                                        |[[respiration, 0.24006212], [Respirations, 0.34009868], [respiration., 0.36672527], [Photosynthesis, 0.376208], [Ventilatory, 0.40083295], [Breathing, 0.4182803], [respirations, 0.42138022], [Physiology, 0.42760956], [Transpiration, 0.45514685], [Oxygenation, 0.46287602]]                                                                                |
|KLINGER                                            |[[KLING, 0.23572946], [RENNER, 0.3281743], [BOLLINGER, 0.34154397], [LINDER, 0.34276795], [KLINE, 0.34491885], [BECKMAN, 0.34566534], [SEITZ, 0.3464508], [MOSER, 0.35336167], [BOCK, 0.35609585], [MUELLER, 0.35618508]]                                                                                |
|comunicato                                         |[[dedicato, 0.2575605], [comunicativo, 0.2723022], [comunica, 0.2803359], [gestione, 0.2846164], [rapporto, 0.28886348], [affari, 0.28932178], [comunicativa, 0.29086506], [comunicazione, 0.2919432], [significato, 0.2928834], [controllo, 0.29501212]]                                                                                |
|policer                                            |[[policers, 0.24065274], [policy-map, 0.33857065], [class-default, 0.3778031], [class-map, 0.37915397], [CBWFQ, 0.39920253], [dscp, 0.43556625], [per-flow, 0.4382425], [match-any, 0.44513267], [subinterface, 0.45000672], [DSCP, 0.4596861]]                                                                                |
|Harten                                             |[[Heuven, 0.41431504], [Daele, 0.41610622], [Nunen, 0.42204052], [Biezen, 0.42723382], [Zanten, 0.4326527], [Welie, 0.43394887], [Langenhove, 0.44216907], [Meeteren, 0.4449361], [Dissel, 0.44622403], [Ostrand, 0.4474976]]                                                                                |
|Fili                                               |[[Moala, 0.52602714], [Fíli, 0.5298693], [Grima, 0.53000826], [Bofur, 0.5492251], [Lete, 0.54962724], [Casan, 0.5560886], [Filipo, 0.565763], [Salita, 0.56959856], [Tauriel, 0.571589], [Corone, 0.57198024]]                                                                                |
|old.That                                           |[[old.But, 0.1474247], [old.It, 0.16579741], [old.And, 0.17444688], [old.Now, 0.18936878], [old.So, 0.19835782], [old.This, 0.21017289], [old.Then, 0.21463454], [old.The, 0.22473359], [old.As, 0.25048524], [old.One, 0.26592392]]                                                                                |
|FAUX                                               |[[FUX, 0.3556295], [Faux, 0.3758254], [FauxNews, 0.43965852], [LIBERAL, 0.44661516], [MSLSD, 0.45354593], [PMSNBC, 0.46690792], [DUmmies, 0.47646612], [FOXNEWS, 0.4791808], [MSDNC, 0.49204332], [Lamestream, 0.49492323]]                                                                                |
|adultery                                           |[[adultry, 0.16772509], [infidelity, 0.25239778], [Adultery, 0.2583952], [fornication, 0.267451], [unchastity, 0.27988046], [adulterer, 0.29999435], [adulterous, 0.30117166], [ADULTERY, 0.30291516], [bigamy, 0.31043363], [unfaithfulness, 0.3113429]]                                                                                |
|media.What                                         |[[media.That, 0.26153243], [media.This, 0.26800585], [media.So, 0.27167422], [media.It, 0.3081441], [media.Now, 0.31988323], [media.But, 0.32106495], [media.One, 0.33115608], [media.And, 0.33856434], [media.How, 0.34665102], [media.If, 0.35073084]]                                                                                |
|cor                                                |[[dï, 0.3961203], [dÃ, 0.4175074], [cor-, 0.43493056], [porations, 0.43639678], [pulmonale, 0.43843025], [respondence, 0.45021278], [ruption, 0.45934278], [cor., 0.4631384], [cile, 0.47538304], ['cor, 0.49732816]]                                                                                |
|Inq.                                               |[[Inq, 0.40202188], [obiit, 0.44469577], [Glouc, 0.47012448], [cxix, 0.47587764], [Occ., 0.47661322], [Eliz., 0.48363084], [Knt., 0.48907453], [xix., 0.49697137], [xvi., 0.49911338], [Ev., 0.49912524]]                                                                                |
|Bizer                                              |[[Lauster, 0.44218892], [Gradinger, 0.46392375], [Uschold, 0.4644981], [Lebherz, 0.46534657], [Stefik, 0.467287], [Knemeyer, 0.4674167], [Roether, 0.47718024], [Judisch, 0.47799456], [Brumme, 0.48313397], [Faler, 0.4832179]]                                                                                |
|in.Answered                                        |[[inquiryAnswered, 0.26990676], [inquiry.Answered, 0.27426267], [products.Answered, 0.2887978], [.Answered, 0.32311904], [youAsked, 0.39150316], [you.Answered, 0.39469278], [vehicle.Answered, 0.40893382], [cc-3Q, 0.41504997], [cc-2Q, 0.41548425], [you.Asked, 0.42146426]]                                                                                |
|USD400                                             |[[USD300, 0.20369935], [USD40, 0.2153914], [USD4, 0.2218684], [USD15, 0.24091631], [USD7, 0.24179614], [USD1, 0.2456035], [USD6, 0.25030327], [USD500, 0.25821334], [USD150, 0.26162666], [USD5, 0.2638967]]                                                                                |
|marriageManchester                                 |[[serviceManchester, 0.30249298], [surgeManchester, 0.34075987], [possibleManchester, 0.34607416], [peopleManchester, 0.35320836], [venueManchester, 0.36918032], [StyleManchester, 0.3761459], [PriceManchester, 0.37993687], [homeManchester, 0.38265467], [2017LifeManchester, 0.39223439], [GrandeManchester, 0.3959509]]                                                                                |
|muhaddith                                          |[[Muhaddith, 0.10724366], [sahabi, 0.30339968], [hadith, 0.30517715], [traditionist, 0.30940914], [al-Dhahabi, 0.3129747], [Rahimahullah, 0.3180018], [mujtahid, 0.3223698], [al-Qummi, 0.32311952], [ḥadīth, 0.32375914], [Al-Dhahabi, 0.3273775]]                                                                                |
|SystemYou                                          |[[systemYou, 0.259013], [SystemIf, 0.28937984], [SystemWe, 0.30691057], [SystemIt, 0.31427503], [SystemThere, 0.33225638], [SystemI, 0.34262645], [SystemTo, 0.34420937], [SystemWhen, 0.3580963], [SystemThe, 0.37157464], [SystemHow, 0.37612015]]                                                                                |
|58Scammers                                         |[[8Shocking, 0.3516931], [6239How, 0.35719866], [Printers11Do, 0.41092116], [188DuperDheats, 0.4200685], [Thread2Shocking, 0.48599648], [ThreadGet, 0.49720424], [CheckEducationLanguages, 0.50729126], [398BIC, 0.51352537], [, 0.5160079], [WorksTeamValuesManifestoJoin, 0.51632655]]                                                                                |
|brutalization                                      |[[brutalisation, 0.25391227], [dehumanization, 0.26310456], [brutality, 0.2811919], [terrorization, 0.31872302], [brutalities, 0.33425742], [subjugation, 0.34178543], [de-humanization, 0.34935534], [dehumanisation, 0.3623349], [enslavement, 0.37435597], [barbarity, 0.3812967]]                                                                                |
|Kompleks                                           |[[kompleks, 0.24991596], [Wisma, 0.3846205], [Pusat, 0.39512396], [Bangunan, 0.40657693], [Megah, 0.41615975], [Anjung, 0.41982526], [UITM, 0.42523694], [Pejabat, 0.43077368], [Lapangan, 0.43323845], [Gadong, 0.43326092]]                                                                                |
|RFLP                                               |[[RFLPs, 0.15574348], [PCR-RFLP, 0.2023353], [RAPD, 0.25871873], [ARDRA, 0.2668311], [RAPD-PCR, 0.26967585], [AFLP, 0.2698329], [PFGE, 0.29038012], [RAPDs, 0.2907418], [rep-PCR, 0.2966656], [ribotyping, 0.30552095]]                                                                                |
|Bolpur                                             |[[Balurghat, 0.29711658], [Bongaon, 0.30289835], [Baharampur, 0.3033607], [Bankura, 0.30567527], [Krishnanagar, 0.3158574], [Arambagh, 0.32335418], [Jalpaiguri, 0.33144796], [Basirhat, 0.3317582], [Arambag, 0.33280414], [Joynagar, 0.33501327]]                                                                                |
|Half-marathon                                      |[[Half-Marathon, 0.17345399], [half-marathon, 0.18152589], [Marathon, 0.24437416], [marathon, 0.25628233], [4-miler, 0.26497716], [Marathon-, 0.26737952], [5-miler, 0.27653486], [10-miler, 0.28508943], [halfmarathon, 0.29552543], [Ultra-Marathon, 0.29792058]]                                                                                |
|Pashana                                            |[[gandha, 0.42467618], [Dhathri, 0.43248785], [Gandhak, 0.4325605], [Somanatha, 0.43534237], [Gandha, 0.43653828], [Kedara, 0.43804038], [Jatamansi, 0.4435336], [Thailam, 0.44382733], [Auroshikha, 0.4487217], [Viswanathar, 0.45192194]]                                                                                |
|Mountainview                                       |[[Hillcrest, 0.3884545], [Hillview, 0.41177368], [Hillside, 0.42438316], [Hilltop, 0.43153], [Lakeview, 0.43236703], [Oakridge, 0.4456876], [Lakeside, 0.44626737], [Cedarview, 0.4476506], [Fairview, 0.44865865], [Pinebrook, 0.45652014]]                                                                                |
|Strawberries-                                      |[[strawberries-, 0.32558924], [Potatoes-, 0.3760872], [Cookies-, 0.37909764], [Fruit-, 0.38373864], [Chips-, 0.40149504], [Chocolate-, 0.4140039], [Cupcakes-, 0.4153443], [Seeds-, 0.4234345], [Snack-, 0.42579532], [Butter-, 0.43139273]]                                                                                |
|kluttz                                             |[[enniss, 0.46748388], [blackmer, 0.5220524], [jno, 0.52520955], [n.c, 0.5256657], [ijl, 0.53179747], [jji, 0.53273344], [.'., 0.5336398], [howerton, 0.5381024], [krider, 0.53874934], [i.l, 0.5402815]]                                                                                |
|yBC                                                |[[IBLF, 0.37565815], [e4e, 0.39584428], [Flytxt, 0.40649498], [BMGI, 0.40887225], [VMob, 0.41047966], [INXPO, 0.4135257], [TCUK, 0.41742367], [vcfo, 0.4181037], [Expion, 0.4204862], [Mubaloo, 0.42112082]]                                                                                |
|InstituteCentral                                   |[[InstituteUniversity, 0.39424777], [CollegeCentral, 0.40582484], [UniversityInstitute, 0.40619195], [InstituteNational, 0.41587758], [CollegeNorthwest, 0.41652536], [CollegeNorthwestern, 0.41781962], [CollegeNortheast, 0.41827053], [UniversityTrinity, 0.42332816], [CollegeHeritage, 0.42716473], [UniversityNorthwestern, 0.42863095]]                                                                                |
|deal.Get                                           |[[promotion.Get, 0.33704406], [merchant.Get, 0.34280938], [offer.Get, 0.36109442], [retailer.Get, 0.42141682], [discount.Get, 0.4313135], [discounts.Get, 0.45440573], [today.Get, 0.45729834], [prices.Get, 0.46747506], [site.Get, 0.4841087], [DealOnline, 0.48490703]]                                                                                |
|oopss                                              |[[ooppss, 0.17881781], [hhahaha, 0.21567678], [hahhaa, 0.2196294], [hhehe, 0.22064424], [hahaaaa, 0.22428185], [haahaha, 0.22476071], [hehehee, 0.22777593], [ooooops, 0.22884655], [sighh, 0.23201782], [hahaaa, 0.23202652]]                                                                                |
|Enterworks                                         |[[Enterp, 0.46053088], [Interworks, 0.47492576], [Teligent, 0.48701757], [TEOCO, 0.49184293], [TriVascular, 0.49956352], [Answerthink, 0.5032177], [BroadVision, 0.50519246], [Authentidate, 0.5058122], [deconsolidated, 0.5071093], [Asyst, 0.5076766]]                                                                                |
|Indrapuri                                          |[[Usmanpura, 0.31736088], [Ramchandrapur, 0.31939864], [Chandrapura, 0.3231414], [Brahmapuri, 0.3340426], [Shakarpur, 0.3377335], [Thakurganj, 0.33962828], [Durgapura, 0.3397761], [Gopalpura, 0.34235972], [Shankarpur, 0.34763026], [Alipura, 0.34859347]]                                                                                |
|GuideCar                                           |[[guideCar, 0.27506894], [GuideCanberra, 0.4653917], [GuideContact, 0.52747715], [GuideCleaning, 0.532438], [GuideContent, 0.5397519], [GuideClosed, 0.54824674], [GuideChris, 0.54955006], [Guide3, 0.55196565], [GuideComplimentary, 0.5528095], [GuideCruise, 0.5557381]]                                                                                |
|35ViewThe                                          |[[25ViewThe, 0.09465182], [45ViewThe, 0.11915678], [65ViewThe, 0.12135941], [85ViewThe, 0.12278879], [55ViewThe, 0.12575859], [90ViewThe, 0.13606101], [75ViewThe, 0.13861567], [40ViewThe, 0.14391416], [50ViewThe, 0.14580822], [80ViewThe, 0.14717925]]                                                                                |
|her.Was                                            |[[him.Was, 0.13783264], [anyone.Was, 0.18888414], [better.Was, 0.19741523], [me.Was, 0.19872057], [to.Was, 0.20547539], [doctor.Was, 0.2220295], [them.Was, 0.22396213], [be.Was, 0.22786236], [us.Was, 0.22904474], [care.Was, 0.23101228]]                                                                                |
|Tche                                               |[[Wuta, 0.40115637], [Awng, 0.41493613], [Ndombe, 0.42099226], [Boua, 0.43270826], [Bô, 0.4331659], [Hô, 0.43375325], [Kawng, 0.43583435], [Cuoi, 0.43640697], [Pya, 0.44193262], [Buyu, 0.4431575]]                                                                                |
|Hefferman                                          |[[McFaden, 0.44177163], [Tortorello, 0.4560455], [Barrone, 0.45779955], [Schraufnagel, 0.4695629], [Battson, 0.47042966], [McLaughlin, 0.4706053], [Greaver, 0.4834932], [McLauglin, 0.48358828], [Stauble, 0.48369557], [Feeney, 0.48422974]]                                                                                |
|3-card                                             |[[three-card, 0.15661728], [two-card, 0.25869733], [2-card, 0.26184517], [four-card, 0.27489406], [5-card, 0.27581465], [six-card, 0.2803859], [4-card, 0.286667], [6-card, 0.28720605], [7-card, 0.2961431], [five-card, 0.2975436]]                                                                                |
|oh-so-amazing                                      |[[not-so-amazing, 0.26233566], [oh-so-awesome, 0.3253194], [oh-so-lovely, 0.3915581], [oh-so-fabulous, 0.3927827], [ah-mazing, 0.4291818], [AH-mazing, 0.4304353], [oh-so-wonderful, 0.43389642], [oh-so-pretty, 0.43789083], [oh-so-adorable, 0.44143748], [uh-mazing, 0.44544053]]                                                                                |
|SatisfactionLocation5.0Value4.0Maintenance4.0Office|[[SatisfactionLocation5.0Value4.0Maintenance5.0Office, 0.02729261], [SatisfactionLocation4.0Value4.0Maintenance4.0Office, 0.039210796], [SatisfactionLocation5.0Value5.0Maintenance5.0Office, 0.068318546], [5.0Value, 0.3597989], [PlayersD1D2ConferencesRankingsTransfersDraftsBlogAbout, 0.3624913], [NewsReviewsColumnsFeaturesShootoutsVideosBasher, 0.36544526], [AssemblyDeliveryValue, 0.37287682], [agency0Services0Reviews0Works0Team, 0.37342477], [ReviewsCamerasLensesLightingAudioPost, 0.37444127], [Value4.6, 0.3747821]]|
|Peculiars                                          |[[peculiars, 0.29335696], [Paranormals, 0.52860606], [Chilbury, 0.5301968], [Unspeakables, 0.5332626], [Blackthorns, 0.535407], [Incorrigibles, 0.5515528], [Serrailler, 0.5537924], [Spyness, 0.55487597], [Demonglass, 0.5554242], [Coven, 0.55711365]]                                                                                |
+---------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
only showing top 100 rows

## Save the model_____no_output_____

model.save("/tmp/model")_____no_output_____


# Notebook from jpbm/probabilism
Path: Singular Value Decomposition - Consistent Eigenbasis.ipynb

## Constructing A Consistently Oriented Eigenbasis

Upon performing SVD, the sign of the basis vectors can be flipped without affecting the validity of the singular value decomposition. That means that if the SVD is performed repeatedly on a slowly evolving system, the derived eigenbasis of the system can abruptly change, from, for example, a left-handed to a right-handed coordinate system. Hence there is a need to find a way to consistently orient the basis of eigenvectors.

Heuristic techniques can work by taking the dot product between the singular vectors derived for two separate SVDs, and flipping them whenever the dot product is negative. A more rigorous technique was derived by Damask (2019). Damask's technique relies on constructing the sequence of reflection and rotation operations necessary to transform a constituent basis into the derived eigenbasis. The gradual transformation begins with the singular vector with the largest singular value, because it has the greatest numerical certainty.

Once consistently oriented, directional statistics can be applied to analyze the evolution of the eigensystem over different measurements.

In general, singular vectors are only labeled by their corresponding singular value (assuming no degeneracy). Rank order changes require attaching an additional label to the eigenvectors.

Reference:
https://arxiv.org/abs/1912.12983

### Testing the Thucyd Package

Jay's thucyd package can be used to correct sign flips in eigenbases._____no_output_____

<code>
import numpy as np
import matplotlib.pyplot as plt
import thucyd_____no_output_____### Square Matrices -- doesn't work for complex eigenvalues / eigenvectors

def check(V,E):
    return np.matmul(np.matmul(V,E),V.T)

for i in range(100):
    N = 20
    M = np.random.randn(N,N)
    E,V = np.linalg.eig(M)

    # get real
    E = np.diag(E.real)
    V = V.real
    M = np.matmul(np.matmul(V,E),V.T)

    # orient the original matrix V
    Vor , Eor , signs , theta_matrix , sort_indices = thucyd.eigen.orient_eigenvectors(V,E)

    assert np.allclose(M,check(Vor,Eor))

print("Works.")Works.
### SVD -- SVD always returns real eigenvalues bc A^TA is hermitian and real eigenvectors if A is real

### Flipping must be symmetric

def check_svd(U,S,V):
    return np.matmul(np.matmul(U,S),V)

for i in range(100):
    N = 3
    M = np.random.randn(N+1,N)
    U,S,Vh = np.linalg.svd(M,full_matrices=False)
    S = np.diag(S)

    assert np.all(np.isreal(S))
    assert np.all(S >= 0)
    assert np.all(np.isreal(U))
    assert np.all(np.isreal(V))

    Vor , Eor , signs , theta_matrix , sort_indices = thucyd.eigen.orient_eigenvectors(Vh.T,S)
    Vorh = Vor.T
    Uor = np.matmul(U,np.diag(signs))

    assert np.allclose(check_svd(U,S,Vh),M)
    assert np.allclose(M,check_svd(Uor,S,Vorh))

print("Works.")Works.
"""
Tracking eigenvectors of an evolving system.

Slowly rotating in 2D
"""

def Rotation2D(theta):
    return np.array([[np.cos(theta),-np.sin(theta)],[np.sin(theta),np.cos(theta)]])

def rolling_window(X,size=10):
    for i in range(size,len(X)):
        yield X[i-size:i]

# total number of samples
N = 1500

# singular values & average
sig = np.diag([1,0.5])
mu = np.array([0,0]).T

X = []
for theta in np.linspace(-np.pi/2,np.pi/2,N):
    R = Rotation2D(theta)
    x = np.matmul(R,np.matmul(sig,np.random.randn(2,1))).T
    X += [list(x)]

X = np.vstack(X)

fig = plt.figure(figsize=(12,10))

ax1 = fig.add_subplot(2,1,1)
ax2 = fig.add_subplot(2,1,2)

for offset,window in enumerate(rolling_window(X,size=100)):
    U,S,Vh = np.linalg.svd(window,full_matrices=False)

    E = np.diag(S)

    Vor , Eor , signs , theta_matrix , sort_indices = thucyd.eigen.orient_eigenvectors(Vh.T,E)
    Vorh = Vor.T
    Uor = np.matmul(U,np.diag(signs))

    assert np.allclose(window,check_svd(Uor,E,Vorh))

    vor1 = Vor[:,0]
    vor2 = Vor[:,1]

    v1 = Vh.T[:,0]
    v2 = Vh.T[:,1]

    ax1.plot(v1[0]+offset,v1[1],'.-',linewidth=3,color='blue')
    ax1.plot(v2[0]+offset,v2[1],'.-',linewidth=3,color='red')
    ax1.set_title('SVD Right Singular Vectors')
    ax1.legend(['1st Singular Vector','2nd Singular Vector'],fontsize=10)

    ax2.plot(vor1[0]+offset,vor1[1],'.-',linewidth=3,color='blue')
    ax2.plot(vor2[0]+offset,vor2[1],'.-',linewidth=3,color='red')
    ax2.set_title('Consistently Oriented Eigenbasis')

plt.savefig('./img/svd_consistently_oriented.png')_____no_output_____
</code>