Vector embeddings are important to how Large Language Models (LLMs) work, and as I’m following the Microsoft Reactor Python+AI series (it’s really good, thanks Pamela Fox) I thought it was time for a blog post to capture some of the information.
Free LLM Model Access via GitHub Model
GitHub allows for free access to LLM models via GitHub Models. Access requires a Github account, and on the free tier the access is limited to a low amount of token calls but it is free!
What are vector embeddings?
A vector embedding encodes input (e.g. text) as a list of floating-point numbers, i.e. it is a list of numbers to represent the input in a way a computer can more easily process it. A vector embedding is used to capture the meaning of the input in numerical form so that computers can search based on meanings.
Different models use different methods to create vectors embeddings, with outputs in varying vector lengths. For example, the ‘word2vec’ model encodes words and outputs vectors at a length of 300, where as the ‘OpenAI text-embedding-3-large- model encodes text (up to 8191 tokens) and outputs vectors between at lengths between 256 and 3072.
Generating an embedding
Python can be used to access an AI model and generate embeddings.
The below code requires that your GitHub access token is stored as a environment variable (GITHUB_TOKEN).
import os
from dotenv import load_dotenv
from openai import OpenAI
load_dotenv()
openai_client = OpenAI(
base_url="https://models.github.ai/inference",
api_key=os.environ["GITHUB_TOKEN"]
)
MODEL_NAME = "openai/text-embedding-3-small"
MODEL_DIMENSIONS = 1536
embeddings_response = openai_client.embeddings.create(
model=MODEL_NAME,
dimensions=MODEL_DIMENSIONS,
input="geektechstuff",
)
embedding = embeddings_response.data[0].embedding
print(embedding)
What does an embedding look like?
Depending on the model and the dimensions the vector looks like a long list of floating point numbers, which doesn’t mean much to humans but does to a computer.
For example, if “geektechstuff” is given to the ‘OpenAI text-embedding-3-small’ model and told to use a model dimension of 1536 it returns a vector with a length of 1536 to represent “geektechstuff”:
0.01513869222253561, -0.028046417981386185, -0.0483224019408226, -0.003283844096586108, -0.0017804087838158011, -0.09288099408149719, -0.00439363531768322, 0.046167317777872086, -0.0168460626155138, -0.013560322113335133, 0.027788415551185608, 0.019213618710637093, -0.03308505937457085, -0.011428005062043667, 0.02655910886824131, -0.013226436451077461, -0.07406197488307953, -0.04468001052737236, -0.011928834021091461, 0.035604383796453476, 0.009090803563594818, 0.025178035721182823, 0.058247920125722885, -0.0010784894693642855, -0.011799832805991173, 0.003310403088107705, 0.028926663100719452, 0.03027738444507122, -0.002041257219389081, 0.0036727453116327524, 0.01118517853319645, -0.026452872902154922, 0.02451026253402233, -0.02860795333981514, 0.016830885782837868, 0.030717507004737854, 0.006700483616441488, 0.006893985904753208, 0.03967171907424927, 0.01424327027052641, 0.016633590683341026, -0.05694272741675377, 0.01560157909989357, 0.040005605667829514, 0.008779682219028473, -0.055728599429130554, -0.054726939648389816, -0.01664876751601696, 0.029989028349518776, 0.024753089994192123, 0.034511663019657135, -0.025602981448173523, 0.0036063475999981165, 0.06258843839168549, -0.012983609922230244, -0.001577421324327588, -0.012771137058734894, 0.01927432417869568, -0.006920544896274805, -0.002919604768976569, 0.006423510145395994, -0.048443812876939774, 0.0353008508682251, -0.007224077358841896, 0.005023465491831303, -0.006313479505479336, -0.02271942049264908, -0.02346307598054409, 0.0026407341938465834, -0.012862197123467922, -0.012164072133600712, 0.01951714977622032, -0.037880878895521164, -0.011094119399785995, 0.0013289039488881826, -0.006992633920162916, -0.029624788090586662, 0.02745453082025051, 0.025466391816735268, 0.022233767434954643, -0.02318989671766758, 0.015032455325126648, -0.04243386536836624, -0.03020150028169155, -0.052662916481494904, -0.011974363587796688, -0.07023745775222778, -0.052359387278556824, -0.058126505464315414, 0.024176377803087234, -0.024570969864726067, 0.01008487306535244, -0.00016812863759696484, -0.024176377803087234, 0.001121173845604062, 0.04765462875366211, 0.01159494835883379, 0.004040778614580631, 0.02895701676607132, 0.01664876751601696, 0.02733311615884304, -0.024677205830812454, -0.0198662132024765, -0.028016066178679466, 0.04003595933318138, -0.01757454127073288, 0.002139905234798789, -0.06213313713669777, 0.018029840663075447, 0.03208340331912041, -0.10307969152927399, 0.014174975454807281, -0.026103809475898743, 0.028896309435367584, -0.03132457286119461, 0.001749107032082975, 0.07387985289096832, -0.03666674718260765, 0.04850452020764351, -0.007747671566903591, -0.0297310259193182, 0.05354316160082817, 0.01260419376194477, -0.060220882296562195, -0.00783873163163662, 0.011746713891625404, -0.005729179363697767, -0.01008487306535244, -0.036757804453372955, -0.0020716104190796614, 0.0181208997964859, -0.007975321263074875, 0.05533400550484657, -0.023250602185726166, 0.0388825349509716, -0.016269350424408913, -0.03135492652654648, -0.04009666666388512, -0.025299448519945145, -0.017437951639294624, -0.032842233777046204, -0.011981952004134655, 0.020033156499266624, -0.04231245443224907, 0.052662916481494904, 0.008832801133394241, -0.0024282613303512335, -0.026392165571451187, -0.01831819675862789, 0.05269327014684677, -0.04267669469118118, 0.011306592263281345, -0.048140279948711395, 0.01018352061510086, 0.01453921478241682, 0.017635248601436615, 0.05269327014684677, 0.044042591005563736, -0.07236219197511673, -0.01699782907962799, -0.030064910650253296, -0.006840867456048727, -0.01205783523619175, -0.006742219440639019, 0.006742219440639019, 0.0448317751288414, 0.03177987039089203, 0.01472892239689827, -0.04486212879419327, 0.004367076326161623, -0.004257045686244965, -0.030990686267614365, -0.012847020290791988, 0.0006378928665071726, -0.003325579920783639, 0.01405356265604496, 0.057276614010334015, -0.013727265410125256, -0.04689579829573631, -0.03751663863658905, -0.015768522396683693, 0.022552477195858955, -0.01850031688809395, 0.028198184445500374, -0.06920544803142548, -0.048292048275470734, 0.013674146495759487, 0.0021778468508273363, 0.0005174283287487924, -0.022704243659973145, 0.021930234506726265, 0.046744029968976974, 0.006180684082210064, -0.0071102529764175415, 0.0012966536451131105, -0.059947703033685684, -0.0009978635935112834, -0.01567746326327324, -0.00991034135222435, -0.00320416665636003, 0.01877349615097046, 0.013954914174973965, 0.00981169380247593, -0.0010604672133922577, -0.017529010772705078, -0.027226880192756653, -0.01652735471725464, 0.059522755444049835, 0.0047730510123074055, -0.021399052813649178, 0.03420813009142876, 0.003530464367941022, -0.01919844187796116, 0.013833501376211643, -0.02745453082025051, 0.01135971024632454, -0.035361554473638535, 0.03341894596815109, -0.018712788820266724, 0.04070373252034187, -0.05758014693856239, 0.044194355607032776, 0.04261598736047745, 0.02341754548251629, 0.021307993680238724, 0.003384389216080308, -0.0034925227519124746, -0.009105980396270752, 0.05223797261714935, 0.007262018974870443, -0.02810712531208992, 0.009705456905066967, -0.012824255041778088, -0.03329753503203392, 0.03545261546969414, 0.056730255484580994, -0.009500572457909584, -0.027864299714565277, 0.004644049797207117, 0.020230451598763466, 0.008081557229161263, -0.010889234952628613, 0.007633846718817949, -0.002604689681902528, -0.019335031509399414, -0.025830630213022232, -0.032690469175577164, -0.007243048399686813, -0.030444325879216194, 0.007091281935572624, 0.051934439688920975, 0.012664901092648506, 0.016861239448189735, 0.01742277480661869, 0.038730770349502563, -0.03089962527155876, -0.00019860047905240208, 0.024495085701346397, 0.020139392465353012, -0.008195382542908192, -0.040005605667829514, -0.02818300761282444, -0.03639356791973114, -0.04164468124508858, -0.07424408942461014, 0.05117560923099518, -0.005330792628228664, -0.003312300192192197, 0.0006450069486163557, -0.018166430294513702, -0.010775409638881683, 0.0028854573611170053, 0.046865444630384445, 0.0023144367150962353, -0.012983609922230244, -0.03472413867712021, 0.009523337706923485, 0.015464989468455315, -0.008225735276937485, 0.03930748254060745, -0.019926920533180237, 0.008923860266804695, 0.026392165571451187, -0.00574056152254343, -0.016663944348692894, 0.028425835072994232, 0.025845807045698166, 0.01757454127073288, 0.013750029727816582, 0.012224778532981873, 0.02733311615884304, -0.01053258404135704, -0.029518552124500275, 0.01904667541384697, 0.03432954475283623, 0.017953956499695778, -0.012596605345606804, -0.00863550417125225, -0.04088585078716278, -0.023872844874858856, -0.03214411064982414, -0.019077029079198837, 0.01535116508603096, -0.027742886915802956, -0.04680473729968071, 0.019137734547257423, -0.007356873247772455, -0.03162810578942299, 0.017134418711066246, 0.02950337529182434, -0.02271942049264908, -0.006548717152327299, 0.027272410690784454, -0.03909500688314438, -0.00191889563575387, -0.02578509971499443, -0.037182752043008804, 0.00415080925449729, 0.020260805264115334, -0.08444278687238693, 0.049961477518081665, -0.04795816168189049, 0.051813025027513504, -0.013962502591311932, 0.04920264706015587, 0.019365385174751282, 0.03724345937371254, 0.014592332765460014, 0.04386046901345253, -0.043192699551582336, 0.003847276559099555, -0.026118986308574677, -0.03375283256173134, -0.007383432239294052, 0.031263865530490875, -0.024404026567935944, 0.010798174887895584, 0.0007545632543042302, -0.04301057755947113, -0.03135492652654648, -0.04598519951105118, 0.0005003546248190105, -0.041250091046094894, 0.0370916910469532, 0.008187794126570225, -0.004325340501964092, 0.002375143114477396, -0.0097206337377429, -0.008415442891418934, 0.055151887238025665, -0.06410609930753708, 0.016284527257084846, 0.008923860266804695, -0.06580588221549988, -0.012953256256878376, -0.022506946697831154, 0.029017724096775055, 0.04416400194168091, 0.0012473295209929347, 0.03357071429491043, 0.005099348723888397, 0.04549954831600189, 0.035604383796453476, 0.02523874118924141, 0.005383910611271858, 0.06362044811248779, -0.04398188367486, -0.004719933029264212, -0.015024866908788681, -0.012497957795858383, 0.006450069136917591, 0.03945924714207649, 0.03760769963264465, -0.020260805264115334, -0.026103809475898743, -0.04379976540803909, 0.029791731387376785, 0.03939853981137276, -0.00038890124415047467, 0.007667994126677513, 0.0211410503834486, -0.019759977236390114, 0.021687408909201622, -0.01572299189865589, 0.04061267152428627, 0.0077173179015517235, -0.015062808990478516, -0.017938781529664993, -0.06061547249555588, -0.03432954475283623, 0.04149291664361954, -0.052905745804309845, -0.008225735276937485, -0.01927432417869568, 0.016709472984075546, -0.026892995461821556, 0.051479142159223557, 0.024631675332784653, -0.007019192911684513, 0.011306592263281345, 0.02895701676607132, 0.046470850706100464, -0.043921176344156265, 0.016421116888523102, 0.009227393195033073, -0.007034369744360447, -0.0319012850522995, 0.014979337342083454, 0.0404912568628788, -0.03202269598841667, 0.015396694652736187, -0.11267133057117462, 0.03220481798052788, 0.0057860915549099445, -0.06562376022338867, -0.019380560144782066, 0.021399052813649178, -0.019183265045285225, 0.01784772053360939, 0.0035608175676316023, -0.019228795543313026, -0.009432277642190456, 0.001978653483092785, 0.02753041312098503, 0.012475192546844482, 0.019608210772275925, -0.0069243391044437885, -0.001854394911788404, 0.0457727275788784, -0.019911743700504303, -0.027621472254395485, -0.03244764357805252, -0.015662286430597305, 0.005277674179524183, -0.018682435154914856, -0.01966891624033451, -0.018864555284380913, 0.012513134628534317, -0.005296645220369101, -0.00206591933965683, -0.013901796191930771, 0.007311343215405941, 0.01074505690485239, 0.0020052127074450254, -0.030474679544568062, -0.015472577884793282, -0.025253918021917343, -0.06173854321241379, -0.009326041676104069, -0.04947582632303238, 0.046319086104631424, -0.05099348723888397, -0.025572627782821655, 0.002369451802223921, -0.02164188027381897, 0.0016409734962508082, 0.016117583960294724, -0.0018809540197253227, -0.036181095987558365, -0.004917229060083628, -0.018515493720769882, 0.005220761988312006, -0.05478764697909355, 1.5621260899933986e-05, 0.034906256943941116, -0.013484438881278038, -0.006617011968046427, 0.04137150198221207, -0.005084172356873751, -0.01889490894973278, -0.011708772741258144, -0.0021683615632355213, -0.007364461198449135, 0.07539751380681992, 0.003456478239968419, -0.009371571242809296, 0.006514569744467735, 0.0025420861784368753, 0.004112867638468742, -0.04625837877392769, -0.03469378501176834, -0.014220505952835083, -0.026118986308574677, 0.010699526406824589, -0.033510006964206696, 0.036181095987558365, -0.0018164532957598567, 0.03754699230194092, -0.03305470943450928, -0.015100750140845776, 0.025178035721182823, 0.016618413850665092, 0.012725607492029667, -0.019608210772275925, 0.013954914174973965, -0.026650168001651764, 0.002739382442086935, -0.0414322093129158, -0.0033976687118411064, -0.025678863748908043, -0.00018721800006460398, -0.02563333325088024, -0.014250858686864376, 0.018303019925951958, 0.019001144915819168, 0.05405917018651962, 0.030216677114367485, 0.00219681765884161, -0.005296645220369101, 0.0001809339300962165, -0.010851292870938778, -0.06067617982625961, -0.03766840323805809, -0.021960588172078133, -0.014174975454807281, -0.010016578249633312, -0.023675547912716866, 0.025026269257068634, 0.013423732481896877, -0.019714446738362312, -0.033783186227083206, 0.02888113260269165, -0.015131103806197643, 0.00767558254301548, 0.013082258403301239, -0.007193724159151316, 0.023508604615926743, -0.04079478979110718, -0.018667258322238922, -0.010866469703614712, -0.01190606877207756, -0.015442224219441414, -0.019562680274248123, -0.020002802833914757, -0.01595064252614975, -0.004837552085518837, 0.049688298255205154, -0.022431064397096634, -0.013947325758635998, 0.005015877541154623, 0.012171659618616104, 0.03514908254146576, 0.031567398458719254, 0.010062107816338539, -0.015237339772284031, 0.0019539915956556797, 0.013810736127197742, 0.000943322607781738, -0.010115225799381733, 0.00362531840801239, 0.042524926364421844, -0.035331204533576965, 0.04164468124508858, -0.007318931631743908, 0.005850592162460089, -0.004317752085626125, 0.00505381915718317, -0.05238973721861839, 0.023372014984488487, 0.0009319401578977704, 0.002291671698912978, -0.03894324228167534, 0.0076983473263680935, 0.018864555284380913, -0.0012255131732672453, 0.005308027379214764, -0.01093476451933384, -0.026665344834327698, -0.01951714977622032, -0.01719512604176998, -0.007686964701861143, 0.011041000485420227, 0.023129189386963844, -0.03806299716234207, -0.012839431874454021, 0.01607205532491207, -0.017331715673208237, -0.008703798986971378, -0.02271942049264908, -0.0168460626155138, -0.012626959010958672, 0.02009386196732521, -0.006127565633505583, -0.017938781529664993, -0.029169488698244095, 0.0019805505871772766, 0.012133718468248844, -0.037850525230169296, 0.021611526608467102, -0.00853685662150383, 0.017286185175180435, 0.020184922963380814, 0.0020867870189249516, 3.930510865757242e-05, 0.0250110924243927, 0.022552477195858955, -0.011412828229367733, 0.006252773106098175, -0.002756456146016717, -0.016815710812807083, 0.037577345967292786, 0.02179364487528801, -0.04197856783866882, -0.0011581667931750417, 0.007998085580766201, -0.019092204049229622, 0.02668052166700363, -0.008187794126570225, 0.010843704454600811, 0.01471374649554491, -0.020002802833914757, 0.008969390764832497, 0.0027868093457072973, 0.012239955365657806, -0.03657568618655205, -0.02910878323018551, -0.004681991413235664, -0.0210955198854208, 0.03867006301879883, 0.019380560144782066, -0.013469262048602104, -0.0026786758098751307, 0.023508604615926743, 0.0172710083425045, 0.003832099959254265, 0.012611782178282738, -0.022355180233716965, -0.041098322719335556, -0.008165028877556324, -0.02101963758468628, 0.020974107086658478, 0.038791473954916, 0.0466226190328598, 0.007952556014060974, -0.04413365200161934, 0.01762007176876068, -0.010001401416957378, 0.037455931305885315, 0.01607205532491207, -0.043374817818403244, 0.01471374649554491, -0.03909500688314438, -0.005865768995136023, -0.058399684727191925, 0.017392421141266823, -0.011519065126776695, -0.004727521445602179, 0.0010927176335826516, 0.021474936977028847, -0.002944266889244318, 0.0135679105296731, 0.0011619610013440251, 0.022173061966896057, -0.0071102529764175415, 0.005915092770010233, 0.0168460626155138, -0.01707371324300766, -0.026726052165031433, -0.017392421141266823, -0.04920264706015587, 0.017255831509828568, 0.0198662132024765, -0.014061151072382927, 0.03332788869738579, -0.03171916306018829, 0.015707815065979958, 0.03961101174354553, 0.014584744349122047, -0.046319086104631424, 0.023827314376831055, 0.00975857488811016, 0.02149011380970478, 0.030838919803500175, 0.01345408521592617, 0.034633077681064606, -0.024130847305059433, -0.003196578472852707, -0.05214691162109375, 0.028198184445500374, 0.009492984041571617, 0.02825889177620411, 0.0012264617253094912, -0.04707791656255722, -0.0075731403194367886, -0.010031755082309246, -0.015191810205578804, 0.012771137058734894, -0.008931448683142662, -0.011936422437429428, -0.019684093073010445, 0.0024130847305059433, -0.015002102591097355, -0.008165028877556324, -0.032811880111694336, -0.0241612009704113, -0.01707371324300766, 0.01492621935904026, -0.030808566138148308, -0.020473279058933258, -0.10890752077102661, 0.013939738273620605, -0.010153167881071568, -0.020412571728229523, -0.031961988657712936, -0.015495343133807182, -0.0490812323987484, 0.013742441311478615, 0.016284527257084846, -0.012004717253148556, 0.014948983676731586, -0.04495318979024887, 0.00349821406416595, -0.03569544106721878, 0.012558664195239544, 0.009326041676104069, -0.013385790400207043, 0.002320127794519067, -0.017862897366285324, 0.03457237035036087, -0.027287587523460388, -0.041098322719335556, 0.013264377601444721, 0.0008280750480480492, -0.024297790601849556, -0.030884448438882828, -0.0750332772731781, -0.02648322470486164, -0.01250554621219635, -0.030247030779719353, -0.016755003482103348, 0.01035805232822895, 0.03223516792058945, 0.009508160874247551, -0.0051372903399169445, 0.03278153017163277, 0.01762007176876068, -0.043374817818403244, -0.02918466553092003, 0.008923860266804695, -0.0431319922208786, -0.03569544106721878, -0.01163288950920105, 0.020002802833914757, 0.03092997893691063, 0.009925518184900284, 0.004093897063285112, 0.005084172356873751, 0.01494139526039362, 0.0056001776829361916, 0.0018031737999990582, -0.040673378854990005, 0.012809078209102154, -0.010418758727610111, 0.012915315106511116, 0.008681034669280052, -0.03612038865685463, 0.007546580862253904, -0.012589017860591412, 0.005125908181071281, 0.05688202381134033, -0.016390765085816383, -0.00017796973406802863, 0.014744099229574203, 0.04525672271847725, 0.0016618414083495736, -0.005824033170938492, -0.027667002752423286, -0.035756148397922516, -0.017088890075683594, 0.007755259517580271, 0.05372528359293938, -0.0005880945245735347, 0.013370614498853683, -0.015017278492450714, 0.010001401416957378, 0.030064910650253296, -0.030808566138148308, -0.016284527257084846, 0.0271358210593462, 0.0049324058927595615, -0.02341754548251629, 0.009166686795651913, 0.00923498161137104, 0.0007697398541495204, -0.038579002022743225, -0.014706158079206944, 0.012194424867630005, 0.038852181285619736, -0.0012368956813588738, -0.010805763304233551, -0.01093476451933384, -0.021626703441143036, 0.01719512604176998, -0.0020867870189249516, 0.017862897366285324, 0.011701184324920177, 0.017802191898226738, -0.05509117990732193, 0.025420861318707466, 0.01997244916856289, 0.0139928562566638, -0.01667911931872368, -0.003797952551394701, 0.001995727187022567, 0.030945155769586563, -0.004071131814271212, -0.013082258403301239, 0.026650168001651764, -0.02608863264322281, -0.007303754799067974, 0.0026084838900715113, 0.013583087362349033, -0.0024206731468439102, 0.02745453082025051, 0.010418758727610111, -0.009682692587375641, 0.0012331014731898904, -0.0022651124745607376, 0.015427048318088055, 0.039702072739601135, -0.0012738886289298534, 0.014599921181797981, 0.0020526396110653877, -0.01560157909989357, 0.012680076994001865, 0.0062755378894507885, -0.016755003482103348, 0.00022575241746380925, -0.022203415632247925, 0.017013005912303925, -0.00984963495284319, -0.0045567844063043594, 0.014417801983654499, -0.02648322470486164, 0.02865348383784294, 0.029822085052728653, -0.04780639708042145, -0.00394971901550889, -0.033965304493904114, -0.005448411218822002, -0.0075124334543943405, -0.016891593113541603, 0.04710827022790909, -0.0023675549309700727, 0.033236827701330185, 0.004511254373937845, 0.003701201407238841, -0.029594434425234795, -0.0262859296053648, 0.013317495584487915, -0.019350208342075348, -0.008772093802690506, -0.016618413850665092, -0.0004002836940344423, -0.02264353632926941, -0.021004460752010345, 0.027591120451688766, 0.0008826160919852555, -0.01072229165583849, -0.026043102145195007, -0.041098322719335556, 0.015146280638873577, 0.023174719884991646, -0.013894207775592804, -0.01471374649554491, 0.0028683836571872234, -0.02234000526368618, 0.04689579829573631, 0.010714703239500523, 0.0046288734301924706, -0.03763804957270622, -0.0006255618645809591, -0.017908427864313126, -0.03681851178407669, 0.007907026447355747, 0.003221240360289812, -0.04091620445251465, 0.0431319922208786, 0.06028158962726593, -0.010464289225637913, 0.04552990198135376, -0.007383432239294052, -0.019926920533180237, -0.027591120451688766, 0.015980994328856468, -0.02036704123020172, -0.028562424704432487, 0.01877349615097046, 0.00965992733836174, -0.023630017414689064, -0.006066859234124422, 0.004541607573628426, 0.025648510083556175, -0.023751432076096535, -0.048292048275470734, -0.02036704123020172, 0.023159543052315712, 0.03426883742213249, -0.03208340331912041, 0.00963716208934784, 0.012361368164420128, 0.010911999270319939, 0.0021038607228547335, 0.019532326608896255, -0.01032011117786169, -0.004029395990073681, 0.004864111077040434, -0.003507699351757765, 0.006522158160805702, 0.018788672983646393, 0.007853907532989979, -0.0031700192485004663, 0.00395730696618557, -0.002978414297103882, 0.01687641628086567, -0.03460272401571274, 0.0015812155324965715, 0.02702958509325981, -0.015305634588003159, -0.014349507167935371, -0.006207243073731661, -0.023994257673621178, 0.020382218062877655, 0.0008883073460310698, 0.007186135742813349, 0.02825889177620411, -0.0250110924243927, 0.04543884098529816, 0.040400199592113495, 0.016390765085816383, -0.027166174724698067, 0.01602652482688427, -0.029973851516842842, 0.002593307290226221, 0.04249457269906998, -0.046440497040748596, 0.025618156418204308, -0.01076023280620575, -0.009280511178076267, -0.007349284831434488, -0.013089846819639206, -0.013150553219020367, -0.027803592383861542, -0.017043359577655792, 0.023144366219639778, 0.018014663830399513, -0.017134418711066246, -0.011261061765253544, -0.03247799724340439, -0.005368734244257212, 0.025375330820679665, 0.018910085782408714, 0.037880878895521164, 0.0012482780730351806, 0.007709729950875044, -0.021110696718096733, -0.003896600566804409, 0.011686007492244244, 0.040551964193582535, 0.020898224785923958, 0.01692194677889347, 0.02121693268418312, 0.028319597244262695, -0.012892549857497215, -0.0118681276217103, 0.002242347691208124, -0.00836232490837574, 0.005676060914993286, 0.04634943976998329, 0.015996171161532402, 0.028865957632660866, -0.006613218225538731, 0.002781118033453822, 0.018636906519532204, 0.014812394045293331, 0.007637640926986933, 0.003025841200724244, -0.0013478747569024563, 0.02349342778325081, 0.007686964701861143, -0.0033066091127693653, 0.05387704819440842, 0.012824255041778088, -0.015631932765245438, -0.004245663061738014, 0.005915092770010233, 0.009682692587375641, -0.003357830224558711, -0.01554087270051241, 0.017862897366285324, -0.05463588237762451, -0.024753089994192123, -0.010919587686657906, -0.028865957632660866, 0.03317612037062645, 0.005588795058429241, -0.0011477329535409808, 0.04944547265768051, -0.03085409663617611, 0.012429662980139256, -0.019881390035152435, -0.02186952903866768, -0.016360411420464516, -0.0030049735214561224, -0.03721310570836067, -0.0627705529332161, -0.007652817294001579, 0.02783394604921341, 0.04665297269821167, -0.024828972294926643, 0.03924677520990372, -0.025830630213022232, 0.027469705790281296, 0.007907026447355747, -0.020033156499266624, -0.008377501741051674, -0.0002743650693446398, -0.006237596273422241, -0.006446274928748608, -0.004803404677659273, -0.011390062980353832, -0.015662286430597305, 0.020958930253982544, -0.050234656780958176, -0.014023208990693092, 0.00878727063536644, 0.04425506293773651, -0.007455521263182163, 0.04149291664361954, -0.0033597273286432028, 0.016906769946217537, 0.017938781529664993, -0.01664876751601696, 0.003027738304808736, 0.014561980031430721, 0.031810224056243896, 0.008134675212204456, -0.0253905076533556, -0.010213874280452728, 0.00812708679586649, -0.006878809072077274, -0.012262719683349133, -0.016815710812807083, -0.01169359590858221, -0.034784842282533646, 0.0414322093129158, -0.013249200768768787, 0.022749774158000946, 0.04170538857579231, 0.01637558825314045, 0.02261318452656269, 0.003520979080349207, -0.022476594895124435, -0.011238297447562218, -0.011875716038048267, 0.00567985512316227, 0.009675104171037674, -0.027803592383861542, -0.019835859537124634, -0.012892549857497215, -0.021732939407229424, -0.0012729400768876076, 0.02668052166700363, 0.004336723126471043, 0.010342875495553017, -0.014880688861012459, 0.010767821222543716, -0.005444617476314306, 0.006040300242602825, -0.0026236604899168015, 0.02338719181716442, -0.009090803563594818, -0.006787749473005533, 0.020761635154485703, -0.03851829469203949, -0.015707815065979958, -0.01471374649554491, -0.049961477518081665, 0.005133496131747961, -0.02366037108004093, 0.011352121829986572, 0.00046146451495587826, -0.005596383474767208, -0.06368115544319153, -0.013264377601444721, -0.010198697447776794, 0.03527049720287323, -0.006920544896274805, -0.032113756984472275, 0.0009855326497927308, -0.03487590327858925, -0.025269094854593277, -0.0059112985618412495, -0.0027545590419322252, -0.01536634098738432, -0.013294731266796589, 0.0006241390365175903, -0.006336244288831949, -0.015616755932569504, -0.013833501376211643, -0.008711387403309345, 0.023933550342917442, -0.030671976506710052, 0.014174975454807281, 0.0011135854292660952, -0.007702141534537077, 0.0035039051435887814, 0.003945924807339907, 0.0036708482075482607, 0.025997573509812355, 0.05624460428953171, 0.023129189386963844, 0.011192766949534416, 0.03657568618655205, -0.01320367120206356, -0.01765042543411255, -0.009713045321404934, 0.024100493639707565, -0.017453128471970558, 0.004765463061630726, -0.011777067556977272, -0.00770593574270606, 0.0007441292982548475, -0.015533284284174442, -0.008620328269898891, 0.022552477195858955, 9.520965977571905e-05, 0.019501974806189537, -0.013932149857282639, 0.028198184445500374, -0.03314576670527458, 0.0014948983443900943, -0.011177590116858482, -0.02845618687570095, -0.0253905076533556, -0.03065679967403412, 0.007614875677973032, 0.0101228142157197, -0.02818300761282444, 0.005076583940535784, 0.0031187981367111206, 7.612030458403751e-05, 0.01039599347859621, -0.005577412899583578, -0.03994489833712578, -0.000536399136763066, 0.0008925757720135152, 0.1361040472984314, -0.0008693365380167961, 0.0054977354593575, -0.011041000485420227, 0.017316538840532303, -0.013848678208887577, -0.03208340331912041, 0.012391720898449421, -0.024252260103821754, 0.030444325879216194, 0.012862197123467922, 0.014736510813236237, 0.03259940817952156, 0.0020716104190796614, 0.011686007492244244, 0.006279332097619772, -0.011731537990272045, -0.030565740540623665, -0.00921221636235714, -0.0026141752023249865, 0.018864555284380913, -0.007034369744360447, 0.014531626366078854, -0.025041446089744568, 0.01409150380641222, -0.010471876710653305, 0.038002289831638336, 0.006457657553255558, 0.0114431818947196, 0.046288732439279556, 0.013765206560492516, 0.004594725556671619, -0.04176609590649605, 0.02848654054105282, 0.014319153502583504, 0.006537334993481636, -0.023205071687698364, -0.010707114823162556, -0.006142742466181517, -0.005930269602686167, 0.01248278096318245, 0.016193468123674393, 0.002246141666546464, 0.003488728543743491, 0.0032971235923469067, 0.023432722315192223, -0.001986241899430752, -0.028926663100719452, 0.004515048582106829, 0.00038036436308175325, 0.012862197123467922, 0.033661771565675735, 0.008430619724094868, 0.019304677844047546, 0.01625417359173298, -0.011822597123682499, -0.016405940055847168, 0.04671367630362511, 0.005125908181071281, 0.0414322093129158, -0.05949240177869797, -0.0012169763213023543, -0.005125908181071281, 0.011784655973315239, 0.00440501794219017, 0.0015907009365037084, 0.026923347264528275, -0.03432954475283623, 0.00020927154400851578, -0.03232622891664505, -0.04398188367486, 0.0036063475999981165, 0.027500059455633163, -0.024570969864726067, 0.01120794378221035, 0.013719676993787289, -0.010623643174767494, 0.015920288860797882, -0.022947069257497787, 0.011124472133815289, 0.015518107451498508, 0.01927432417869568, 0.07667235285043716, 0.019851036369800568, -0.02640734240412712, -0.008415442891418934, -0.026301106438040733, -0.009788928553462029, 0.01515386812388897, -0.023721078410744667, 0.03514908254146576, 0.006211037281900644, -0.010100049898028374, -0.005888533778488636, -0.027120644226670265, -0.007136811967939138, -0.03924677520990372, -0.0036651568952947855, 0.0018192989518865943, -0.016937123611569405, -0.011875716038048267, -0.015783699229359627, -0.006772572640329599, -0.00046312445192597806, -0.009978636167943478, -0.01114723738282919, -0.003496316960081458, -0.03138527646660805, 0.018242312595248222, 0.012255131267011166, -0.01734689250588417, 0.01384108979254961, -0.019881390035152435, 0.023569311946630478, 0.0032971235923469067, -0.017680777236819267, -0.016163114458322525, 0.04977935925126076, -0.01447850838303566, 0.007595905102789402, 0.010714703239500523, 0.008688623085618019, 0.02051880769431591, -0.03272082284092903, -0.006525952368974686, -0.015707815065979958, 0.02810712531208992, 0.014425390399992466, 0.034238483756780624, -0.023523781448602676, -0.03384389355778694, 0.009804105386137962, 0.0073948148638010025, -0.0017054742202162743, 0.028774896636605263, -0.015419459901750088, 0.00039648954407311976, -0.023705901578068733, -0.016588060185313225, 0.0046288734301924706, 0.005182820372283459, -0.00136684556491673, 0.006954692304134369, -0.01680053398013115, 0.02303813025355339, 0.013985267840325832, 0.019335031509399414, 0.038154058158397675, -0.033510006964206696, -0.015062808990478516, -0.026726052165031433, 0.022097177803516388, 0.009857223369181156, 0.013158141635358334, 0.013507204130291939, 0.011033413000404835, 0.001447471440769732, -0.016087232157588005, -0.012027482502162457, 0.03193163499236107, -0.0786149650812149, -0.023751432076096535, -0.00526629202067852, 0.008468561805784702, -0.013939738273620605, -0.009515749290585518, -0.03082374297082424, 0.018758319318294525, 0.011981952004134655, 0.02868383750319481, 0.01931985467672348, -0.031172804534435272, -0.011541829444468021, -0.007713524159044027, 0.013317495584487915, -0.018636906519532204, 0.0042836046777665615, 0.013537556864321232, -0.021535642445087433, 0.017468305304646492, -0.00317381345666945, 0.021732939407229424, 0.0019900361075997353, 0.024404026567935944, 0.017756661400198936, -0.01652735471725464, -0.015358753502368927, -0.02763664908707142, 0.010441523976624012, -0.031142452731728554, -0.008756917901337147, -0.04061267152428627, 0.002741279313340783, -0.02558780461549759, -0.011883304454386234, 0.005046230740845203, -0.006340038497000933, -0.027226880192756653, -0.04185715690255165, 0.021672232076525688, -0.021186580881476402, -0.005630530882626772, -0.023857668042182922, 0.04452824220061302, -0.022506946697831154, 0.009796516969799995, -0.0077856131829321384, -0.01430397666990757, 0.00010202729026786983, 0.02598239667713642, -0.008483737707138062, 0.01857619918882847, 0.020002802833914757, 0.025648510083556175, 0.020958930253982544, 0.03314576670527458, 0.010836116038262844, 0.02171776257455349, -0.008036027662456036, -0.011974363587796688, -0.010828527621924877, -0.011078942567110062, -0.007580728270113468, -0.02563333325088024, 0.006567688193172216, -0.036879219114780426, 0.02705993689596653, -0.018515493720769882, -0.010684349574148655, 0.003414742648601532, -0.01622382178902626, 0.034511663019657135, -0.011610124260187149, -0.014296389184892178, 0.0010386508656665683, -0.0045491959899663925, -0.02636181190609932, 0.0022897745948284864, -0.02396390400826931, 0.02291671745479107, -0.028592778369784355, 0.001227410277351737, -0.04325340688228607, 0.0061503308825194836, -0.025527097284793854, 0.031263865530490875, 0.04358728975057602, 0.007330313790589571, 0.05275397747755051, -0.012103364802896976, 0.0020431543234735727, -0.004515048582106829, -0.022157885134220123, -0.0044884891249239445, -0.02860795333981514, -0.038032643496990204, -0.02563333325088024, -0.04583343490958214, -0.01018352061510086, -0.030474679544568062, 0.0008465715800411999, 0.0004073977470397949, 0.04358728975057602, -0.012733195908367634, -0.020700927823781967, -0.011321768164634705, 0.003972483798861504, 0.03290294110774994, 0.018014663830399513, -0.02613416314125061, 0.011799832805991173, 0.006518363952636719, -0.0241612009704113, 0.018485140055418015, -0.024404026567935944, 0.02106516808271408, 0.005714002531021833, 0.009546102024614811, -0.013727265410125256, -0.026574285700917244, -0.02660463936626911, 0.012847020290791988, -0.02136869914829731, -0.039550308138132095, 0.0037865701597183943, -0.02566368691623211, -0.01426603551954031, -0.010767821222543716, 0.03751663863658905, -0.004792022053152323, -0.027515236288309097, 0.007922202348709106, -0.006286920513957739, 0.02296224609017372, -0.0014000444207340479, -0.014311565086245537, -0.04777604341506958, -0.04801886901259422, -0.015586402267217636, -0.017665602266788483, 0.01645147055387497, -0.01874314248561859, 0.003488728543743491, -0.021611526608467102, 0.04285881295800209, 0.010244227945804596, 0.04437647759914398, -0.025056621059775352, -0.0008987412438727915, -0.0024681000504642725, 0.04859558120369911, 0.015131103806197643, -0.018105722963809967, 0.03867006301879883, 0.016982652246952057, 0.017468305304646492, 0.027818769216537476, 0.026619814336299896, -0.00987240020185709, 0.01672464981675148, 0.03217446431517601, 0.012573841027915478, 0.014448154717683792, -0.0028645896818488836, 0.018788672983646393, 0.0007906077662482858, -0.005566030275076628, -0.013249200768768787, 0.024404026567935944, 0.017984310165047646, 0.0016011347761377692, 0.013598263263702393, -0.011116883717477322, -0.0551215335726738, 0.01889490894973278, 0.0010889234254136682, 0.007383432239294052, 0.0211410503834486, 0.02725723385810852, -0.03092997893691063, -0.038579002022743225, 0.02276495099067688, 0.021186580881476402, 0.034511663019657135, -0.014668215997517109, 0.026194868609309196, 0.030914802104234695, -0.01032011117786169, -0.005577412899583578, -0.016739826649427414, -0.004530224949121475, -0.004101485013961792, -0.036029327660799026, 0.026270752772688866, 0.02988279052078724, -0.0122703080996871, 0.015844404697418213, -0.010631231591105461, 0.013218848034739494, -0.02485932596027851, -0.007497257087379694, 0.020336689427495003, 0.01842443272471428, 0.010244227945804596, -0.00041427466203458607, 0.020503632724285126, 0.0063476269133389, 0.015191810205578804, 0.019183265045285225, 0.01742277480661869, -0.004420194309204817, 0.009781340137124062, -0.022704243659973145, -0.03499731793999672, 0.016785357147455215, -0.032538700848817825, -0.007163370959460735, 0.025466391816735268, 0.020898224785923958, 0.016512177884578705, -0.0006118080345913768, -0.017938781529664993, -0.010767821222543716, 0.03499731793999672, 0.04146256297826767, 0.008893507532775402, -0.014068739488720894, -0.02693852409720421, 0.02693852409720421]
Plotting a vector using matplotlib
Something more viewable for a human is a plot of a vector. This can be achieved via Python and matplotlib:
mport matplotlib.pyplot as plt
def render_vector(vector, filename):
"""Visualize the values of the vector in a bar chart"""
fig = plt.figure()
ax = fig.add_subplot(111)
# Set the face color of the axis (plot area) to light gray
ax.set_facecolor("#ffffff")
# Make sure the figure face color is transparent
fig.patch.set_alpha(0.0)
ax.bar(range(len(vector)), vector, color="#0020BE") # Set bar color to purple
ax.set_xlabel('Dimension', fontweight='bold') # Make x-axis label bold
ax.set_ylabel('Value', fontweight='bold') # Make y-axis label bold
# Adjust the height of the graph
fig.set_size_inches(fig.get_size_inches()[0], 3)
plt.show()
fig.savefig(filename, transparent=False, dpi=300, bbox_inches='tight')
render_vector(embedding, "geektechstuff.png")
