0Pricing
NLP Academy · レッスン

単語の演算: King - Man + Woman

類推と最近傍を調べる

「単語の演算: King - Man + Woman」はCoddyKit上の無料NLP Academyレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはNLP Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 NLP Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Vectors Have Directions

Because words are now vectors, you can add and subtract them like arrows. This unlocks a playful idea called word math.

The Famous Example

Take king, subtract man, add woman, and the nearest vector is queen. This analogy stunned researchers when it first appeared. 👑

result = emb["king"] - emb["man"] + emb["woman"]
# nearest word -> "queen"

Why It Works

The step from man to woman is a consistent direction in space. Adding that same direction to king lands you near queen.

Relationships as Offsets

Many relations become repeatable vector offsets. The gap encoding gender or tense behaves like a fixed arrow across word pairs.

More Analogies

The trick generalizes nicely. Paris minus France plus Italy lands near Rome, capturing a capital-city relationship.

r = emb["paris"] - emb["france"] + emb["italy"]
# nearest word -> "rome"

Finding the Answer

You compute the target vector, then search for its nearest neighbor among all word vectors using cosine similarity.

One Line in Gensim

gensim wraps the whole analogy in a single call. You list positive and negative words and read the top result.

model.most_similar(positive=["king", "woman"],
                   negative=["man"], topn=1)

Nearest Neighbors

Even without subtraction, you can ask which words sit closest to one term. These neighbors reveal what the model thinks is similar.

It Is Not Perfect

Analogies often work, but not always. Bias in the training text can produce unfair or wrong results, so stay critical.

Bias Lives in Vectors

Embeddings absorb the stereotypes present in their data. Always remember that bias in text becomes bias in your model.

Why This Amazes People

Simple arithmetic on learned vectors reflects real human relationships. That is the clearest sign embeddings truly capture meaning. ✨

Quick Check

What does king minus man plus woman tend to produce?

Recap

Word math adds and subtracts vectors to solve analogies like king to queen. It shows embeddings encode real relationships, bias and all. ✅

よくある質問

「単語の演算: King - Man + Woman」レッスンは無料ですか?

はい。「単語の演算: King - Man + Woman」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、NLP Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 NLP Academyコースには全4レッスンが含まれています。

「単語の演算: King - Man + Woman」で何を学びますか?

類推と最近傍を調べる ブラウザで直接実行するハンズオンコードでNLP Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

NLP Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのNLP Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「単語の演算: King - Man + Woman」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このNLP Academyレッスンでコードを書いて実行できますか?

はい。すべてのNLP Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. スパースなカウントから密ベクトルへ
  2. word2vec が意味を学習する仕組み
  3. Python で GloVe ベクトルを読み込む
  4. 単語の演算: King - Man + Woman
← NLP Academyに戻る