2bf6b2a7f6
Signed-off-by: Michael Mayer <michael@photoprism.app>
160 lines
72 KiB
Go
160 lines
72 KiB
Go
package face
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestEmbeddings_Empty(t *testing.T) {
|
|
e1 := Embedding{-0.00067741907, -0.0473858, -0.055704225, 0.066581585, 0.005290037, 0.03822874, -0.05082791, 0.049087, 0.018308854, -0.01478969, -0.0017964382, 0.057903986, -0.02245441, -0.033446193, -0.0071987803, -0.03150515, 0.017724376, 0.019948162, 0.056362633, -0.11701946, -0.09725581, 0.013104323, 0.07357148, -0.020104313, -0.014956488, -0.017257847, -0.020743687, -0.046340823, -0.021527996, 0.057039287, -0.051751148, -0.00595411, 0.011733857, -0.04644382, -0.028774152, 0.038308877, -0.015685631, 0.0038190065, -0.094677314, 0.07005245, -0.003068884, 0.050274804, -0.018143218, 0.012056174, 0.019058047, -0.00077958487, 0.030408988, 0.0885491, -0.11106459, -0.019910613, 0.01465938, 0.032499526, 0.04720623, 0.03163276, -0.079508044, 0.07914293, 0.03724754, 0.05636608, -0.016979787, -0.04298359, -0.03599786, 0.058342796, -0.024069536, -0.03200436, 0.015390179, 0.07293075, -0.0013783299, -0.01605161, -0.0045498423, -0.016551308, 0.060823392, 0.073548146, -0.021239666, -0.036749583, 0.00028047478, -0.025989566, -0.05310693, -0.009845653, -0.012862101, 0.058108855, 0.06915682, 0.021099294, 0.001225616, 0.033261415, 0.042154703, 0.05271609, -0.030613305, 0.041209485, 0.0019353209, -0.0019135632, 0.080911145, 0.011060149, 0.05281461, -0.10160427, 0.053647887, 0.01762615, -0.018661015, 0.02777136, -0.056023918, 0.057687696, 0.06513923, -0.069180146, -0.015231091, 0.03774808, 0.012945786, 0.090585396, 0.019942591, -0.015280875, -0.0011742035, -0.042135417, 0.05812486, 0.05519544, -0.06453465, -0.04014237, -0.03199121, 0.009241696, 0.043912023, 0.015467731, 0.0020673021, 0.08763925, -0.08974939, -0.05304043, 0.016309343, -0.04766073, -0.0046682972, -0.040477246, 0.012679025, 0.005960806, -0.03256039, -0.07089416, -0.02648642, -0.062463485, 0.08295411, -0.037147924, -0.074104264, 0.077417135, -0.042383663, 0.002088579, 0.07709948, 0.06521331, -0.07541816, 0.057679284, -0.0038482754, 0.055191133, 0.058614884, -0.018541405, -0.012277692, 0.057926673, -0.01724738, 0.020869015, 0.046103075, -0.0319926, -0.0671411, 0.02629761, 0.044356663, 0.036788594, 0.028035736, 0.06419986, 0.045972086, -0.044160895, 0.09784713, 0.00953585, -0.06252615, 0.025597766, 0.029688764, 0.027506752, -0.055384982, -0.028262418, -0.057812758, 0.042470966, -0.05840525, -0.03801629, 0.0043816785, -0.015086851, 0.022297874, 0.054110903, 0.07420415, -0.040949743, -0.08912868, -0.060081407, -0.046966024, -0.04826231, -0.031198893, 0.06643161, 0.01347482, 0.029003717, 0.047974125, 0.07580259, 0.0364837, 0.012980756, 0.020622224, -0.022555852, 0.10519882, -0.03425076, 0.03889103, -0.007944982, 0.060116176, 0.038143042, -0.043681793, 0.05316621, 0.0016697546, -0.0033659195, 0.020053076, -0.07204762, 0.009732797, 0.03862544, 0.03913928, -0.009832126, 0.06401315, 0.044209804, -0.051490918, 0.014780334, -0.025438532, -0.01395564, -0.038089562, -0.009803314, -0.04146325, 0.03357636, -0.009009651, 0.04373462, -0.05627207, -0.072068065, -0.007331119, -0.04238925, -0.021102922, -0.021610938, -0.063095644, -0.05075978, -0.07491732, 0.0113026835, 0.04940704, 0.084163934, -0.01636119, -0.06292533, -0.014526007, -0.007826649, 0.07212185, 0.004734863, -0.062791124, -0.016170232, -0.016590146, -0.024280416, -0.019522576, 0.01579864, 0.002749153, 0.053687476, -0.016495354, 0.03662209, -0.018870195, 0.039446633, 0.04715818, 0.013310755, 0.028033575, 0.067203104, -0.005826697, 0.042239364, -0.020745477, 0.0015561507, 0.065384425, 0.09041862, 0.01788624, -0.010026493, 0.0639752, -0.0041079777, -0.058741663, 0.034099422, 0.016963305, -0.0052649197, -0.07403116, -0.0029912698, -0.07583906, 0.001012409, -0.029492352, -0.04166984, -0.048218843, -0.06306306, -0.0033243645, -0.02919451, 0.0039520795, -0.037993237, 0.044352133, 0.03976749, -0.030565975, -0.076377496, -0.06569797, 0.01630497, 0.017201763, 0.028935125, 0.004058029, -0.09946857, 0.036038112, -0.06792709, 0.04493338, 0.035801385, -0.048764315, -0.06326099, 0.037968885, 0.038012274, 0.038041856, 0.04288072, 0.01531972, 0.032477308, 0.043926656, -0.0077148937, 0.056322563, -0.03451439, -0.0083661955, 0.0015379508, -0.007879496, 0.01986026, -0.019533899, 0.0405012, 0.015047856, 0.04601962, 0.080275685, 0.017424034, -0.032671392, 0.024088044, -0.021807125, 0.010775311, 0.094901696, 0.0048406925, 0.013086048, 0.04339756, -0.0069915624, 0.019183818, 0.0624931, 0.019509323, 0.07727781, 0.071851335, 0.046544127, 0.040363774, -0.027118236, 0.06800823, -0.01851149, 0.039025713, -0.037301723, 0.05617681, 0.027737545, -0.0011841523, 0.034742635, 0.006083848, 0.033872508, 0.012025738, -0.02354928, -0.07461171, 0.0027702893, 0.04646551, 0.06590462, -0.00794524, -0.011096932, 0.031695057, -0.06732352, -0.051879242, -0.0773121, -0.000517982, 0.08113213, -0.015312499, 0.018544769, -0.023654874, -0.01689197, 0.026425209, -0.08191027, 0.03139842, -0.011997609, 0.059896134, 0.07505033, -0.012907369, 0.008597082, 0.007715897, -0.07062183, -0.027084265, 0.0028182073, 0.03769887, 0.034299187, 0.046780333, -0.007847023, -0.051446356, 0.007982996, -0.034917314, -0.0038174198, -0.05954771, -0.044208106, 0.04685703, -0.0199229, -0.0032713648, 0.009684984, -0.050678924, 0.007356914, -0.06628045, 0.042982273, 0.0055478252, 0.011330174, -0.082057334, 0.026437566, -0.015942575, 0.048285805, -0.003856138, 0.04399534, 0.01741405, -0.059217025, 0.056499016, -0.03459506, 0.030366927, 0.016147505, -0.021027595, -0.013333387, -0.035330992, 0.0445699, -0.03483558, 0.02072434, -0.019552084, -0.0043943045, -0.03957101, 0.0041682394, 0.006047565, 0.03504845, 0.04675005, -0.021805461, -0.0033183587, -0.0017508261, 0.033419013, 0.008266579, 0.067113, -0.026226636, -0.020189233, 0.029219048, 0.031028047, 0.021648621, -0.055164326, -0.008505359, 0.05173594, 0.016450783, -0.017234024, -0.10492493, -0.04954522, 0.024168914, -0.008840458, -0.078473605, -0.042714797, -0.040692057, -0.05446264, 0.0148880705, 0.057658363, 0.005458192, 0.02171352, -0.04556389, 0.017333247, -0.10342444, -0.06159851, -0.03170678, 0.08064648, 0.024460033, -0.07185376, -0.0019515441, -0.026248276, 0.034460787, 0.08695437, 0.06363327, 0.012909266, 0.00093975884, 0.03682474, -0.041370448, -0.0070990156, 0.058603138, -0.038166087, -0.039693672, 0.025385896, 0.0035452761, -0.015794974, 0.019059189, -0.028707229, 0.038948998, -0.032039847, -0.07992934, -0.05482927, 0.048767164, -0.03186542, 0.059099294, 0.063702375, 0.01810526, -0.019284561, 0.036313917, 0.0006970895, 0.020730797, 0.08630282, -0.10650717, 0.0017196184, 0.023258938, -0.021214833, 0.015206377, -0.027243242, -0.021319263, -0.054438062, 0.066603355, -0.047786396, 0.018822387, -0.031346995, -0.0049103773, -0.020732613, -0.0841506, 0.00707288, -0.0033278253, 0.068160556, -0.011127404, 0.05533654, 0.0046188673, 0.039132893, 0.008633137, -0.057081457, -0.030337824, -0.0721918}
|
|
e2 := Embedding{-0.037731018, -0.005501065, 0.04339579, 0.050818004, -0.059338734, 0.033849984, -0.006599584, -0.0017643301, 0.049746443, -0.103716515, 0.037138782, -0.0064612515, 0.071909964, 0.013218528, -0.065359734, 0.11057091, 0.031195551, 0.025612833, 0.0075477255, -0.034973715, -0.013490629, -0.08104751, -0.022038054, -0.05304818, 0.008366317, -0.056096837, -0.008484318, 0.049539477, 0.019540254, 0.067417614, -0.027856546, -0.008532138, -0.017063588, -0.00016265438, -0.106199585, 0.03904082, 0.030587498, 0.043008707, -0.015111545, -0.022849092, 0.0025588698, -0.012814152, 0.037556626, -0.0086288145, 0.05265788, 0.011832273, 0.00015048613, -0.0081366515, 0.0013409692, 0.028389124, 0.022627315, -0.015008434, -0.0007749727, 0.013927345, -0.012275729, -0.0090859635, 0.019502806, -0.011900984, 0.016286656, 0.08094661, 0.000306613, -0.06327904, 0.018552454, 0.08885108, -0.07583091, 0.09275318, -0.018484656, 0.074180886, -0.039385945, -0.08063905, -0.05360434, -0.037074074, 0.09909196, 0.025063906, -0.009406389, -0.029612983, -0.018644262, 0.08433939, -0.04466277, -0.07118042, -0.0053266245, -0.07471344, 0.06739151, -0.05399609, 0.03125197, -0.00007781149, -0.04214992, -0.044316035, 0.025013437, 0.031466946, 0.0023496088, 0.042693187, -0.046198968, 0.026152546, -0.017578958, 0.023763098, 0.027511515, -0.05229892, -0.005204117, 0.035853546, -0.031919815, -0.027175877, -0.033706605, 0.018576957, -0.0010251165, -0.006808904, 0.009910016, -0.046926413, -0.02833718, 0.0132687995, -0.033933964, 0.06434295, 0.046245363, 0.044698197, 0.041076522, 0.04224362, -0.050834127, 0.0037004466, 0.061506275, -0.018232772, 0.067569405, 0.048701495, 0.042266034, -0.11045008, 0.03627151, -0.07259142, -0.0027725939, 0.040572345, 0.010365194, -0.018683784, 0.004533848, 0.037213936, -0.050944775, 0.07134523, 0.004012727, 0.036228556, -0.013853831, -0.06910639, -0.011394227, -0.012075533, 0.036311198, -0.02587341, -0.04086224, -0.024498813, -0.019423751, -0.022674281, 0.052483488, 0.026303312, -0.051178075, 0.008410645, 0.039851066, -0.028721321, -0.027934253, -0.029567441, 0.054549955, 0.07423011, -0.07211806, 0.015979288, 0.002092099, 0.049062036, 0.025120452, 0.045975365, 0.025024865, -0.04019101, 0.0013054911, -0.0049644294, 0.0065203104, -0.03237452, -0.020704443, 0.028736785, -0.027353559, 0.07551169, 0.0842262, 0.019992182, 0.11138123, -0.028617613, 0.06700691, -0.048681036, -0.008201593, -0.058066163, 0.027867565, 0.07693089, -0.033642102, -0.05855467, -0.08575646, -0.019721355, 0.018443357, -0.0037373751, 0.032450553, -0.0074002664, -0.028135147, 0.046631414, 0.0192969, -0.0071076434, -0.004898368, 0.011896125, -0.026020564, 0.074016415, -0.033884488, -0.07919758, 0.021606326, -0.0142197255, 0.0807476, 0.03722956, -0.0015949347, 0.008076167, -0.009640628, 0.02341143, 0.015375526, -0.059428506, 0.051759534, 0.028049389, 0.07790443, 0.0478649, 0.09191913, -0.055882096, -0.026637457, 0.01236174, -0.0033003334, 0.008522798, 0.027216703, -0.033221588, -0.028086975, -0.11505473, -0.044336796, 0.013873659, 0.03982099, 0.060988583, -0.07439005, 0.01333661, -0.004818605, 0.02561305, -0.059055943, 0.0081638545, -0.032278564, 0.046092775, 0.025316834, -0.046857174, -0.0341012, 0.04379944, -0.029710777, 0.09238533, 0.009769442, 0.018552538, -0.02632421, 0.033739865, -0.022547472, 0.016400741, -0.05336998, -0.012623122, -0.08303054, -0.010368709, 0.01690871, 0.0014627968, -0.050720602, 0.038742293, -0.065664165, -0.10676187, -0.013403239, 0.075702645, -0.055623896, -0.03871971, -0.042371742, 0.03794916, -0.0590573, -0.002583715, -0.029995736, -0.08144537, -0.043295015, -0.034286328, -0.026538746, 0.01953962, 0.08203153, 0.036415525, 0.045531306, 0.004713152, 0.026550433, -0.0055336948, -0.031087596, -0.01923592, -0.1047651, 0.051826596, -0.009522955, 0.0023846119, -0.030824797, 0.0011774554, 0.03384506, 0.010090165, -0.033521466, -0.052155476, 0.0032979914, -0.004305921, -0.08622774, 0.03262125, 0.06332183, 0.00067599304, 0.01989574, 0.04406689, 0.019945903, -0.003796719, 0.00025200442, -0.010055775, 0.04070448, -0.004082432, -0.026942603, 0.110138796, -0.029453337, 0.015611174, 0.08778206, -0.027199872, -0.014513782, 0.021546016, 0.01706933, -0.01365763, 0.026393317, -0.029974515, 0.0050973813, 0.00732006, 0.034644503, 0.03125295, -0.01563078, -0.041023903, -0.04566191, -0.00013489528, 0.04253813, 0.045907266, -0.011943533, 0.031480506, -0.0034109016, -0.035025172, 0.028193155, -0.06832476, -0.0019371725, -0.049427234, -0.0061696135, 0.051213425, 0.07832765, -0.01894849, 0.0290217, 0.031639505, -0.045830216, -0.048976466, 0.052241277, -0.026111973, 0.037248738, -0.07693719, -0.00020981894, 0.030037824, -0.041687537, -0.015251262, 0.041234106, 0.031005232, 0.024838371, 0.0020733695, -0.038252156, -0.026375879, 0.03495583, 0.018539391, -0.07203285, 0.006305707, -0.004792029, -0.05153865, 0.0072443904, -0.017075827, 0.013596034, -0.0054885144, -0.052320853, -0.033805914, -0.038080305, -0.010182737, 0.012953395, 0.014565793, -0.023107765, 0.030313661, 0.011124675, 0.018100796, 0.1074551, -0.074430406, -0.04017658, -0.002058053, -0.07340946, 0.0033503077, 0.04565434, -0.033483636, -0.029218825, -0.05245377, -0.059680052, 0.017752757, -0.05493096, -0.10746678, 0.08623605, 0.014577705, 0.0044184765, -0.025559181, -0.015846781, -0.006661373, 0.09459266, 0.036481388, 0.030402042, -0.0152169075, 0.0037343376, 0.024195764, -0.01859682, -0.0022416788, 0.0056786016, -0.06771737, 0.02364697, 0.021247962, 0.05002757, 0.083975114, 0.011197936, 0.0035017033, -0.0014220127, -0.024415374, 0.023921741, -0.0108229555, -0.06622103, -0.00024976654, 0.06549428, -0.004968772, -0.011665843, 0.03409593, 0.028397659, -0.086434126, -0.074232705, 0.041721817, -0.034767248, -0.014432104, 0.006313255, 0.04040112, -0.0050085387, -0.0023618732, -0.02225774, 0.02383989, 0.061036374, 0.058602326, 0.04343989, -0.029145751, 0.0369256, -0.054843802, -0.017078603, 0.047091234, 0.050245833, -0.04615808, -0.02404996, 0.02584908, -0.006215116, -0.016719814, 0.052097827, 0.01908364, -0.07564805, -0.11024787, -0.036854018, -0.0056766514, -0.007618422, 0.034403287, 0.056957226, -0.03565076, -0.0365251, 0.040833052, 0.008173664, -0.04300709, 0.0028465139, -0.020792698, 0.020321466, -0.002447697, 0.019681728, -0.08843341, -0.042670425, 0.014576458, 0.009701015, -0.12435015, -0.025056241, 0.03084893, -0.031128377, 0.006784327, 0.052201632, 0.06773422, 0.015289244, 0.009421969, 0.0725144, -0.07110377, -0.05183192, -0.008816121, -0.11178569, 0.079700254, -0.0110752955, 0.0046521816, -0.07299747, 0.10732809, -0.06012486, 0.057736155, -0.02227576, -0.063017495, 0.085292354, 0.037407015, -0.07368719, 0.033426613, 0.062104296, -0.016089993, -0.023178348, -0.064638525, 0.028132388, -0.049967688, 0.053581465, 0.031400185, 0.0712773, -0.012665878, 0.0760322, 0.030081542, -0.022147592, 0.009422989}
|
|
one := Embeddings{e1}
|
|
two := Embeddings{e1, e2}
|
|
|
|
t.Run("True", func(t *testing.T) {
|
|
assert.True(t, Embeddings{}.Empty())
|
|
assert.False(t, IgnoredEmbeddings.Empty())
|
|
})
|
|
t.Run("False", func(t *testing.T) {
|
|
assert.False(t, one.Empty())
|
|
assert.False(t, two.Empty())
|
|
assert.False(t, IgnoredEmbeddings.Empty())
|
|
})
|
|
}
|
|
|
|
func TestEmbeddings_Count(t *testing.T) {
|
|
e1 := Embedding{-0.00067741907, -0.0473858, -0.055704225, 0.066581585, 0.005290037, 0.03822874, -0.05082791, 0.049087, 0.018308854, -0.01478969, -0.0017964382, 0.057903986, -0.02245441, -0.033446193, -0.0071987803, -0.03150515, 0.017724376, 0.019948162, 0.056362633, -0.11701946, -0.09725581, 0.013104323, 0.07357148, -0.020104313, -0.014956488, -0.017257847, -0.020743687, -0.046340823, -0.021527996, 0.057039287, -0.051751148, -0.00595411, 0.011733857, -0.04644382, -0.028774152, 0.038308877, -0.015685631, 0.0038190065, -0.094677314, 0.07005245, -0.003068884, 0.050274804, -0.018143218, 0.012056174, 0.019058047, -0.00077958487, 0.030408988, 0.0885491, -0.11106459, -0.019910613, 0.01465938, 0.032499526, 0.04720623, 0.03163276, -0.079508044, 0.07914293, 0.03724754, 0.05636608, -0.016979787, -0.04298359, -0.03599786, 0.058342796, -0.024069536, -0.03200436, 0.015390179, 0.07293075, -0.0013783299, -0.01605161, -0.0045498423, -0.016551308, 0.060823392, 0.073548146, -0.021239666, -0.036749583, 0.00028047478, -0.025989566, -0.05310693, -0.009845653, -0.012862101, 0.058108855, 0.06915682, 0.021099294, 0.001225616, 0.033261415, 0.042154703, 0.05271609, -0.030613305, 0.041209485, 0.0019353209, -0.0019135632, 0.080911145, 0.011060149, 0.05281461, -0.10160427, 0.053647887, 0.01762615, -0.018661015, 0.02777136, -0.056023918, 0.057687696, 0.06513923, -0.069180146, -0.015231091, 0.03774808, 0.012945786, 0.090585396, 0.019942591, -0.015280875, -0.0011742035, -0.042135417, 0.05812486, 0.05519544, -0.06453465, -0.04014237, -0.03199121, 0.009241696, 0.043912023, 0.015467731, 0.0020673021, 0.08763925, -0.08974939, -0.05304043, 0.016309343, -0.04766073, -0.0046682972, -0.040477246, 0.012679025, 0.005960806, -0.03256039, -0.07089416, -0.02648642, -0.062463485, 0.08295411, -0.037147924, -0.074104264, 0.077417135, -0.042383663, 0.002088579, 0.07709948, 0.06521331, -0.07541816, 0.057679284, -0.0038482754, 0.055191133, 0.058614884, -0.018541405, -0.012277692, 0.057926673, -0.01724738, 0.020869015, 0.046103075, -0.0319926, -0.0671411, 0.02629761, 0.044356663, 0.036788594, 0.028035736, 0.06419986, 0.045972086, -0.044160895, 0.09784713, 0.00953585, -0.06252615, 0.025597766, 0.029688764, 0.027506752, -0.055384982, -0.028262418, -0.057812758, 0.042470966, -0.05840525, -0.03801629, 0.0043816785, -0.015086851, 0.022297874, 0.054110903, 0.07420415, -0.040949743, -0.08912868, -0.060081407, -0.046966024, -0.04826231, -0.031198893, 0.06643161, 0.01347482, 0.029003717, 0.047974125, 0.07580259, 0.0364837, 0.012980756, 0.020622224, -0.022555852, 0.10519882, -0.03425076, 0.03889103, -0.007944982, 0.060116176, 0.038143042, -0.043681793, 0.05316621, 0.0016697546, -0.0033659195, 0.020053076, -0.07204762, 0.009732797, 0.03862544, 0.03913928, -0.009832126, 0.06401315, 0.044209804, -0.051490918, 0.014780334, -0.025438532, -0.01395564, -0.038089562, -0.009803314, -0.04146325, 0.03357636, -0.009009651, 0.04373462, -0.05627207, -0.072068065, -0.007331119, -0.04238925, -0.021102922, -0.021610938, -0.063095644, -0.05075978, -0.07491732, 0.0113026835, 0.04940704, 0.084163934, -0.01636119, -0.06292533, -0.014526007, -0.007826649, 0.07212185, 0.004734863, -0.062791124, -0.016170232, -0.016590146, -0.024280416, -0.019522576, 0.01579864, 0.002749153, 0.053687476, -0.016495354, 0.03662209, -0.018870195, 0.039446633, 0.04715818, 0.013310755, 0.028033575, 0.067203104, -0.005826697, 0.042239364, -0.020745477, 0.0015561507, 0.065384425, 0.09041862, 0.01788624, -0.010026493, 0.0639752, -0.0041079777, -0.058741663, 0.034099422, 0.016963305, -0.0052649197, -0.07403116, -0.0029912698, -0.07583906, 0.001012409, -0.029492352, -0.04166984, -0.048218843, -0.06306306, -0.0033243645, -0.02919451, 0.0039520795, -0.037993237, 0.044352133, 0.03976749, -0.030565975, -0.076377496, -0.06569797, 0.01630497, 0.017201763, 0.028935125, 0.004058029, -0.09946857, 0.036038112, -0.06792709, 0.04493338, 0.035801385, -0.048764315, -0.06326099, 0.037968885, 0.038012274, 0.038041856, 0.04288072, 0.01531972, 0.032477308, 0.043926656, -0.0077148937, 0.056322563, -0.03451439, -0.0083661955, 0.0015379508, -0.007879496, 0.01986026, -0.019533899, 0.0405012, 0.015047856, 0.04601962, 0.080275685, 0.017424034, -0.032671392, 0.024088044, -0.021807125, 0.010775311, 0.094901696, 0.0048406925, 0.013086048, 0.04339756, -0.0069915624, 0.019183818, 0.0624931, 0.019509323, 0.07727781, 0.071851335, 0.046544127, 0.040363774, -0.027118236, 0.06800823, -0.01851149, 0.039025713, -0.037301723, 0.05617681, 0.027737545, -0.0011841523, 0.034742635, 0.006083848, 0.033872508, 0.012025738, -0.02354928, -0.07461171, 0.0027702893, 0.04646551, 0.06590462, -0.00794524, -0.011096932, 0.031695057, -0.06732352, -0.051879242, -0.0773121, -0.000517982, 0.08113213, -0.015312499, 0.018544769, -0.023654874, -0.01689197, 0.026425209, -0.08191027, 0.03139842, -0.011997609, 0.059896134, 0.07505033, -0.012907369, 0.008597082, 0.007715897, -0.07062183, -0.027084265, 0.0028182073, 0.03769887, 0.034299187, 0.046780333, -0.007847023, -0.051446356, 0.007982996, -0.034917314, -0.0038174198, -0.05954771, -0.044208106, 0.04685703, -0.0199229, -0.0032713648, 0.009684984, -0.050678924, 0.007356914, -0.06628045, 0.042982273, 0.0055478252, 0.011330174, -0.082057334, 0.026437566, -0.015942575, 0.048285805, -0.003856138, 0.04399534, 0.01741405, -0.059217025, 0.056499016, -0.03459506, 0.030366927, 0.016147505, -0.021027595, -0.013333387, -0.035330992, 0.0445699, -0.03483558, 0.02072434, -0.019552084, -0.0043943045, -0.03957101, 0.0041682394, 0.006047565, 0.03504845, 0.04675005, -0.021805461, -0.0033183587, -0.0017508261, 0.033419013, 0.008266579, 0.067113, -0.026226636, -0.020189233, 0.029219048, 0.031028047, 0.021648621, -0.055164326, -0.008505359, 0.05173594, 0.016450783, -0.017234024, -0.10492493, -0.04954522, 0.024168914, -0.008840458, -0.078473605, -0.042714797, -0.040692057, -0.05446264, 0.0148880705, 0.057658363, 0.005458192, 0.02171352, -0.04556389, 0.017333247, -0.10342444, -0.06159851, -0.03170678, 0.08064648, 0.024460033, -0.07185376, -0.0019515441, -0.026248276, 0.034460787, 0.08695437, 0.06363327, 0.012909266, 0.00093975884, 0.03682474, -0.041370448, -0.0070990156, 0.058603138, -0.038166087, -0.039693672, 0.025385896, 0.0035452761, -0.015794974, 0.019059189, -0.028707229, 0.038948998, -0.032039847, -0.07992934, -0.05482927, 0.048767164, -0.03186542, 0.059099294, 0.063702375, 0.01810526, -0.019284561, 0.036313917, 0.0006970895, 0.020730797, 0.08630282, -0.10650717, 0.0017196184, 0.023258938, -0.021214833, 0.015206377, -0.027243242, -0.021319263, -0.054438062, 0.066603355, -0.047786396, 0.018822387, -0.031346995, -0.0049103773, -0.020732613, -0.0841506, 0.00707288, -0.0033278253, 0.068160556, -0.011127404, 0.05533654, 0.0046188673, 0.039132893, 0.008633137, -0.057081457, -0.030337824, -0.0721918}
|
|
e2 := Embedding{-0.037731018, -0.005501065, 0.04339579, 0.050818004, -0.059338734, 0.033849984, -0.006599584, -0.0017643301, 0.049746443, -0.103716515, 0.037138782, -0.0064612515, 0.071909964, 0.013218528, -0.065359734, 0.11057091, 0.031195551, 0.025612833, 0.0075477255, -0.034973715, -0.013490629, -0.08104751, -0.022038054, -0.05304818, 0.008366317, -0.056096837, -0.008484318, 0.049539477, 0.019540254, 0.067417614, -0.027856546, -0.008532138, -0.017063588, -0.00016265438, -0.106199585, 0.03904082, 0.030587498, 0.043008707, -0.015111545, -0.022849092, 0.0025588698, -0.012814152, 0.037556626, -0.0086288145, 0.05265788, 0.011832273, 0.00015048613, -0.0081366515, 0.0013409692, 0.028389124, 0.022627315, -0.015008434, -0.0007749727, 0.013927345, -0.012275729, -0.0090859635, 0.019502806, -0.011900984, 0.016286656, 0.08094661, 0.000306613, -0.06327904, 0.018552454, 0.08885108, -0.07583091, 0.09275318, -0.018484656, 0.074180886, -0.039385945, -0.08063905, -0.05360434, -0.037074074, 0.09909196, 0.025063906, -0.009406389, -0.029612983, -0.018644262, 0.08433939, -0.04466277, -0.07118042, -0.0053266245, -0.07471344, 0.06739151, -0.05399609, 0.03125197, -0.00007781149, -0.04214992, -0.044316035, 0.025013437, 0.031466946, 0.0023496088, 0.042693187, -0.046198968, 0.026152546, -0.017578958, 0.023763098, 0.027511515, -0.05229892, -0.005204117, 0.035853546, -0.031919815, -0.027175877, -0.033706605, 0.018576957, -0.0010251165, -0.006808904, 0.009910016, -0.046926413, -0.02833718, 0.0132687995, -0.033933964, 0.06434295, 0.046245363, 0.044698197, 0.041076522, 0.04224362, -0.050834127, 0.0037004466, 0.061506275, -0.018232772, 0.067569405, 0.048701495, 0.042266034, -0.11045008, 0.03627151, -0.07259142, -0.0027725939, 0.040572345, 0.010365194, -0.018683784, 0.004533848, 0.037213936, -0.050944775, 0.07134523, 0.004012727, 0.036228556, -0.013853831, -0.06910639, -0.011394227, -0.012075533, 0.036311198, -0.02587341, -0.04086224, -0.024498813, -0.019423751, -0.022674281, 0.052483488, 0.026303312, -0.051178075, 0.008410645, 0.039851066, -0.028721321, -0.027934253, -0.029567441, 0.054549955, 0.07423011, -0.07211806, 0.015979288, 0.002092099, 0.049062036, 0.025120452, 0.045975365, 0.025024865, -0.04019101, 0.0013054911, -0.0049644294, 0.0065203104, -0.03237452, -0.020704443, 0.028736785, -0.027353559, 0.07551169, 0.0842262, 0.019992182, 0.11138123, -0.028617613, 0.06700691, -0.048681036, -0.008201593, -0.058066163, 0.027867565, 0.07693089, -0.033642102, -0.05855467, -0.08575646, -0.019721355, 0.018443357, -0.0037373751, 0.032450553, -0.0074002664, -0.028135147, 0.046631414, 0.0192969, -0.0071076434, -0.004898368, 0.011896125, -0.026020564, 0.074016415, -0.033884488, -0.07919758, 0.021606326, -0.0142197255, 0.0807476, 0.03722956, -0.0015949347, 0.008076167, -0.009640628, 0.02341143, 0.015375526, -0.059428506, 0.051759534, 0.028049389, 0.07790443, 0.0478649, 0.09191913, -0.055882096, -0.026637457, 0.01236174, -0.0033003334, 0.008522798, 0.027216703, -0.033221588, -0.028086975, -0.11505473, -0.044336796, 0.013873659, 0.03982099, 0.060988583, -0.07439005, 0.01333661, -0.004818605, 0.02561305, -0.059055943, 0.0081638545, -0.032278564, 0.046092775, 0.025316834, -0.046857174, -0.0341012, 0.04379944, -0.029710777, 0.09238533, 0.009769442, 0.018552538, -0.02632421, 0.033739865, -0.022547472, 0.016400741, -0.05336998, -0.012623122, -0.08303054, -0.010368709, 0.01690871, 0.0014627968, -0.050720602, 0.038742293, -0.065664165, -0.10676187, -0.013403239, 0.075702645, -0.055623896, -0.03871971, -0.042371742, 0.03794916, -0.0590573, -0.002583715, -0.029995736, -0.08144537, -0.043295015, -0.034286328, -0.026538746, 0.01953962, 0.08203153, 0.036415525, 0.045531306, 0.004713152, 0.026550433, -0.0055336948, -0.031087596, -0.01923592, -0.1047651, 0.051826596, -0.009522955, 0.0023846119, -0.030824797, 0.0011774554, 0.03384506, 0.010090165, -0.033521466, -0.052155476, 0.0032979914, -0.004305921, -0.08622774, 0.03262125, 0.06332183, 0.00067599304, 0.01989574, 0.04406689, 0.019945903, -0.003796719, 0.00025200442, -0.010055775, 0.04070448, -0.004082432, -0.026942603, 0.110138796, -0.029453337, 0.015611174, 0.08778206, -0.027199872, -0.014513782, 0.021546016, 0.01706933, -0.01365763, 0.026393317, -0.029974515, 0.0050973813, 0.00732006, 0.034644503, 0.03125295, -0.01563078, -0.041023903, -0.04566191, -0.00013489528, 0.04253813, 0.045907266, -0.011943533, 0.031480506, -0.0034109016, -0.035025172, 0.028193155, -0.06832476, -0.0019371725, -0.049427234, -0.0061696135, 0.051213425, 0.07832765, -0.01894849, 0.0290217, 0.031639505, -0.045830216, -0.048976466, 0.052241277, -0.026111973, 0.037248738, -0.07693719, -0.00020981894, 0.030037824, -0.041687537, -0.015251262, 0.041234106, 0.031005232, 0.024838371, 0.0020733695, -0.038252156, -0.026375879, 0.03495583, 0.018539391, -0.07203285, 0.006305707, -0.004792029, -0.05153865, 0.0072443904, -0.017075827, 0.013596034, -0.0054885144, -0.052320853, -0.033805914, -0.038080305, -0.010182737, 0.012953395, 0.014565793, -0.023107765, 0.030313661, 0.011124675, 0.018100796, 0.1074551, -0.074430406, -0.04017658, -0.002058053, -0.07340946, 0.0033503077, 0.04565434, -0.033483636, -0.029218825, -0.05245377, -0.059680052, 0.017752757, -0.05493096, -0.10746678, 0.08623605, 0.014577705, 0.0044184765, -0.025559181, -0.015846781, -0.006661373, 0.09459266, 0.036481388, 0.030402042, -0.0152169075, 0.0037343376, 0.024195764, -0.01859682, -0.0022416788, 0.0056786016, -0.06771737, 0.02364697, 0.021247962, 0.05002757, 0.083975114, 0.011197936, 0.0035017033, -0.0014220127, -0.024415374, 0.023921741, -0.0108229555, -0.06622103, -0.00024976654, 0.06549428, -0.004968772, -0.011665843, 0.03409593, 0.028397659, -0.086434126, -0.074232705, 0.041721817, -0.034767248, -0.014432104, 0.006313255, 0.04040112, -0.0050085387, -0.0023618732, -0.02225774, 0.02383989, 0.061036374, 0.058602326, 0.04343989, -0.029145751, 0.0369256, -0.054843802, -0.017078603, 0.047091234, 0.050245833, -0.04615808, -0.02404996, 0.02584908, -0.006215116, -0.016719814, 0.052097827, 0.01908364, -0.07564805, -0.11024787, -0.036854018, -0.0056766514, -0.007618422, 0.034403287, 0.056957226, -0.03565076, -0.0365251, 0.040833052, 0.008173664, -0.04300709, 0.0028465139, -0.020792698, 0.020321466, -0.002447697, 0.019681728, -0.08843341, -0.042670425, 0.014576458, 0.009701015, -0.12435015, -0.025056241, 0.03084893, -0.031128377, 0.006784327, 0.052201632, 0.06773422, 0.015289244, 0.009421969, 0.0725144, -0.07110377, -0.05183192, -0.008816121, -0.11178569, 0.079700254, -0.0110752955, 0.0046521816, -0.07299747, 0.10732809, -0.06012486, 0.057736155, -0.02227576, -0.063017495, 0.085292354, 0.037407015, -0.07368719, 0.033426613, 0.062104296, -0.016089993, -0.023178348, -0.064638525, 0.028132388, -0.049967688, 0.053581465, 0.031400185, 0.0712773, -0.012665878, 0.0760322, 0.030081542, -0.022147592, 0.009422989}
|
|
one := Embeddings{e1}
|
|
two := Embeddings{e1, e2}
|
|
|
|
t.Run("0", func(t *testing.T) {
|
|
assert.Equal(t, 0, Embeddings{}.Count())
|
|
})
|
|
t.Run("1", func(t *testing.T) {
|
|
assert.Equal(t, 1, one.Count())
|
|
})
|
|
t.Run("2", func(t *testing.T) {
|
|
assert.Equal(t, 2, two.Count())
|
|
})
|
|
}
|
|
|
|
func TestEmbeddings_Kind(t *testing.T) {
|
|
regular := Embeddings{Embedding{0.03299243375658989, 0.0012887970078736544, 0.0036446317681111395, 0.031202086247503757, 0.02730374224483967, -0.016643289010971785, -0.02336998051032424, 0.05498751252889633, -0.010465491970535368, 0.018875301582738757, 0.014203066239133477, 0.11920119822025299, -0.042420363053679466, 0.04395093023777008, -0.041016378439962864, 0.09627663344144821, 0.06980812922120094, 0.03829829953610897, -0.026089582592248917, -0.026732983998954296, 0.04984568804502487, -0.008000173838809133, 0.049577487632632256, -0.013628015061840415, -0.02461838547606021, -0.0773920863866806, -0.017194374231621623, 0.032989165745675564, -0.017070180736482143, 0.012035661202389747, -0.06164510361850262, -0.11613136157393456, -0.012980560306459665, -0.05340278521180153, -0.05773849040269852, 0.043240783736109734, 0.017606624809559435, -0.061572352424263954, -0.009708077413961291, -0.008284036070108414, -0.03199474699795246, 0.0706041008234024, 0.032686786726117134, 0.04332643933594227, 0.01367653300985694, 0.10158828273415565, 0.04595570266246796, 0.0482933409512043, 0.0013564485125243664, 0.040155623108148575, -0.03153740335255861, -0.020297469571232796, 0.060823097825050354, -0.022422337904572487, 0.003214967844542116, -0.005922295735217631, 0.029318060725927353, 0.02124825958162546, 0.0087385019287467, -0.04913809150457382, -0.07493386417627335, 0.04034857079386711, -0.022440982051193714, 0.052591606974601746, -0.014183513354510069, 0.020259365905076265, -0.03143961448222399, 0.053309688344597816, 0.09904120117425919, -0.01861259969882667, -0.00825246050953865, -0.00006514322012662888, 0.10538545623421669, -0.001551960885990411, -0.011002717074006796, -0.03310613660141826, -0.024139931425452232, 0.0028643521363846958, -0.03557338588871062, 0.026428129989653826, -0.01326784840784967, -0.05814123898744583, -0.012879705056548119, 0.052929580211639404, -0.02772670704871416, 0.0013385144993662834, -0.027945382753387094, 0.003164151683449745, -0.029322932474315166, -0.010705097345635295, -0.024460318207275122, 0.09913501888513565, -0.02091354748699814, -0.029340512584894896, -0.03533128276467323, -0.0015429016202688217, -0.03142521344125271, 0.048838695511221886, -0.004869261756539345, 0.018591410014778376, -0.0013430897961370647, 0.0693020261824131, -0.07708260789513588, 0.03203477058559656, 0.033085787668824196, -0.047355168499052525, 0.042945362627506256, -0.03789123799651861, 0.03710726834833622, 0.002974637900479138, 0.026817279402166605, -0.019838752574287355, 0.017452094238251448, 0.011397800408303738, -0.0007858939352445304, -0.07874647155404091, 0.03014033380895853, -0.03141150251030922, -0.0038211997598409653, -0.05815695598721504, 0.015130200888961554, -0.00583213334903121, 0.02310820948332548, -0.09213608130812645, 0.012645000591874123, 0.0012694697361439466, 0.021815909654833376, 0.04155354108661413, 0.02388177369721234, -0.015529894386418164, -0.051616192795336246, 0.010208874300587922, -0.03290301887318492, 0.010450892033986747, -0.027349266223609447, 0.06710228323936462, -0.06247733533382416, 0.06953012570738792, 0.0532703660428524, 0.019448445178568363, 0.01020348072052002, -0.0035300063900649548, 0.0013424362987279892, -0.01938025653362274, 0.04580975882709026, -0.02403993345797062, 0.006522719166241586, -0.04139801021665335, 0.0716425608843565, 0.05525396205484867, 0.058247946202754974, -0.06575375609099865, -0.021414507646113634, 0.03050460765371099, -0.0003104889765381813, 0.032245068810880184, -0.04928449168801308, -0.020805996377021074, -0.10028348118066788, -0.003723388770595193, 0.01698605390265584, -0.01518161385320127, -0.02763783186674118, 0.07887725159525871, 0.0034282272681593895, 0.003735181875526905, -0.015192683786153793, 0.042410291731357574, -0.08484236150979996, -0.04384550638496876, -0.020871759159490466, -0.07331935688853264, -0.03693169914186001, 0.05979561619460583, 0.07535402476787567, 0.03485331777483225, 0.03948853723704815, 0.04505305550992489, 0.041757065802812576, 0.03698613494634628, -0.07742167450487614, -0.04953393340110779, -0.011866949324030429, -0.06310526095330715, -0.037923854775726795, -0.06733793206512928, 0.0028253942728042603, 0.008544581476598978, 0.018204851308837533, -0.01110428711399436, 0.028675229288637638, -0.000014176592230796814, -0.008595517836511135, -0.010980478953570127, 0.06090782955288887, 0.031935724429786205, -0.06428571417927742, 0.02687774132937193, -0.02820626273751259, 0.06103776954114437, -0.014799649827182293, 0.06487447768449783, -0.017612767405807972, -0.0489738117903471, 0.06415916979312897, 0.04622162878513336, 0.028768808580935, 0.008490341948345304, 0.0034207233984488994, -0.030166614800691605, 0.00037564802914857864, 0.08484940975904465, 0.0556329358369112, -0.008680319762788713, -0.0591686237603426, 0.013132395455613732, -0.04138460196554661, -0.0152534618973732, -0.0008955895900726318, -0.0006699399091303349, -0.06126082316040993, -0.003050922998227179, 0.07981977239251137, -0.00553199223941192, 0.05290817841887474, 0.040990181267261505, -0.08198415860533714, 0.012562283780425787, 0.019035696983337402, 0.03838503547012806, 0.009997975939768367, -0.054437462240457535, 0.025413839612156153, -0.012672057142481208, 0.027240466326475143, -0.10823043063282967, 0.039526550099253654, 0.023417172953486443, 0.010616711806505919, 0.05400657467544079, 0.014769354253076017, -0.03666005376726389, 0.1403786465525627, 0.0018849256448447704, 0.016372513491660357, 0.035192170180380344, -0.04371563345193863, 0.01762180813238956, 0.03151775896549225, 0.0017134752124547958, -0.002189646300394088, -0.026309426873922348, -0.022467125672847033, 0.03452171664685011, -0.005091295926831663, -0.012717211386188865, -0.01844012923538685, 0.08377647772431374, 0.04330274369567633, -0.012911015888676047, -0.07783931121230125, 0.022803466767072678, -0.009209758485667408, -0.01134668372105807, 0.0010978481732308865, -0.041731768287718296, -0.019449530635029078, -0.06525786221027374, 0.01784832403063774, 0.0519381258636713, -0.04546765796840191, -0.06681095622479916, 0.052901409566402435, -0.014712406322360039, -0.06206769123673439, -0.029490199871361256, -0.00992094405228272, 0.030980206094682217, 0.028731123558827676, -0.030716994777321815, 0.015335452044382691, 0.027196447364985943, 0.006802443356718868, -0.049035536125302315, -0.01397545076906681, 0.025320623070001602, -0.030315839685499668, 0.008192180190235376, 0.05064524710178375, 0.055071935057640076, -0.02402257511857897, -0.026291001588106155, -0.0352883143350482, 0.03816434368491173, 0.0024908103223424405, -0.056645095348358154, -0.0033702882938086987, -0.005905752768740058, -0.06425020284950733, -0.05919185280799866, -0.0016906238161027431, 0.0367411058396101, -0.013534991536289454, 0.04554910026490688, 0.04965145606547594, 0.04711329936981201, -0.0022945720702409744, -0.08543642237782478, -0.008514909524819814, -0.028528734110295773, 0.061780987307429314, 0.020181911531835794, -0.0911903902888298, 0.05051926709711552, 0.07191416621208191, 0.008162404410541058, 0.01245186768937856, 0.016187091358006, 0.043543798848986626, -0.009479915082920343, 0.023197953589260578, -0.0128170030657202, 0.009029299020767212, 0.04728549160063267, 0.0411943782819435, 0.08705715090036392, 0.034151943400502205, 0.03091753739863634, -0.008500277996063232, -0.037062765564769506, 0.032723722979426384, -0.017894286196678877, -0.057018197141587734, -0.027401311323046684, 0.012518907431513071, 0.0074143747333437204, 0.07037244737148285, -0.0023393332958221436, -0.026991766411811113, -0.03154143411666155, 0.023902101907879114, 0.04603037238121033, 0.028904889710247517, 0.04788004048168659, -0.03380402363836765, 0.04251649044454098, 0.01818377710878849, 0.019481074064970016, 0.028608831577003002, -0.01710190891753882, 0.06451337784528732, 0.014500364544801414, 0.03574225027114153, -0.009639779105782509, -0.010775335133075714, -0.029825964476913214, -0.042237892746925354, 0.10034146532416344, 0.008079767460003495, -0.040079131722450256, 0.016421714331954718, -0.01444422930944711, 0.02031274000182748, 0.018914726562798023, 0.03335639089345932, 0.03541796840727329, -0.026653863489627838, -0.05221548117697239, 0.0063943685963749886, 0.004057109355926514, -0.09564470499753952, -0.04464067239314318, 0.031108970753848553, -0.037283712066709995, 0.02475119661539793, 0.11459792405366898, -0.030784870497882366, 0.020760945044457912, -0.01785914588253945, 0.08094337955117226, -0.015164955519139767, 0.012228903360664845, -0.017235606908798218, 0.08861563354730606, 0.0318350438028574, 0.0757767278701067, 0.012023263610899448, 0.023429375141859055, -0.03745843097567558, -0.04380873590707779, 0.02110994514077902, -0.011707475874572992, -0.012666282244026661, 0.011557577410712838, 0.00443102465942502, 0.04940926283597946, 0.02705614548176527, -0.07491707801818848, 0.02314113173633814, 0.026312096510082483, 0.053126584738492966, -0.045514119789004326, 0.009663000470027328, -0.03952785115689039, 0.04658995568752289, -0.01493800338357687, -0.02509928948711604, -0.003964853240177035, 0.02257065661251545, 0.06703811883926392, 0.03483511647209525, 0.02274334290996194, -0.011276207689661533, 0.07870975881814957, 0.01009555347263813, -0.04503127373754978, 0.07256312668323517, 0.04005438182502985, 0.04977371543645859, -0.0026922628458123654, -0.021050990326330066, 0.01495779538527131, -0.016562148462980986, -0.10143782570958138, 0.0155231868266128, 0.02694749552756548, 0.025097977370023727, 0.04987946338951588, 0.028022659942507744, -0.0011907760053873062, -0.008212624379666522, 0.0758606307208538, -0.005179599393159151, -0.0030273914453573525, -0.01775809336686507, 0.004963372048223391, -0.009773904923349619, 0.03300181636586785, 0.027392339194193482, -0.053647356107831, 0.03208416048437357, -0.016623362724203616, 0.006149550434201956, -0.00938198622316122, -0.056504782289266586, 0.04392931330949068, -0.03535517957061529, 0.0209489983972162, -0.021146904677152634, -0.04691057652235031, 0.031407713890075684, 0.024042493547312915, -0.006175361457280815, 0.06390469148755074, -0.01651687320554629, -0.06339511834084988, 0.03842451050877571, -0.010026296833530068, 0.03832768090069294, -0.0033739758655428886, 0.010911932215094566, -0.045065611600875854, -0.04082046262919903, -0.03455240838229656, -0.027021873276680708, 0.001478658989071846, -0.00935175891208928, 0.015908190980553627, 0.00706840306520462, 0.04809266608208418, 0.01588955894112587, 0.03732101246714592, 0.1253678873181343, -0.10226911678910255, -0.059381358325481415, -0.04539157636463642, -0.004333771765232086, 0.041247001849114895, -0.01853740680962801, -0.008625599090009928, -0.05763876996934414, 0.03215595334768295, 0.03235688805580139, -0.029090310912579298, -0.0585331916809082, 0.042513283900916576, -0.026253306306898594, 0.014785181963816285, 0.031166178174316883, -0.04569920711219311, 0.00002067210152745247, -0.07499086484313011, -0.09185703098773956, 0.003109435550868511, 0.01707480871118605, -0.027403407730162144, -0.0026809941045939922, 0.09174108132719994, -0.010645768605172634, 0.03649126552045345, -0.04568006843328476, 0.0625828392803669, -0.02830026112496853, 0.02947078086435795, -0.017915842588990927, 0.02012275392189622, 0.03067866084165871, 0.061746515333652496, -0.04680593032389879, -0.031035718508064747, -0.008485409547574818, -0.07368514314293861}}
|
|
ignored := Embeddings{Embedding{-0.00067741907, -0.0473858, -0.055704225, 0.066581585, 0.005290037, 0.03822874, -0.05082791, 0.049087, 0.018308854, -0.01478969, -0.0017964382, 0.057903986, -0.02245441, -0.033446193, -0.0071987803, -0.03150515, 0.017724376, 0.019948162, 0.056362633, -0.11701946, -0.09725581, 0.013104323, 0.07357148, -0.020104313, -0.014956488, -0.017257847, -0.020743687, -0.046340823, -0.021527996, 0.057039287, -0.051751148, -0.00595411, 0.011733857, -0.04644382, -0.028774152, 0.038308877, -0.015685631, 0.0038190065, -0.094677314, 0.07005245, -0.003068884, 0.050274804, -0.018143218, 0.012056174, 0.019058047, -0.00077958487, 0.030408988, 0.0885491, -0.11106459, -0.019910613, 0.01465938, 0.032499526, 0.04720623, 0.03163276, -0.079508044, 0.07914293, 0.03724754, 0.05636608, -0.016979787, -0.04298359, -0.03599786, 0.058342796, -0.024069536, -0.03200436, 0.015390179, 0.07293075, -0.0013783299, -0.01605161, -0.0045498423, -0.016551308, 0.060823392, 0.073548146, -0.021239666, -0.036749583, 0.00028047478, -0.025989566, -0.05310693, -0.009845653, -0.012862101, 0.058108855, 0.06915682, 0.021099294, 0.001225616, 0.033261415, 0.042154703, 0.05271609, -0.030613305, 0.041209485, 0.0019353209, -0.0019135632, 0.080911145, 0.011060149, 0.05281461, -0.10160427, 0.053647887, 0.01762615, -0.018661015, 0.02777136, -0.056023918, 0.057687696, 0.06513923, -0.069180146, -0.015231091, 0.03774808, 0.012945786, 0.090585396, 0.019942591, -0.015280875, -0.0011742035, -0.042135417, 0.05812486, 0.05519544, -0.06453465, -0.04014237, -0.03199121, 0.009241696, 0.043912023, 0.015467731, 0.0020673021, 0.08763925, -0.08974939, -0.05304043, 0.016309343, -0.04766073, -0.0046682972, -0.040477246, 0.012679025, 0.005960806, -0.03256039, -0.07089416, -0.02648642, -0.062463485, 0.08295411, -0.037147924, -0.074104264, 0.077417135, -0.042383663, 0.002088579, 0.07709948, 0.06521331, -0.07541816, 0.057679284, -0.0038482754, 0.055191133, 0.058614884, -0.018541405, -0.012277692, 0.057926673, -0.01724738, 0.020869015, 0.046103075, -0.0319926, -0.0671411, 0.02629761, 0.044356663, 0.036788594, 0.028035736, 0.06419986, 0.045972086, -0.044160895, 0.09784713, 0.00953585, -0.06252615, 0.025597766, 0.029688764, 0.027506752, -0.055384982, -0.028262418, -0.057812758, 0.042470966, -0.05840525, -0.03801629, 0.0043816785, -0.015086851, 0.022297874, 0.054110903, 0.07420415, -0.040949743, -0.08912868, -0.060081407, -0.046966024, -0.04826231, -0.031198893, 0.06643161, 0.01347482, 0.029003717, 0.047974125, 0.07580259, 0.0364837, 0.012980756, 0.020622224, -0.022555852, 0.10519882, -0.03425076, 0.03889103, -0.007944982, 0.060116176, 0.038143042, -0.043681793, 0.05316621, 0.0016697546, -0.0033659195, 0.020053076, -0.07204762, 0.009732797, 0.03862544, 0.03913928, -0.009832126, 0.06401315, 0.044209804, -0.051490918, 0.014780334, -0.025438532, -0.01395564, -0.038089562, -0.009803314, -0.04146325, 0.03357636, -0.009009651, 0.04373462, -0.05627207, -0.072068065, -0.007331119, -0.04238925, -0.021102922, -0.021610938, -0.063095644, -0.05075978, -0.07491732, 0.0113026835, 0.04940704, 0.084163934, -0.01636119, -0.06292533, -0.014526007, -0.007826649, 0.07212185, 0.004734863, -0.062791124, -0.016170232, -0.016590146, -0.024280416, -0.019522576, 0.01579864, 0.002749153, 0.053687476, -0.016495354, 0.03662209, -0.018870195, 0.039446633, 0.04715818, 0.013310755, 0.028033575, 0.067203104, -0.005826697, 0.042239364, -0.020745477, 0.0015561507, 0.065384425, 0.09041862, 0.01788624, -0.010026493, 0.0639752, -0.0041079777, -0.058741663, 0.034099422, 0.016963305, -0.0052649197, -0.07403116, -0.0029912698, -0.07583906, 0.001012409, -0.029492352, -0.04166984, -0.048218843, -0.06306306, -0.0033243645, -0.02919451, 0.0039520795, -0.037993237, 0.044352133, 0.03976749, -0.030565975, -0.076377496, -0.06569797, 0.01630497, 0.017201763, 0.028935125, 0.004058029, -0.09946857, 0.036038112, -0.06792709, 0.04493338, 0.035801385, -0.048764315, -0.06326099, 0.037968885, 0.038012274, 0.038041856, 0.04288072, 0.01531972, 0.032477308, 0.043926656, -0.0077148937, 0.056322563, -0.03451439, -0.0083661955, 0.0015379508, -0.007879496, 0.01986026, -0.019533899, 0.0405012, 0.015047856, 0.04601962, 0.080275685, 0.017424034, -0.032671392, 0.024088044, -0.021807125, 0.010775311, 0.094901696, 0.0048406925, 0.013086048, 0.04339756, -0.0069915624, 0.019183818, 0.0624931, 0.019509323, 0.07727781, 0.071851335, 0.046544127, 0.040363774, -0.027118236, 0.06800823, -0.01851149, 0.039025713, -0.037301723, 0.05617681, 0.027737545, -0.0011841523, 0.034742635, 0.006083848, 0.033872508, 0.012025738, -0.02354928, -0.07461171, 0.0027702893, 0.04646551, 0.06590462, -0.00794524, -0.011096932, 0.031695057, -0.06732352, -0.051879242, -0.0773121, -0.000517982, 0.08113213, -0.015312499, 0.018544769, -0.023654874, -0.01689197, 0.026425209, -0.08191027, 0.03139842, -0.011997609, 0.059896134, 0.07505033, -0.012907369, 0.008597082, 0.007715897, -0.07062183, -0.027084265, 0.0028182073, 0.03769887, 0.034299187, 0.046780333, -0.007847023, -0.051446356, 0.007982996, -0.034917314, -0.0038174198, -0.05954771, -0.044208106, 0.04685703, -0.0199229, -0.0032713648, 0.009684984, -0.050678924, 0.007356914, -0.06628045, 0.042982273, 0.0055478252, 0.011330174, -0.082057334, 0.026437566, -0.015942575, 0.048285805, -0.003856138, 0.04399534, 0.01741405, -0.059217025, 0.056499016, -0.03459506, 0.030366927, 0.016147505, -0.021027595, -0.013333387, -0.035330992, 0.0445699, -0.03483558, 0.02072434, -0.019552084, -0.0043943045, -0.03957101, 0.0041682394, 0.006047565, 0.03504845, 0.04675005, -0.021805461, -0.0033183587, -0.0017508261, 0.033419013, 0.008266579, 0.067113, -0.026226636, -0.020189233, 0.029219048, 0.031028047, 0.021648621, -0.055164326, -0.008505359, 0.05173594, 0.016450783, -0.017234024, -0.10492493, -0.04954522, 0.024168914, -0.008840458, -0.078473605, -0.042714797, -0.040692057, -0.05446264, 0.0148880705, 0.057658363, 0.005458192, 0.02171352, -0.04556389, 0.017333247, -0.10342444, -0.06159851, -0.03170678, 0.08064648, 0.024460033, -0.07185376, -0.0019515441, -0.026248276, 0.034460787, 0.08695437, 0.06363327, 0.012909266, 0.00093975884, 0.03682474, -0.041370448, -0.0070990156, 0.058603138, -0.038166087, -0.039693672, 0.025385896, 0.0035452761, -0.015794974, 0.019059189, -0.028707229, 0.038948998, -0.032039847, -0.07992934, -0.05482927, 0.048767164, -0.03186542, 0.059099294, 0.063702375, 0.01810526, -0.019284561, 0.036313917, 0.0006970895, 0.020730797, 0.08630282, -0.10650717, 0.0017196184, 0.023258938, -0.021214833, 0.015206377, -0.027243242, -0.021319263, -0.054438062, 0.066603355, -0.047786396, 0.018822387, -0.031346995, -0.0049103773, -0.020732613, -0.0841506, 0.00707288, -0.0033278253, 0.068160556, -0.011127404, 0.05533654, 0.0046188673, 0.039132893, 0.008633137, -0.057081457, -0.030337824, -0.0721918}}
|
|
both := Embeddings{regular[0], ignored[0]}
|
|
|
|
t.Run("Empty", func(t *testing.T) {
|
|
assert.Equal(t, Kind(0), Embeddings{}.Kind())
|
|
})
|
|
t.Run("RegularFace", func(t *testing.T) {
|
|
assert.Equal(t, RegularFace, regular.Kind())
|
|
})
|
|
t.Run("KidsFace", func(t *testing.T) {
|
|
assert.Equal(t, KidsFace, KidsEmbeddings.Kind())
|
|
})
|
|
t.Run("IgnoredFace", func(t *testing.T) {
|
|
assert.Equal(t, IgnoredFace, ignored.Kind())
|
|
assert.Equal(t, IgnoredFace, both.Kind())
|
|
assert.Equal(t, IgnoredFace, IgnoredEmbeddings.Kind())
|
|
})
|
|
}
|
|
|
|
func TestEmbeddings_Contains(t *testing.T) {
|
|
t.Run("Ignore", func(t *testing.T) {
|
|
e1 := Embedding{-0.00067741907, -0.0473858, -0.055704225, 0.066581585, 0.005290037, 0.03822874, -0.05082791, 0.049087, 0.018308854, -0.01478969, -0.0017964382, 0.057903986, -0.02245441, -0.033446193, -0.0071987803, -0.03150515, 0.017724376, 0.019948162, 0.056362633, -0.11701946, -0.09725581, 0.013104323, 0.07357148, -0.020104313, -0.014956488, -0.017257847, -0.020743687, -0.046340823, -0.021527996, 0.057039287, -0.051751148, -0.00595411, 0.011733857, -0.04644382, -0.028774152, 0.038308877, -0.015685631, 0.0038190065, -0.094677314, 0.07005245, -0.003068884, 0.050274804, -0.018143218, 0.012056174, 0.019058047, -0.00077958487, 0.030408988, 0.0885491, -0.11106459, -0.019910613, 0.01465938, 0.032499526, 0.04720623, 0.03163276, -0.079508044, 0.07914293, 0.03724754, 0.05636608, -0.016979787, -0.04298359, -0.03599786, 0.058342796, -0.024069536, -0.03200436, 0.015390179, 0.07293075, -0.0013783299, -0.01605161, -0.0045498423, -0.016551308, 0.060823392, 0.073548146, -0.021239666, -0.036749583, 0.00028047478, -0.025989566, -0.05310693, -0.009845653, -0.012862101, 0.058108855, 0.06915682, 0.021099294, 0.001225616, 0.033261415, 0.042154703, 0.05271609, -0.030613305, 0.041209485, 0.0019353209, -0.0019135632, 0.080911145, 0.011060149, 0.05281461, -0.10160427, 0.053647887, 0.01762615, -0.018661015, 0.02777136, -0.056023918, 0.057687696, 0.06513923, -0.069180146, -0.015231091, 0.03774808, 0.012945786, 0.090585396, 0.019942591, -0.015280875, -0.0011742035, -0.042135417, 0.05812486, 0.05519544, -0.06453465, -0.04014237, -0.03199121, 0.009241696, 0.043912023, 0.015467731, 0.0020673021, 0.08763925, -0.08974939, -0.05304043, 0.016309343, -0.04766073, -0.0046682972, -0.040477246, 0.012679025, 0.005960806, -0.03256039, -0.07089416, -0.02648642, -0.062463485, 0.08295411, -0.037147924, -0.074104264, 0.077417135, -0.042383663, 0.002088579, 0.07709948, 0.06521331, -0.07541816, 0.057679284, -0.0038482754, 0.055191133, 0.058614884, -0.018541405, -0.012277692, 0.057926673, -0.01724738, 0.020869015, 0.046103075, -0.0319926, -0.0671411, 0.02629761, 0.044356663, 0.036788594, 0.028035736, 0.06419986, 0.045972086, -0.044160895, 0.09784713, 0.00953585, -0.06252615, 0.025597766, 0.029688764, 0.027506752, -0.055384982, -0.028262418, -0.057812758, 0.042470966, -0.05840525, -0.03801629, 0.0043816785, -0.015086851, 0.022297874, 0.054110903, 0.07420415, -0.040949743, -0.08912868, -0.060081407, -0.046966024, -0.04826231, -0.031198893, 0.06643161, 0.01347482, 0.029003717, 0.047974125, 0.07580259, 0.0364837, 0.012980756, 0.020622224, -0.022555852, 0.10519882, -0.03425076, 0.03889103, -0.007944982, 0.060116176, 0.038143042, -0.043681793, 0.05316621, 0.0016697546, -0.0033659195, 0.020053076, -0.07204762, 0.009732797, 0.03862544, 0.03913928, -0.009832126, 0.06401315, 0.044209804, -0.051490918, 0.014780334, -0.025438532, -0.01395564, -0.038089562, -0.009803314, -0.04146325, 0.03357636, -0.009009651, 0.04373462, -0.05627207, -0.072068065, -0.007331119, -0.04238925, -0.021102922, -0.021610938, -0.063095644, -0.05075978, -0.07491732, 0.0113026835, 0.04940704, 0.084163934, -0.01636119, -0.06292533, -0.014526007, -0.007826649, 0.07212185, 0.004734863, -0.062791124, -0.016170232, -0.016590146, -0.024280416, -0.019522576, 0.01579864, 0.002749153, 0.053687476, -0.016495354, 0.03662209, -0.018870195, 0.039446633, 0.04715818, 0.013310755, 0.028033575, 0.067203104, -0.005826697, 0.042239364, -0.020745477, 0.0015561507, 0.065384425, 0.09041862, 0.01788624, -0.010026493, 0.0639752, -0.0041079777, -0.058741663, 0.034099422, 0.016963305, -0.0052649197, -0.07403116, -0.0029912698, -0.07583906, 0.001012409, -0.029492352, -0.04166984, -0.048218843, -0.06306306, -0.0033243645, -0.02919451, 0.0039520795, -0.037993237, 0.044352133, 0.03976749, -0.030565975, -0.076377496, -0.06569797, 0.01630497, 0.017201763, 0.028935125, 0.004058029, -0.09946857, 0.036038112, -0.06792709, 0.04493338, 0.035801385, -0.048764315, -0.06326099, 0.037968885, 0.038012274, 0.038041856, 0.04288072, 0.01531972, 0.032477308, 0.043926656, -0.0077148937, 0.056322563, -0.03451439, -0.0083661955, 0.0015379508, -0.007879496, 0.01986026, -0.019533899, 0.0405012, 0.015047856, 0.04601962, 0.080275685, 0.017424034, -0.032671392, 0.024088044, -0.021807125, 0.010775311, 0.094901696, 0.0048406925, 0.013086048, 0.04339756, -0.0069915624, 0.019183818, 0.0624931, 0.019509323, 0.07727781, 0.071851335, 0.046544127, 0.040363774, -0.027118236, 0.06800823, -0.01851149, 0.039025713, -0.037301723, 0.05617681, 0.027737545, -0.0011841523, 0.034742635, 0.006083848, 0.033872508, 0.012025738, -0.02354928, -0.07461171, 0.0027702893, 0.04646551, 0.06590462, -0.00794524, -0.011096932, 0.031695057, -0.06732352, -0.051879242, -0.0773121, -0.000517982, 0.08113213, -0.015312499, 0.018544769, -0.023654874, -0.01689197, 0.026425209, -0.08191027, 0.03139842, -0.011997609, 0.059896134, 0.07505033, -0.012907369, 0.008597082, 0.007715897, -0.07062183, -0.027084265, 0.0028182073, 0.03769887, 0.034299187, 0.046780333, -0.007847023, -0.051446356, 0.007982996, -0.034917314, -0.0038174198, -0.05954771, -0.044208106, 0.04685703, -0.0199229, -0.0032713648, 0.009684984, -0.050678924, 0.007356914, -0.06628045, 0.042982273, 0.0055478252, 0.011330174, -0.082057334, 0.026437566, -0.015942575, 0.048285805, -0.003856138, 0.04399534, 0.01741405, -0.059217025, 0.056499016, -0.03459506, 0.030366927, 0.016147505, -0.021027595, -0.013333387, -0.035330992, 0.0445699, -0.03483558, 0.02072434, -0.019552084, -0.0043943045, -0.03957101, 0.0041682394, 0.006047565, 0.03504845, 0.04675005, -0.021805461, -0.0033183587, -0.0017508261, 0.033419013, 0.008266579, 0.067113, -0.026226636, -0.020189233, 0.029219048, 0.031028047, 0.021648621, -0.055164326, -0.008505359, 0.05173594, 0.016450783, -0.017234024, -0.10492493, -0.04954522, 0.024168914, -0.008840458, -0.078473605, -0.042714797, -0.040692057, -0.05446264, 0.0148880705, 0.057658363, 0.005458192, 0.02171352, -0.04556389, 0.017333247, -0.10342444, -0.06159851, -0.03170678, 0.08064648, 0.024460033, -0.07185376, -0.0019515441, -0.026248276, 0.034460787, 0.08695437, 0.06363327, 0.012909266, 0.00093975884, 0.03682474, -0.041370448, -0.0070990156, 0.058603138, -0.038166087, -0.039693672, 0.025385896, 0.0035452761, -0.015794974, 0.019059189, -0.028707229, 0.038948998, -0.032039847, -0.07992934, -0.05482927, 0.048767164, -0.03186542, 0.059099294, 0.063702375, 0.01810526, -0.019284561, 0.036313917, 0.0006970895, 0.020730797, 0.08630282, -0.10650717, 0.0017196184, 0.023258938, -0.021214833, 0.015206377, -0.027243242, -0.021319263, -0.054438062, 0.066603355, -0.047786396, 0.018822387, -0.031346995, -0.0049103773, -0.020732613, -0.0841506, 0.00707288, -0.0033278253, 0.068160556, -0.011127404, 0.05533654, 0.0046188673, 0.039132893, 0.008633137, -0.057081457, -0.030337824, -0.0721918}
|
|
e2 := Embedding{-0.037731018, -0.005501065, 0.04339579, 0.050818004, -0.059338734, 0.033849984, -0.006599584, -0.0017643301, 0.049746443, -0.103716515, 0.037138782, -0.0064612515, 0.071909964, 0.013218528, -0.065359734, 0.11057091, 0.031195551, 0.025612833, 0.0075477255, -0.034973715, -0.013490629, -0.08104751, -0.022038054, -0.05304818, 0.008366317, -0.056096837, -0.008484318, 0.049539477, 0.019540254, 0.067417614, -0.027856546, -0.008532138, -0.017063588, -0.00016265438, -0.106199585, 0.03904082, 0.030587498, 0.043008707, -0.015111545, -0.022849092, 0.0025588698, -0.012814152, 0.037556626, -0.0086288145, 0.05265788, 0.011832273, 0.00015048613, -0.0081366515, 0.0013409692, 0.028389124, 0.022627315, -0.015008434, -0.0007749727, 0.013927345, -0.012275729, -0.0090859635, 0.019502806, -0.011900984, 0.016286656, 0.08094661, 0.000306613, -0.06327904, 0.018552454, 0.08885108, -0.07583091, 0.09275318, -0.018484656, 0.074180886, -0.039385945, -0.08063905, -0.05360434, -0.037074074, 0.09909196, 0.025063906, -0.009406389, -0.029612983, -0.018644262, 0.08433939, -0.04466277, -0.07118042, -0.0053266245, -0.07471344, 0.06739151, -0.05399609, 0.03125197, -0.00007781149, -0.04214992, -0.044316035, 0.025013437, 0.031466946, 0.0023496088, 0.042693187, -0.046198968, 0.026152546, -0.017578958, 0.023763098, 0.027511515, -0.05229892, -0.005204117, 0.035853546, -0.031919815, -0.027175877, -0.033706605, 0.018576957, -0.0010251165, -0.006808904, 0.009910016, -0.046926413, -0.02833718, 0.0132687995, -0.033933964, 0.06434295, 0.046245363, 0.044698197, 0.041076522, 0.04224362, -0.050834127, 0.0037004466, 0.061506275, -0.018232772, 0.067569405, 0.048701495, 0.042266034, -0.11045008, 0.03627151, -0.07259142, -0.0027725939, 0.040572345, 0.010365194, -0.018683784, 0.004533848, 0.037213936, -0.050944775, 0.07134523, 0.004012727, 0.036228556, -0.013853831, -0.06910639, -0.011394227, -0.012075533, 0.036311198, -0.02587341, -0.04086224, -0.024498813, -0.019423751, -0.022674281, 0.052483488, 0.026303312, -0.051178075, 0.008410645, 0.039851066, -0.028721321, -0.027934253, -0.029567441, 0.054549955, 0.07423011, -0.07211806, 0.015979288, 0.002092099, 0.049062036, 0.025120452, 0.045975365, 0.025024865, -0.04019101, 0.0013054911, -0.0049644294, 0.0065203104, -0.03237452, -0.020704443, 0.028736785, -0.027353559, 0.07551169, 0.0842262, 0.019992182, 0.11138123, -0.028617613, 0.06700691, -0.048681036, -0.008201593, -0.058066163, 0.027867565, 0.07693089, -0.033642102, -0.05855467, -0.08575646, -0.019721355, 0.018443357, -0.0037373751, 0.032450553, -0.0074002664, -0.028135147, 0.046631414, 0.0192969, -0.0071076434, -0.004898368, 0.011896125, -0.026020564, 0.074016415, -0.033884488, -0.07919758, 0.021606326, -0.0142197255, 0.0807476, 0.03722956, -0.0015949347, 0.008076167, -0.009640628, 0.02341143, 0.015375526, -0.059428506, 0.051759534, 0.028049389, 0.07790443, 0.0478649, 0.09191913, -0.055882096, -0.026637457, 0.01236174, -0.0033003334, 0.008522798, 0.027216703, -0.033221588, -0.028086975, -0.11505473, -0.044336796, 0.013873659, 0.03982099, 0.060988583, -0.07439005, 0.01333661, -0.004818605, 0.02561305, -0.059055943, 0.0081638545, -0.032278564, 0.046092775, 0.025316834, -0.046857174, -0.0341012, 0.04379944, -0.029710777, 0.09238533, 0.009769442, 0.018552538, -0.02632421, 0.033739865, -0.022547472, 0.016400741, -0.05336998, -0.012623122, -0.08303054, -0.010368709, 0.01690871, 0.0014627968, -0.050720602, 0.038742293, -0.065664165, -0.10676187, -0.013403239, 0.075702645, -0.055623896, -0.03871971, -0.042371742, 0.03794916, -0.0590573, -0.002583715, -0.029995736, -0.08144537, -0.043295015, -0.034286328, -0.026538746, 0.01953962, 0.08203153, 0.036415525, 0.045531306, 0.004713152, 0.026550433, -0.0055336948, -0.031087596, -0.01923592, -0.1047651, 0.051826596, -0.009522955, 0.0023846119, -0.030824797, 0.0011774554, 0.03384506, 0.010090165, -0.033521466, -0.052155476, 0.0032979914, -0.004305921, -0.08622774, 0.03262125, 0.06332183, 0.00067599304, 0.01989574, 0.04406689, 0.019945903, -0.003796719, 0.00025200442, -0.010055775, 0.04070448, -0.004082432, -0.026942603, 0.110138796, -0.029453337, 0.015611174, 0.08778206, -0.027199872, -0.014513782, 0.021546016, 0.01706933, -0.01365763, 0.026393317, -0.029974515, 0.0050973813, 0.00732006, 0.034644503, 0.03125295, -0.01563078, -0.041023903, -0.04566191, -0.00013489528, 0.04253813, 0.045907266, -0.011943533, 0.031480506, -0.0034109016, -0.035025172, 0.028193155, -0.06832476, -0.0019371725, -0.049427234, -0.0061696135, 0.051213425, 0.07832765, -0.01894849, 0.0290217, 0.031639505, -0.045830216, -0.048976466, 0.052241277, -0.026111973, 0.037248738, -0.07693719, -0.00020981894, 0.030037824, -0.041687537, -0.015251262, 0.041234106, 0.031005232, 0.024838371, 0.0020733695, -0.038252156, -0.026375879, 0.03495583, 0.018539391, -0.07203285, 0.006305707, -0.004792029, -0.05153865, 0.0072443904, -0.017075827, 0.013596034, -0.0054885144, -0.052320853, -0.033805914, -0.038080305, -0.010182737, 0.012953395, 0.014565793, -0.023107765, 0.030313661, 0.011124675, 0.018100796, 0.1074551, -0.074430406, -0.04017658, -0.002058053, -0.07340946, 0.0033503077, 0.04565434, -0.033483636, -0.029218825, -0.05245377, -0.059680052, 0.017752757, -0.05493096, -0.10746678, 0.08623605, 0.014577705, 0.0044184765, -0.025559181, -0.015846781, -0.006661373, 0.09459266, 0.036481388, 0.030402042, -0.0152169075, 0.0037343376, 0.024195764, -0.01859682, -0.0022416788, 0.0056786016, -0.06771737, 0.02364697, 0.021247962, 0.05002757, 0.083975114, 0.011197936, 0.0035017033, -0.0014220127, -0.024415374, 0.023921741, -0.0108229555, -0.06622103, -0.00024976654, 0.06549428, -0.004968772, -0.011665843, 0.03409593, 0.028397659, -0.086434126, -0.074232705, 0.041721817, -0.034767248, -0.014432104, 0.006313255, 0.04040112, -0.0050085387, -0.0023618732, -0.02225774, 0.02383989, 0.061036374, 0.058602326, 0.04343989, -0.029145751, 0.0369256, -0.054843802, -0.017078603, 0.047091234, 0.050245833, -0.04615808, -0.02404996, 0.02584908, -0.006215116, -0.016719814, 0.052097827, 0.01908364, -0.07564805, -0.11024787, -0.036854018, -0.0056766514, -0.007618422, 0.034403287, 0.056957226, -0.03565076, -0.0365251, 0.040833052, 0.008173664, -0.04300709, 0.0028465139, -0.020792698, 0.020321466, -0.002447697, 0.019681728, -0.08843341, -0.042670425, 0.014576458, 0.009701015, -0.12435015, -0.025056241, 0.03084893, -0.031128377, 0.006784327, 0.052201632, 0.06773422, 0.015289244, 0.009421969, 0.0725144, -0.07110377, -0.05183192, -0.008816121, -0.11178569, 0.079700254, -0.0110752955, 0.0046521816, -0.07299747, 0.10732809, -0.06012486, 0.057736155, -0.02227576, -0.063017495, 0.085292354, 0.037407015, -0.07368719, 0.033426613, 0.062104296, -0.016089993, -0.023178348, -0.064638525, 0.028132388, -0.049967688, 0.053581465, 0.031400185, 0.0712773, -0.012665878, 0.0760322, 0.030081542, -0.022147592, 0.009422989}
|
|
assert.True(t, IgnoredEmbeddings.Contains(e1, IgnoredDist))
|
|
assert.False(t, IgnoredEmbeddings.Contains(e2, IgnoredDist))
|
|
assert.False(t, IgnoredEmbeddings.Contains(e1, 0.1))
|
|
})
|
|
}
|
|
|
|
func TestEmbeddings_First(t *testing.T) {
|
|
t.Run("Ignore", func(t *testing.T) {
|
|
e := IgnoredEmbeddings.First()
|
|
assert.Equal(t,
|
|
Embedding{0.0001326936762779951, 0.010595318133709952, -0.025556722866895143, 0.0469118170440197, -0.006627591326832771, 0.05271399952471256, -0.04542037146165967, 0.027480189339257777, -0.004917271726299077, -0.07468410208821297, 0.02064464334398508, 0.027222666889429092, 0.07686506863683462, -0.03543879697099328, -0.06587888672947884, 0.00656710215844214, 0.0468103364109993, 0.026114298962056637, 0.09671456180512905, -0.10109077207744122, -0.00781591737177223, -0.03552762418985367, 0.06885470915585756, -0.012004591058939695, 0.08148624002933502, -0.028154293075203896, 0.04417960252612829, -0.04447614587843418, -0.02476067957468331, 0.08517011441290379, 0.002213838277384639, -0.04421043721958995, -0.030782480724155903, -0.022004681872203946, 0.0009286352433264256, 0.010065821232274175, -0.02192891761660576, -0.012186611769720912, -0.08409351948648691, 0.03493268555030227, -0.044278232380747795, 0.028376419097185135, 0.0037802220904268324, 0.04365090653300285, 0.020489776856265962, 0.0062931065913289785, 0.012816649512387812, 0.08537860121577978, -0.08391124662011862, -0.0074469012033659965, 0.007379985763691366, 0.010717783472500741, 0.05138006154447794, 0.03530120011419058, -0.0252615287899971, 0.048870823346078396, 0.051952130161225796, 0.05130995064973831, -0.07164964452385902, 0.008358421036973596, 0.07212860928848386, 0.023144953418523073, 0.016010764054954052, -0.0020557132083922625, 0.0006047732058505062, 0.05894300062209368, 0.018385239876806736, 0.013549384311772883, 0.013471916783601046, -0.026798027334734797, 0.055714783258736134, 0.056760589592158794, -0.03564274637028575, 0.006639213301241398, -0.010688409092836082, -0.014488881919533014, -0.041894917376339436, 0.027378612896427512, 0.04120381874963641, 0.026110727107152343, 0.014362117013661191, -0.015710897743701935, 0.01369841955602169, -0.013755762134678662, -0.025898753898218274, 0.03539643401745707, -0.02275478537194431, 0.044916168320924044, 0.06104293651878834, 0.020197266509057954, 0.03360230568796396, 0.0005524924490600824, -0.03635450592264533, -0.04944554786197841, 0.07170013058930635, -0.0030192392878234386, 0.0010193748748861253, -0.010943924076855183, -0.06179766729474068, 0.056694529950618744, 0.004520991584286094, -0.09191464446485043, -0.02631867417949252, 0.03776269545778632, -0.00876810192130506, 0.10884877666831017, 0.005137963918969035, 0.014990123057032179, -0.012330824043601751, -0.007994036190211773, 0.04028965998440981, 0.030694966204464436, 0.013997081900015473, -0.027155806310474873, 0.008769600055529736, 0.0038997385127004236, -0.003813096962403506, 0.06714510265737772, 0.006777862668968737, 0.061618989799171686, -0.016695198486559093, -0.014862070740491617, 0.047256719786673784, -0.030920962191885337, -0.010902314214035869, 0.029649023665115237, -0.03882072772830725, 0.037115989718586206, -0.00044789700768887997, -0.050685918889939785, 0.023225090000778437, 0.005942594725638628, 0.03058242436964065, -0.05067136138677597, -0.013880123384296894, 0.0521021569147706, -0.03878975426778197, 0.0057146906128764385, 0.01622107159346342, 0.0286275401012972, -0.07171816006302834, -0.024164889007806778, -0.036472175968810916, -0.06874032877385616, -0.013022568658925593, -0.02637113118544221, 0.061983236111700535, 0.0328070695977658, 0.004039793537231162, -0.022473737597465515, 0.017253196332603693, -0.04853619821369648, -0.053010642528533936, 0.04317591618746519, 0.00835538915998768, 0.015444972610566765, 0.04270970821380615, 0.028640874341363087, 0.06504016369581223, 0.03173913527280092, 0.05225925333797932, 0.03651800798252225, -0.022531148977577686, -0.0032108076702570543, 0.030786060029640794, 0.01946059288457036, -0.020198959624394774, -0.010514225577935576, -0.04853967670351267, 0.02134396170731634, -0.05255058314651251, 0.016728751827031374, 0.0456616897135973, -0.021495807450264692, 0.03207355597987771, 0.010148180415853858, 0.03585670003667474, -0.02635771268978715, -0.04969983361661434, -0.034095218405127525, -0.02873873570933938, 0.020237101707607508, -0.026095976354554296, 0.06887094769626856, 0.010905503178946674, 0.05485152825713158, 0.03837144002318382, 0.07052317541092634, 0.006913394434377551, 0.010285209049470723, -0.03990606777369976, -0.05088027101010084, 0.0778753962367773, -0.0213193167001009, -0.03161718975752592, -0.02693262230604887, 0.0435414626263082, 0.01335046417079866, -0.036178333684802055, 0.037226798478513956, 0.052575312089174986, -0.0522100068628788, -0.009666121564805508, 0.009881116129690781, -0.0037592697190120816, 0.017672576592303813, -0.039784221327863634, -0.023527713026851416, -0.020135456696152687, -0.04171011736616492, -0.03752618143334985, 0.011444047326222062, 0.0015834929654374719, 0.008812893531285226, -0.023482086980948225, 0.006552054779604077, -0.0058590869884938, 0.04283139808103442, 0.052830352913588285, -0.0008150241555995308, -0.08346264809370041, -0.10364211909472942, -0.025862343376502395, -0.037633945466950536, -0.00131333211902529, 0.04283250030130148, -0.02747755730524659, -0.022013332003552932, -0.05700004659593105, -0.057958067394793034, 0.04643791541457176, 0.09375700354576111, 0.044992691837251186, -0.025699439109303057, 0.03685394627973437, 0.039113527920562774, -0.004286542231056956, -0.050266037695109844, 0.006167740881210193, 0.009338066913187504, -0.05799494404345751, 0.011283616302534938, -0.021689202752895653, -0.022013561276253313, 0.06421529594808817, 0.037321062409318984, -0.022122669965028763, 0.03338781511411071, 0.004881134445895441, -0.005090652208309621, -0.005954607389867306, -0.003857724070257973, 0.013872599869500846, 0.040445003658533096, 0.0030193766724551097, 0.020781447528861463, 0.04388184240087867, -0.00434388080611825, 0.014594015898182988, 0.07954355143010616, -0.003253952323575504, -0.05893095303326845, 0.012250101892277598, 0.029312842525541782, -0.08140432462096214, 0.024246320594102144, 0.006364793865941465, -0.012409177725203335, -0.022765739355236292, 0.07083966210484505, -0.0560477483086288, 0.02344445328344591, 0.025518586859107018, -0.038515486754477024, -0.040526574943214655, 0.0033363434486091137, 0.07186504639685154, -0.007116460474207997, -0.027830936181999277, -0.11900371685624123, 0.036241024266928434, -0.019209803780540824, 0.016880312585271895, -0.020635713124647737, -0.012299022404477, -0.012887225369922817, 0.013467759592458606, -0.056274086236953735, -0.07062955480068922, -0.047921731136739254, 0.050967195304110646, -0.09523350931704044, -0.01923635500133969, 0.0018940714071504772, -0.025784526020288467, 0.004750739550217986, 0.001268803607672453, 0.08276346698403358, 0.0475466912612319, 0.0204452850157395, 0.04777416866272688, 0.004511475046456326, 0.05325452284887433, -0.00824436274706386, 0.04315535444766283, 0.01829960517352447, -0.03411059989593923, 0.011709870072081685, -0.022576917544938624, 0.04093322320841253, -0.03366286098025739, 0.00007134396582841873, 0.0672286506742239, 0.057760706171393394, 0.05040881037712097, 0.019016009813640267, -0.07006099820137024, 0.011889255285495892, -0.035422834334895015, 0.03638885170221329, 0.0601487485691905, -0.03319359011948109, -0.045506994472816586, 0.019405824947170913, -0.00514926778851077, 0.07637834828346968, 0.07720410358160734, 0.022179096937179565, 0.09868652559816837, 0.06108273658901453, 0.0493094720877707, 0.03135237097740173, -0.04882502695545554, 0.0584859773516655, 0.030338898301124573, 0.003376852720975876, 0.01842997614585329, 0.046141053549945354, 0.03998812031932175, 0.06666938867419958, 0.021333562210202217, -0.024483966641128063, 0.04871886316686869, 0.02728640241548419, -0.05634338594973087, -0.007101567229256034, 0.027000208385288715, 0.03502309508621693, 0.011526696383953094, -0.03697758028283715, -0.010898058622842655, 0.056068443693220615, 0.029542725766077638, -0.06271603982895613, -0.05443012993782759, -0.0007829638198018074, 0.11164804548025131, -0.02070094458758831, 0.006636139118199935, -0.0727179991081357, 0.021099978126585484, -0.03498802054673433, -0.06967776361852884, -0.04527123365551233, -0.015574883203953505, 0.024440275970846415, 0.024940682807937264, -0.0767935961484909, -0.02395771024748683, 0.028084914898499846, -0.0915510281920433, 0.02133126324042678, 0.013071146167021652, 0.004649237322155386, 0.08952618017792702, 0.03991545923054218, 0.0416784998960793, -0.06148885563015938, -0.01432584528811276, 0.008203202858567238, 0.020670469384640455, -0.027112244328236557, 0.0039047824539011344, -0.024497278966009617, -0.043294325936585665, -0.025314603466540575, -0.0067777622025460005, -0.040093651972711086, 0.009956442285329103, -0.03299230616539717, -0.01792255137115717, 0.012778022966813296, -0.03521473368164152, -0.010197664145380259, 0.01715578866424039, -0.008158075157552958, 0.04854840412735939, 0.07429435942322016, 0.040353764314204454, 0.034050410613417625, -0.06899271160364151, 0.05916056968271732, 0.009034074377268553, -0.015106763457879424, -0.00039310590364038944, -0.01474015589337796, 0.0068119101342745125, 0.030776663683354855, 0.04403356648981571, -0.03385453065857291, 0.013438114430755377, 0.017026713234372437, -0.05315904412418604, 0.002748164813965559, -0.002453066874295473, -0.04506317153573036, 0.012577373650856316, 0.057200564071536064, 0.06909130979329348, -0.0031225606217049062, -0.003926296718418598, 0.048229482024908066, -0.008486846985761076, 0.0746435010805726, -0.000002196320565417409, 0.001961063011549413, 0.012371355667710304, -0.00031584547832608223, 0.03543752012774348, -0.009082387339731213, -0.019061634404351935, 0.018139481428079307, -0.0034449175582267344, 0.02569328702520579, -0.06800238601863384, -0.010652570286765695, 0.04442033916711807, 0.0008707062224857509, -0.03791629173792899, -0.01974694279488176, -0.012471344787627459, -0.05222656764090061, 0.027658848877763376, 0.0261795298429206, 0.03837209613993764, 0.03547914605587721, -0.065070073120296, 0.015463256451766938, 0.004419506039994303, -0.02969307790044695, -0.012613456230610609, 0.03048483419115655, 0.007312143221497536, -0.08750566467642784, -0.017710077576339245, -0.03023367328569293, 0.021140164230018854, 0.10436926037073135, 0.011926733888685703, 0.009961859206669033, -0.029476960422471166, -0.020159751875326037, -0.07790366746485233, 0.06886674929410219, 0.07955041993409395, -0.009233276476152241, -0.0632511768490076, 0.003533775918185711, 0.03217921918258071, -0.0017657459757174365, 0.0499554630368948, -0.022411202546209097, 0.00822790467645973, 0.007166558876633644, -0.13091474398970604, -0.06948660034686327, 0.031344231218099594, -0.010657696751877666, -0.025052876735571772, 0.009426685981452465, -0.000860230065882206, -0.04037135327234864, 0.06806340254843235, 0.02604401228018105, -0.07262456882745028, 0.10524584539234638, -0.017017694772221148, 0.03847663733176887, 0.015304135085898452, -0.022285677026957273, -0.0003880725707858801, 0.03794682491570711, -0.06800171174108982, -0.039943912997841835, 0.08338448591530323, 0.012431795010343194, -0.004205749952234328, 0.01789577683666721, 0.02100188471376896, 0.0023398662451654673, -0.03323878743685782, -0.06432780250906944, 0.03639972861856222, 0.011190281802555546, 0.002120053926773835, 0.06202080566436052, 0.05974051542580128, 0.024543930077925324, -0.0370339029468596, -0.020636610919609666, -0.0005317113827914, -0.07742119580507278},
|
|
e)
|
|
})
|
|
}
|
|
|
|
func TestEmbeddingsMidpoint(t *testing.T) {
|
|
t.Run("2 embeddings, 1 dimension", func(t *testing.T) {
|
|
e := Embeddings{Embedding{1}, Embedding{3}}
|
|
|
|
result, r, c := EmbeddingsMidpoint(e)
|
|
|
|
assert.Equal(t, Embedding{2}, result)
|
|
assert.Equal(t, 1.01, r)
|
|
assert.Equal(t, 2, c)
|
|
})
|
|
t.Run("3 embeddings, 1 dimension", func(t *testing.T) {
|
|
e := Embeddings{Embedding{1}, Embedding{3}, Embedding{4}}
|
|
|
|
result, r, c := EmbeddingsMidpoint(e)
|
|
|
|
assert.Equal(t, Embedding{2.6666666666666665}, result)
|
|
assert.Equal(t, 1.6766666666666665, r)
|
|
assert.Equal(t, 3, c)
|
|
})
|
|
t.Run("4 embeddings, 1 dimension", func(t *testing.T) {
|
|
e := Embeddings{Embedding{1}, Embedding{3}, Embedding{4}, Embedding{8}}
|
|
|
|
result, r, c := EmbeddingsMidpoint(e)
|
|
|
|
assert.Equal(t, Embedding{4}, result)
|
|
assert.Equal(t, 4.01, r)
|
|
assert.Equal(t, 4, c)
|
|
})
|
|
t.Run("empty embedding", func(t *testing.T) {
|
|
e := Embeddings{}
|
|
|
|
result, r, c := EmbeddingsMidpoint(e)
|
|
|
|
assert.Len(t, result, 0)
|
|
assert.Equal(t, float64(0), r)
|
|
assert.Equal(t, 0, c)
|
|
})
|
|
t.Run("embedding with different length", func(t *testing.T) {
|
|
e := Embeddings{Embedding{1}, Embedding{3, 5}}
|
|
|
|
result, r, c := EmbeddingsMidpoint(e)
|
|
|
|
assert.Equal(t, Embedding{2}, result)
|
|
assert.Equal(t, 1.01, r)
|
|
assert.Equal(t, 2, c)
|
|
})
|
|
t.Run("vectors", func(t *testing.T) {
|
|
e := Embeddings{Embedding{1, 0, 0, 0}, Embedding{0, 1, 0, 0}, Embedding{0, 0, 1, 0}, Embedding{0, 0, 0, 1}}
|
|
|
|
result, radius, count := EmbeddingsMidpoint(e)
|
|
|
|
assert.Equal(t, Embedding{0.25, 0.25, 0.25, 0.25}, result)
|
|
assert.Greater(t, 0.87612, radius)
|
|
assert.Less(t, 0.8760, radius)
|
|
assert.Equal(t, 4, count)
|
|
})
|
|
}
|
|
|
|
func TestUnmarshalEmbeddings(t *testing.T) {
|
|
t.Run("Ok", func(t *testing.T) {
|
|
emb, err := UnmarshalEmbeddings("[[-0.013,-0.031]]")
|
|
|
|
assert.NoError(t, err)
|
|
assert.Equal(t, Embeddings{{-0.013, -0.031}}, emb)
|
|
})
|
|
t.Run("NoPrefix", func(t *testing.T) {
|
|
emb, err := UnmarshalEmbeddings("-0.013,-0.031]")
|
|
|
|
assert.Error(t, err)
|
|
assert.Nil(t, emb)
|
|
})
|
|
t.Run("InvalidValues", func(t *testing.T) {
|
|
emb, err := UnmarshalEmbeddings("[[true, false]]")
|
|
|
|
assert.Error(t, err)
|
|
assert.Equal(t, Embeddings{{0, 0}}, emb)
|
|
})
|
|
}
|