?
- (NLP), .
.
(: https://en.wikipedia.org/wiki/Word_embedding)
Word2Vec?
Word2vec - , . , .
Word2vec , , .
, , , .
(: https://en.wikipedia.org/wiki/Word2vec)
?
- , ( ), .
, .
, .
/ ?
( ) , , ( "" ) , .
, , .
, , .
(: https://en.wikipedia.org/wiki/Vector_space)
?
-, ( : ).
, IS ( ) ( )
, , tensor. - .
OP:
?
- (. )
?
, - .
, "" :
>>> semnum = semantic_numbers = {'car': 5, 'vehicle': 2, 'apple': 232, 'orange': 300, 'fruit': 211, 'samsung': 1080, 'iphone': 1200}
>>> abs(semnum['fruit'] - semnum['apple'])
21
>>> abs(semnum['samsung'] - semnum['apple'])
848
, fruit apple , samsung apple . "" , .
, (, ):
>>> import numpy as np
>>> semnum = semantic_numbers = {'car': [5, -20], 'vehicle': [2, -18], 'apple': [232, 1010], 'orange': [300, 250], 'fruit': [211, 250], 'samsung': [1080, 1002], 'iphone': [1200, 1100]}
, :
>>> np.array(semnum['apple']) - np.array(semnum['orange'])
array([-68, 761])
>>> np.array(semnum['apple']) - np.array(semnum['samsung'])
array([-848, 8])
, , , , . :
>>> import numpy as np
>>> orange = np.array(semnum['orange'])
>>> apple = np.array(semnum['apple'])
>>> samsung = np.array(semnum['samsung'])
>>> np.linalg.norm(apple-orange)
763.03604108849277
>>> np.linalg.norm(apple-samsung)
848.03773500947466
>>> np.linalg.norm(orange-samsung)
1083.4685043876448
"", apple samsung, orange - samsung. , apple samsung, orange.
, " ?" . , Word2Vec/embedding ( Bengio 2003).
, , , (.. )?
, / , , .
, , . , , , , .
, " " ( ) / /, , .
, , Word2Vec, , .
: https://github.com/keon/awesome-nlp#word-vectors