DimensionReduction[{example1,example2,…}]
exampleiで定義される空間からより低い次元の近似多様体に投影するDimensionReducerFunction[…]を生成する.
DimensionReduction[vecs,n]
n 次元近似多様体のためのDimensionReducerFunction[…]を生成する.
DimensionReduction[vecs,n,props]
次元削減の指定された特性を生成する.
DimensionReduction
DimensionReduction[{example1,example2,…}]
exampleiで定義される空間からより低い次元の近似多様体に投影するDimensionReducerFunction[…]を生成する.
DimensionReduction[vecs,n]
n 次元近似多様体のためのDimensionReducerFunction[…]を生成する.
DimensionReduction[vecs,n,props]
次元削減の指定された特性を生成する.
詳細とオプション
- DimensionReductionは,数値,テキスト,サウンド,画像,それらの組合せを含む,さまざまなデータタイプに使うことができる.
- DimensionReduction[examples]は,次元削減を行うためにデータに適用可能なDimensionReducerFunction[…]を与える.
- 各 exampleiは,単一のデータ要素,データ要素のリスト,データ要素の連想,あるいはDatasetオブジェクトでよい.
- DimensionReduction[examples]は,対象の近似多様体に適した次元を自動的に選択する.
- DimensionReduction[examples]はDimensionReduction[examples,Automatic]に等しい.
- DimensionReduction[…,props]の props は単一の特性または特性のリストでよい.以下は使用可能なリストである.
-
"ReducerFunction" DimensionReducerFunction[…](デフォルト) "ReducedVectors" ベクトル exampleiの削減 "ReconstructedData" 削減と反転の後の examples の再構築 "ImputedData" データ補完された値で置換された,examples 内の欠落値 - 使用可能なオプション
-
FeatureExtractor Identity 学ぶべき対象から特徴をどのように抽出するか FeatureNames Automatic exampleiの要素に割り当てる名前 FeatureTypes Automatic exampleiの要素について仮定する特徴タイプ Method Automatic どの削減アルゴリズムを使用するか PerformanceGoal Automatic パフォーマンスのどの面について最適化するか RandomSeeding 1234 どのような擬似乱数生成器のシードを内部的に使うべきか TargetDevice "CPU" そこで訓練を行うターゲットデバイス - PerformanceGoalの可能な設定
-
"Memory" 削減器関数のストレージ要求を最少にする "Quality" 削減の質を最大にする "Speed" 削減速度を最大にする "TrainingSpeed" 削減器の生成に使う時間を最少にする - PerformanceGoal{goal1,goal2,…}は,goal1,goal2等を自動的に組み合せる.
- Methodの可能な設定
-
Automatic 自動選択されたメソッド "Autoencoder" 訓練可能な自動エンコーダを使う "Hadamard" アダマール(Hadamard)行列を使ってデータを投影 "Isomap" 等長写像 "LatentSemanticAnalysis" 潜在的意味分析メソッド "Linear" 最適な線形メソッドを自動的に選択する "LLE" 局所的線形埋込み "MultidimensionalScaling" 多次元スケーリング測度 "PrincipalComponentsAnalysis" 主成分分析法 "TSNE"
-分布に従う確率近傍埋込みアルゴリズム"UMAP" 一様多様体の近似と投影 (Uniform Manifold Approximation and Projection) - RandomSeedingの可能な設定
-
Automatic 関数が呼び出されるたびに自動的にシードを変える Inherited 外部シードの乱数を使う seed 明示的な整数または文字列をシードとして使う - DimensionReduction[…,FeatureExtractor"Minimal"]は,内部的な前処理はできる限り簡単にすべきであることを示している.
- DimensionReduction[DimensionReducerFunction[…],FeatureExtractorfe]を使って既存の特徴抽出器の先頭にFeatureExtractorFunction[…] fe を加えることができる.
例題
すべて開く すべて閉じる例 (3)
dr = DimensionReduction[{{1, 2, 3}, {2, 3, 5}, {3, 5, 8}, {4, 5, 8.5}}]dr[{6, 7, 14}]dr[{{6, 7, 14}, {5, 6, 11}, {1, 3, Missing[]}}]vectors = {{1, 2, 3}, {2, 3, 5}, {3, 5, 8}, {4, Missing[], 8.5}};dr = DimensionReduction[vectors, 1]dr[vectors]DimensionReduction[vectors, 1, {"ReducerFunction", "ReducedVectors"}]dr = DimensionReduction[{{1.4, "A"}, {1.5, "A"}, {2.3, "B"}, {5.4, "B"}}]dr[{2.4, "A"}]スコープ (7)
vectors = Join[RandomReal[{0, 3}, {1000, 3}], RandomReal[{2, 5}, {1000, 3}], RandomReal[{4, 7}, {1000, 3}] ];ListPointPlot3D[vectors]dr = DimensionReduction[vectors, 2]dr[{0.3, 0.2, 0.4}]reduced = dr[vectors];ListPlot[reduced]reconstructed = dr[reduced, "OriginalVectors"];再構築されたベクトルは,近似平面に投影されたもとのベクトルに相当する:
ListPointPlot3D[{vectors, reconstructed}]再構築されたベクトルは,もとのベクトルから直接得ることもできる:
reconstructed = dr[vectors, "ReconstructedVectors"];ListPointPlot3D[{vectors, reconstructed}]dr = DimensionReduction[{{1, 2, 3}, {2, 3, 5}, {3, 5, 8}, {4, 5, 8.5}}]newvectors = {{6, 7, Missing[]}, {5, Missing[], 11}};dr[newvectors, "ImputedVectors"]dr = DimensionReduction[{[image], [image], [image] , [image], [image], [image]}, 5]dr[{[image], [image], [image] , [image], [image], [image]}]dr = DimensionReduction[{"the cat is grey", "my cat is fast", "this dog is scary", "the big dog"}]dr[{"it is not a cat", "what a nice dog", "here is a dog again"}]次元削減器をDateObjectのリストについて訓練する:
dr = DimensionReduction[{DateObject[{2014, 5, 5, 9, 53, 6.30158}, "Instant", "Gregorian", -6.], DateObject[{2000, 1, 1, 0, 0, 0.}, "Instant", "Gregorian", -6.], DateObject[{2006, 12}, "Month", "Gregorian", -6.], DateObject[{2007, 8, 23}, "Day", "Gregorian", -6.], DateObject[{2016, 4, 4, 15, 59, 18.2738}, "Instant", "Gregorian", -4.]}]新たなDateObjectの次元を削減する:
dr[DateObject[{2003, 1, 2}, "Day", "Gregorian", -6.]]dr["2nd of January 2003"]dr = DimensionReduction[{{"the cat is grey", [image]}, {"my cat is fast", [image]}, {"this dog is scary", [image]}, {"the big dog", [image]}}]dr[{"the nice cat", [image]}]dr = DimensionReduction[{<|"age" -> 32, "height" -> 160, "gender" -> "female"|>,
<|"height" -> 183, "age" -> 41, "gender" -> "female"|>,
<|"height" -> 123, "age" -> 30, "gender" -> "female"|>,
<|"height" -> 175, "age" -> 21, "gender" -> "male"|>,
<|"height" -> 150, "age" -> 11, "gender" -> "male"|>,
<|"age" -> 52, "height" -> 164, "gender" -> "female"|>}]dr[<|"age" -> 19, "height" -> 176, "gender" -> "male"|>]オプション (7)
FeatureExtractor (1)
カスタム関数と抽出器法で前処理されたテキストについて,削減器関数を訓練する:
dr = DimensionReduction[{"The cat is grey.", "My cat is fast.", "This dog is scary." , "The big dog."}, FeatureExtractor -> {ToUpperCase, RemoveDiacritics, "SegmentedWords"}]dr[{"Nice CAT", "nice cat", "WhaT A Dög", "what a dog" }]FeatureNames (1)
dr = DimensionReduction[{{2.3, "male"}, {4.8, Missing[]}, {Missing[], "female"}, {5.2, "female"}}, FeatureNames -> {"age", "gender"}]dr[<|"age" -> 3.3, "gender" -> "male"|>]dr[{3.3, "male"}]FeatureTypes (1)
dr = DimensionReduction[{{1, "A"}, {2, "A"}, {2, "B"}, {1, "B"}}]最初の特徴は数値と解釈される.FeatureTypesを使って最初の特徴の名目的解釈を強制する:
dr = DimensionReduction[{{1, "A"}, {2, "A"}, {2, "B"}, {1, "B"}}, FeatureTypes -> <|1 -> "Nominal"|>]dr[{{1, "A"}, {2, "A"}, {2, "B"}, {1, "B"}}] // MatrixFormMethod (3)
t-SNEメソッドを使ってフィッシャー(Fisher)の「アヤメ」に関するデータ集合の次元を削減する:
iris = ExampleData[{"MachineLearning", "FisherIris"}, "Data"];diris = DimensionReduction[iris[[All, 1]], 2, Method -> "TSNE"]byspecies = GroupBy[iris, Last -> First];byspecies = diris /@ byspecies;ListPlot[Values[byspecies], PlotLegends -> Keys[byspecies]]diris = DimensionReduction[iris[[All, 1]], 2, Method -> {"TSNE", "Perplexity" -> 100}]byspecies = GroupBy[iris, Last -> First];
byspecies = diris /@ byspecies;
ListPlot[Values[byspecies], PlotLegends -> Keys[byspecies]]fmnist = {[image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image]};
reduced = DimensionReduce[fmnist, 2, Method -> "Autoencoder"];ListPlot[MapThread[Labeled[#1, #2]&, {reduced, fmnist}], ...]ランダムノイズで,スイスロール(Swiss-roll)データ集合として知られる非線形データマニホールドを生成する:
m = 1000;
noise = 0.1;
aa = 1; bb = 4; t = (π/4) + (1 + 2 * RandomReal[aa, m]);
h = 2 * RandomReal[aa, m];
data = Table[{t[[i]] * Cos[bb * t[[i]]] + noise * RandomReal[aa], h[[i]],
t[[i]] * Sin[bb * t[[i]]] + noise * RandomReal[aa]}, {i, m}];ListPointPlot3D[data, BoxRatios -> {1, 1, 1}, PlotStyle -> Directive[PointSize -> Large] ]等長写像(isomap)メソッドを使って削減化関数を訓練する:
drI = DimensionReduction[data, Method -> "Isomap"]pts = drI[data];
ListPlot[pts, PlotStyle -> Directive[PointSize -> Small]]局所的線形埋込み(LLE)メソッドを使って削減器関数を訓練する:
drL = DimensionReduction[data, Method -> "LLE"]pts = drL[data];
ListPlot[pts, AspectRatio -> 1.3, PlotStyle -> Directive[PointSize -> Small]]TargetDevice (1)
システムのデフォルトGPU上の完全に連結された"AutoEncoder"を使って削減器関数を訓練し,そのAbsoluteTimingを見る:
AbsoluteTiming[DimensionReduction[RandomReal[1, {10000, 10}], Method -> {"AutoEncoder", "NetworkType" -> "FullyConnected"}, TargetDevice -> "GPU"]]AbsoluteTiming[DimensionReduction[RandomReal[1, {10000, 10}], Method -> {"AutoEncoder", "NetworkType" -> "FullyConnected"}]]アプリケーション (5)
データ集合の可視化 (1)
ExampleDataから,フィッシャーの「アヤメ」のデータ集合をロードする:
iris = ExampleData[{"MachineLearning", "FisherIris"}, "Data"];ExampleData[{"MachineLearning", "FisherIris"}, "LongDescription"]RandomSample[iris, 5]diris = DimensionReduction[iris[[All, 1]], 2]byspecies = GroupBy[iris, Last -> First];byspecies = diris /@ byspecies;ListPlot[Values[byspecies], PlotLegends -> Keys[byspecies]]頭部姿勢推定 (1)
obj = ExampleData[{"Geometry3D", "Beethoven"}]異なる頭部姿勢を形成する,ランダムな視点からの多くの頭部のデータ集合を生成する:
cc = RandomPoint[Circle[{0, 0}, 0.8, {Pi, 2Pi}], 50];
pp = Flatten[Table[{cc[[i, 1]], cc[[i, 2]], j}, {i, 1, Length@cc}, {j, -0.8, 0.8, 0.2}], 1];
vp = RandomSample[pp, 60];
poses = Table[Show[obj, ViewPoint -> vp[[i]]], {i, 1, Length@vp}];
imgs = Table[Rasterize[poses[[i]], ImageResolution -> 10, Background -> None], {i, 1, Length@poses}];RandomSample[imgs, 6]LLEメソッドを使って,さまざまな姿勢の画像のデータ集合について削減器関数を生成する:
redpts = DimensionReduce[imgs, 2, Method -> {"LLE", "NeighborsNumber" -> 8}];2本の軸が上下と前後の姿勢を表す,50×50入力空間からの画像の二次元表現を可視化する:
Graphics[MapThread[Inset[#1, #2, {0, 0}, 0.55, Background -> None]&, {imgs, redpts}], ImageSize -> 500, ImagePadding -> 40, Frame -> True, FrameTicks -> None, AspectRatio -> 1]画像の補完 (1)
ExampleDataからMNISTデータ集合をロードし,その画像を保存する:
digits = ExampleData[{"MachineLearning", "MNIST"}, "TestData"][[All, 1]];RandomSample[digits, 10]画像を数値データに変換し,データ集合を訓練集合と検定集合に分割する:
digits = Flatten[ImageData[#]]& /@ RandomSample[digits];trainingset = digits[[ ;; 9000]];
testset = digits[[9001 ;; ]];Dimensions[trainingset]dr = DimensionReduction[trainingset, 50]vector = RandomChoice[testset];dr[vector]toimage = Image[Partition[#, 28], ImageSize -> Tiny] &;toimage /@ {vector, dr[vector, "ReconstructedVectors"]}ベクトルのいくつかの値をMissing[]で置換し,これを可視化する:
vectormissing = vector;
vectormissing[[309 ;; 364]] = Missing[];
imagemissing = toimage[Replace[vectormissing, _Missing -> .5, {1}]]imputedimage = toimage[dr[vectormissing, "ImputedVectors", PerformanceGoal -> "Quality"]]{toimage[vector], imagemissing, imputedimage}推薦者の系 (1)
ユーザによる映画の評価をSparseArray形で得る:
ratings = SparseArray[Uncompress["1:eJztW9FOwzAMzLpVSPwF/wMvfAJCoL7AQ/l/0XUSGTRJ7fM5zSpeqq3qUse+nM9O9vDy+fz2GkIYT9PlcRi/3u5/fQvnb3fT5WkYx+HjfXFj6KfPy7vH6fN8QUdYsWM4WcbW3xgO54G0vjk/6m0pEi+aW/j2ZZyowJODzzrm2y9zgfB0zOJpNlE6Qrd4txCkJoRr45KZKGppmqfSo1E4MO18+LEVPhSOTQuV1WcZKHUGPF18sDM+jGseJaDoWE6MYPhT1hpMuBrTkTzvpz2c1hrNtUSMN7oGt+d3aT5TLMUrUjHjqQ9MgYRoI0eMC3grLb9iNjMRuMP6p4WKwp/VGWJn9nGrI5ImnhHfh+sF0A6eULYg+qbmNNrhC8S+269tCgm47no0VVbpu8uavaS3qQas4eYg8y8tLdNxk5EVtMIC7rcU0DR73bOv4plr1bOFtQJSj2s0v6oYoej/FnOqxgsS7cHbT5D1a80cE6UhD79p0/em0YSVtLDvLqkhFTJnLayi9ync+edSMMrJzzTitdYxmiAl9lnyQuoqrofsizAd1IUcu2k6WyJM0fhxs72+n3jXAeVm66WAinbWMM5jJklSSzdV1bbCOBZamXDgkf122HtpSz3j9c9VGl7wPDNAo5hCYF33b5rpYa0pPlVYd98fzRNnhdjF6pWX3nagC6RhQ1uSwt9JtYqHMU41r7Cv2mAdXiGfSJkSFQ2b9urUeEfPLMkgZrcPZKjGNIxUo8jmVW3NOp4Pl8o8y37U5cc+2kb6WJSpUo0ARys2wnpk3qZDgsnR8H5eOn2o3g3FvrDN4HKjHb3GOydI0wLGnjX3/wBa32RKUwVr3HaewvmXGzuchwonBts6J7jRWRUeaul+ct7lIJ3VTyf7reqk2j2dbwG5Z0c="], Automatic, Missing[]]このデータ集合は,100人のユーザと10の映画からなる.評価範囲は1から5までで,Missing[]は未評価を意味する:
ratings[[ ;; 10, ;; 5]]//MatrixFormtraining = ratings[[ ;; 80]];
test = ratings[[81 ;; ]];dr = DimensionReduction[training, 3]この次元削減器を使い,新規ユーザの欠落値を補完(つまり推測)する:
newuser = RandomChoice[test]dr[newuser, "ImputedVectors"]画像検索 (1)
dataset = {[image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image]};dr = DimensionReduction[dataset, 10]削減された空間でNearestFunctionを生成する:
nf = Nearest[dr[dataset] -> Automatic]NearestFunctionを使ってデータ集合に最も近い画像を表示する関数を構築する:
nearestdog = dataset[[First@nf[dr[#]]]]&nearestdog[[image]]nearestdog[[image]]nearestdog[[image]]削減器関数を使って小さすぎる画像のペアを削除することもできる:
reduced = # -> dr[#]& /@ dataset;First /@ DeleteDuplicates[reduced, CosineDistance[#1[[2]], #2[[2]]] < 1 &]テキスト
Wolfram Research (2015), DimensionReduction, Wolfram言語関数, https://reference.wolfram.com/language/ref/DimensionReduction.html (2020年に更新).
CMS
Wolfram Language. 2015. "DimensionReduction." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/DimensionReduction.html.
APA
Wolfram Language. (2015). DimensionReduction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DimensionReduction.html
BibTeX
@misc{reference.wolfram_2026_dimensionreduction, author="Wolfram Research", title="{DimensionReduction}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/DimensionReduction.html}", note=[Accessed: 07-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_dimensionreduction, organization={Wolfram Research}, title={DimensionReduction}, year={2020}, url={https://reference.wolfram.com/language/ref/DimensionReduction.html}, note=[Accessed: 07-September-2026]}