AI用語辞典

A comprehensive multilingual AI terminology dictionary

Definition

ハッシングトリックとも呼ばれるフィーチャーハッシングは、機械学習モデルが明示的な特徴量とインデックスのマッピングを維持することなく、大規模で疎な特徴空間を処理できるようにします。ハッシュ関数を適用することで、メモリ効率を高めながら高次元データを低次元の固定サイズベクトルに変換します。

Summary

ハッシュ関数を用いて、高次元の疎な特徴量を固定サイズのベクトルにマッピングする手法。

Key Concepts

Use Cases

Code Example

1
2
3
4
5
6
7
8
from sklearn.feature_extraction import FeatureHasher
import numpy as np

# Example: Hashing text features
hasher = FeatureHasher(n_features=10, input_type='string')
docs = ['hello world', 'hello python', 'world python']
hashed = hasher.transform(docs)
print(hashed.toarray())