oneAPI 1.3 暫定仕様書 Rev. 1 の解説 (44)

その他

この記事は、https://www.oneapi.io/spec/ で 2023年9月14日に公開された『oneAPI 1.3 Provisional Specification Rev. 1』 (HTMLPDF) をベースにしています。原文は2000 ページ近くあり、翻訳の時間とリソースも限られるため、全文翻訳ではなく、記事形式で区切った仕様とその解説を提供することにしました。


この回では、『oneAPI 1.3 Provisional Specification Rev. 1』の「oneDAL」の「Algorithms」の節を取り上げています。

アルゴリズム

アルゴリズム・コンポーネントは、データ解析 (データマイニング) およびデータモデリング (トレーニングと予測) 用のアルゴリズムを実装するクラスから構成されます。これらのアルゴリズムには、行列分解、クラスタリング、分類、回帰アルゴリズムと相関ルールが含まれます。

クラスタリング

K 平均法

K 平均法アルゴリズムは、n 個の特徴ベクトルを k 個のクラスターに分散し、いくつかの基準を最小化することでクラスタリングの問題を解決します。各クラスターは、セントロイド (中心) と呼ばれる代表点により特徴付けられます。

操作 計算メソッド プログラミング・インターフェイス
トレーニング ロイド train(…) train_input train_result
推論 ロイド infer(…) infer_input infer_result

数学的定式化

トレーニング

p 次元の特徴ベクトルのトレーニング・セット X={x1,…,xn} と正の整数 k が与えられた場合、問題は目的関数を最小化する p 次元の重心のセット C={c1,…,ck} を検出します。

ここで、d2(xi, C) は、xi から C の最も近い重心までのユークリッド二乗距離になります。

‖⋅‖L2 ノルムを表します。

注: 一般に d は任意の距離関数です。oneDAL の現在の仕様ではユークリッド距離のみが定義されています。

トレーニング法: ロイド

ロイド法 [Lloyd82 (英語)] は、割り当てと更新ステップを交互に適用し、中心を繰り返し更新することで構成されます。ここで、t は現在のインデックスをしまします。例えば、 は、t 番目の反復の重心セットです。この方法では、アルゴリズムの開始時に中心 C(1) を指定する必要があります (t=1)

(1) 割り当てステップ: 各特徴ベクトル xi を最も近い重心に割り当てます。 は、特徴ベクトル xi に割り当てられたラベル (クラスター・インデックス) を示します。

トレーニング・セット X の特徴ベクトルは、Xk 個の互いに素なセット (クラスター) に分割されるように、正確に 1 つの重心に割り当てられます。

(2) 更新ステップ: 各クラスターに割り当てられた特徴ベクトルを平均化して、中心を再計算します。

ステップ (1) と (2) は、次の停止条件まで繰り返されます。

上記が満たされるか、反復回数がユーザー定義の最大値 T を超えています。

推論

p 次元の特徴ベクトルの推論セット とトレーニング・ステージで生成された重心セット C = {c1, …, ck} を考慮すると、問題はメソッドで定義されたルールに従ってインデックス 1≤ j ≤ m を予測することです。

推論法: ロイド

ロイドの推論方法は、 を特徴ベクトル に最も近い中心のインデックスとして計算します。

使用例

使用例については、こちら (英語) を参照してください。

プログラミング・インターフェイス

この節のすべてのタイプと関数は、oneapi::dal::kmeans 名前空間で宣言され、oneapi/dal/algo/kmeans.hpp ヘッダーファイルをインクルードして使用できます。

プログラミング・インターフェイスについては、こちら (英語) を参照してください。

K 平均法の初期化

K 平均法初期化アルゴリズムは、入力として n 個の特徴ベクトルを受け取り、k 個の初期中心を選択します。初期化後、K 平均法アルゴリズムは初期化した結果を使用して、入力データを k 個のクラスターに分散します。

操作 計算メソッド プログラミング・インターフェイス
計算 compute(…) compute_input compute_result

数学的定式化

計算

p 次元の特徴ベクトルのトレーニング・セット X = {x1, …, xn} と正の整数 k が与えられた場合、問題は p 次元の初期重心のセット C = {c1, …, ck} を検出します。

計算メソッド: 密

この方法では、トレーニング・セット X から最初の k 個の特徴ベクトルを選択します。

使用例

使用例については、こちら (英語) を参照してください。

プログラミング・インターフェイス

この節のすべてのタイプと関数は、oneapi::dal::kmeans_init 名前空間で宣言され、oneapi/dal/algo/kmeans_init.hpp ヘッダーファイルをインクルードして使用できます。

プログラミング・インターフェイスについては、こちら (英語) を参照してください。


法務上の注意書き

The content of this oneAPI Specification is licensed under the Creative Commons Attribution 4.0 International License (英語). Unless stated otherwise, the sample code examples in this document are released to you under the MIT license (英語).

This specification is a continuation of Intel’s decades-long history of working with standards groups and industry/academia initiatives such as The Khronos Group*, to create and define specifications in an open and fair process to achieve interoperability and interchangeability. oneAPI is intended to be an open specification and we encourage you to help us make it better. Your feedback is optional, but to enable Intel to incorporate any feedback you may provide to this specification, and to further upstream your feedback to other standards bodies, including The Khronos Group SYCL* specification, please submit your feedback under the terms and conditions below. Any contribution of your feedback to the oneAPI Specification does not prohibit you from also contributing your feedback directly to other standard bodies, including The Khronos Group under their respective submission policies.

By opening an issue, providing feedback, or otherwise contributing to the specification, you agree that Intel will be free to use, disclose, reproduce, modify, license, or otherwise distribute your feedback at its sole discretion without any obligations or restrictions of any kind, including without limitation, intellectual property rights or licensing obligations.

This document contains information on products, services and/or processes in development. All information provided here is subject to change without notice.

© Intel Corporation. Intel、インテル、Intel ロゴ、その他のインテルの名称やロゴは、Intel Corporation またはその子会社の商標です。

* その他の社名、製品名などは、一般に各社の表示、商標または登録商標です。

« パート 43        目次        パート 45 »
タイトルとURLをコピーしました