LearnDistribution[{example1,example2,…}]
与えられた例のもとになっている分布を表そうとするLearnedDistribution[…]を生成する.
LearnDistribution
LearnDistribution[{example1,example2,…}]
与えられた例のもとになっている分布を表そうとするLearnedDistribution[…]を生成する.
詳細とオプション
- LearnDistributionは,データに対して機械学習モデルを訓練し,確率分布を自動的に発見してフィットし,その結果としてLearnedDistributionオブジェクトを返す.
- LearnDistributionは,数値,名義,画像等のさまざまなデータ型に使うことができる.
- 各 exampleiは,単一のデータ要素,データ要素のリスト,あるいはデータ要素の連想でよい.例はDatasetオブジェクトあるいはTabularオブジェクトとして与えることもできる.
- LearnDistributionは,事実上,exampleiのそれぞれが,LearnDistributionが推測しようとするもとになっている分布から,独立に取られたと仮定する.
- LearnDistribution[examples]はLearnedDistribution[…]を与える.これには次の関数を使うことができる.
-
PDF[dist,…] データの確率または確率密度 RandomVariate[dist] 分布から生成されたランダムなサンプル SynthesizeMissingValues[dist,…] 分布に従って欠損値を埋める RarerProbability[dist,…] 指定された例よりも低いPDFのサンプルを生成する確率を計算する - 次は,使用可能なオプションである.
-
FeatureExtractor Identity 学習する特徴をどのように抽出するか FeatureNames Automatic 入力データに割り当てる特徴名 FeatureTypes Automatic 入力データに仮定する特徴タイプ Method Automatic どのモデリングアルゴリズムを使用するか PerformanceGoal Automatic 最適化するパフォーマンスの局面 RandomSeeding 1234 擬似乱数生成器の内部的シードをどのように行うか TimeGoal Automatic 分類器の訓練にどの程度の時間を費やするか TrainingProgressReporting Automatic 訓練中の進捗状況をどのように報告するか ValidationSet Automatic 訓練中にモデルの評価に使うデータ集合 - 次は,PerformanceGoalの可能な設定である.
-
"DirectTraining" 完全なデータ集合について,モデルを検索することなしに直接訓練する "Memory" 分布の必要メモリを最小にする "Quality" 分布のモデリング品質を最高にする "Speed" PDFクエリのスピードを最高にする "SamplingSpeed" ランダムサンプルの生成スピードを最高にする "TrainingSpeed" 分布の生成にかける時間を最小にする Automatic スピード,品質,メモリの自動トレードオフ {goal1,goal2,…} goal1,goal2等を自動的に結合する - 次は,Methodの可能な設定である.
-
"ContingencyTable" データを離散化し,それぞれの可能な確率を保存する "DecisionTree" 決定木を使って確率を計算する "GaussianMixture" ガウス(正規)分布の混合を使う "KernelDensityEstimation" カーネル混合分布を使う "Multinormal" 多変量正規(ガウス)分布を使う - 次は,TrainingProgressReportingの使用可能な設定である.
-
"Panel" 動的に更新されるグラフィカルなパネルを表示する "Print" Printを使って定期的に情報を報告する "ProgressIndicator" 単純なProgressIndicatorを表示する "SimplePanel" 学習曲線なしでパネルを動的に更新する None 情報は何も報告しない - 次は,RandomSeedingの可能な設定である.
-
Automatic 関数が呼び出されるたびに自動的にシードを再設定する Inherited 外部でシードされた乱数を使う seed 明示的な整数または文字列をシードとして使う - オプションFeatureExtractorでは,可逆の特徴抽出器のみが与えられる.
- LearnDistribution[…,FeatureExtractor"Minimal"]は,内部的な前処理ができるだけ簡単に行われるべきであることを示す.
- 画像はすべて,まず,ConformImagesを使って調整される.
- Information[LearnedDistribution[…]]は,分布とその推定パフォーマンスについての情報パネルを生成する.
例題
すべて開く すべて閉じる例 (3)
ld = LearnDistribution[{1.2, 2.5, 3.2, 4.6}]RandomVariate[ld]PDF[ld, 3.4]ld = LearnDistribution[{"A", "A", "B", "B", "B"}]RandomVariate[ld]PDF[ld, {"A", "B"}]ld = LearnDistribution[{{1.1, 1.4}, {2.3, 3.1}, {4.4, 5.4}, {8.7, 7.5}}]RandomVariate[ld]PDF[ld, {{4.2, 5.3}, {4.2, 8.4}}]SynthesizeMissingValues[ld, {4.2, Missing[]}]スコープ (3)
ld = LearnDistribution[{{1.1, "A"}, {2.3, "A"}, {4.4, "B"}, {8.7, "B"}}]RandomVariate[ld]SynthesizeMissingValues[ld, {Missing[], "A"}]ld = LearnDistribution[{RGBColor[0.5172966964096541, 0.4435322033449375, 1.], RGBColor[0.3984626930847484, 0.5592892024442906, 1.], RGBColor[0.6149389612362844, 0.5648721294502163, 1.], RGBColor[0.4129156497559272, 0.9146065592632544, 1.], RGBColor[0.7907065846445507, 0.41054133291260947, 1.], RGBColor[0.4878854162550912, 0.9281119680196579, 1.], RGBColor[0.9884362181280959, 0.49025178842859785, 1.], RGBColor[0.633242503827218, 0.9880985331612835, 1.], RGBColor[0.9215182482568276, 0.8103084921468551, 1.], RGBColor[0.667469513641223, 0.46420827644204676, 1.]}]RandomVariate[ld, 100]PDF[ld, {RGBColor[1, 0, 0], RGBColor[0, 0, 1], RGBColor[0, 1, 0]}]ld = LearnDistribution[{DateObject[{2018, 7, 28, 12}, "Hour", "Gregorian", -7.], DateObject[{2018, 8, 16, 18, 19, 13.906976}, "Instant", "Gregorian", -7.], DateObject[{2018, 7, 30, 20, 15, 22.188818}, "Instant", "Gregorian", -7.], DateObject[{2018, 8, 13, 11, 22, 17.611770}, "Instant", "Gregorian", -7.], DateObject[{2018, 8, 10, 8, 37, 27.063134}, "Instant", "Gregorian", -7.], DateObject[{2018, 8, 5, 15, 17, 54.472131}, "Instant", "Gregorian", -7.]}]RandomVariate[ld, 10]PDF[ld, {DateObject[{2018, 9, 26, 18, 24, 47.352225}, "Instant", "Gregorian", -7.], DateObject[{2018, 8, 15}, "Day", "Gregorian", -7.], DateObject[{1989, 5, 30}, "Day", "Gregorian", -7.]}]オプション (6)
FeatureTypes (1)
Method (2)
"Multinormal"分布を数値データで訓練する:
ld = LearnDistribution[{1.2, 2.1, 3.5, 4.3}, Method -> "Multinormal"]Show[Plot[PDF[ld, x], {x, -2, 8}, Filling -> Bottom], NumberLinePlot[{1.2, 2.1, 3.5, 4.3}, Spacings -> 0, PlotStyle -> Red]]使用可能なあらゆるメソッド("Multinormal","ContingencyTable","KernelDensityEstimation","DecisionTree" "GaussianMixture")を使って,二次元データ集合について分布を訓練する:
iris = ExampleData[{"MachineLearning", "FisherIris"}, "Data"][[All, 1, {1, 3}]];methods = {"Multinormal", "GaussianMixture", "KernelDensityEstimation", "ContingencyTable", "DecisionTree"};distributions = LearnDistribution[iris, Method -> #]& /@ methods;MapThread[Show[ContourPlot[PDF[#2, {x, y}], {x, 4, 8}, {y, 1, 7}, PlotRange -> All, Contours -> 10], ListPlot[iris, PlotStyle -> Directive[Red, PointSize[.02]]], PlotLabel -> #1, ImageSize -> 150] &, {methods, distributions}]TimeGoal (2)
ld = LearnDistribution[{1, 2, 3, 4}, TimeGoal -> 5]Information[ld, "TrainingTime"]digits = ResourceData["MNIST"][[ ;; 1000, 1]];RandomSample[digits, 10]ld1 = LearnDistribution[digits, TimeGoal -> 3]Information[ld1]ld2 = LearnDistribution[digits, TimeGoal -> 30]取得された損失値(交差エントロピー)は約-0.978である:
Information[ld2]Information[#, "LearningCurve"] & /@ {ld1, ld2}TrainingProgressReporting (1)
dataset = ExampleData[{"MachineLearning", "UCILetter"}, "Data"][[All, 1]];LearnDistribution[dataset, TrainingProgressReporting -> "Panel"];[image]LearnDistribution[dataset, TrainingProgressReporting -> "SimplePanel"];[image]LearnDistribution[dataset, TrainingProgressReporting -> "Print"];LearnDistribution[dataset, TrainingProgressReporting -> "ProgressIndicator"];[image]LearnDistribution[dataset, TrainingProgressReporting -> None];アプリケーション (4)
cifar = ResourceData["CIFAR-100"][[All, 1]];RandomSample[cifar, 10]ld = LearnDistribution[cifar]RandomVariate[ld, 50]訓練集合の画像,検定集合の画像,学習した分布からのサンプル,別のデータ集合の画像,ランダムな画像の確率密度を比較する:
testimages = {[image], [image], [image], [image], [image]};Grid[{#, PDF[ld, #]} & /@ testimages]これらの各画像についてより低いPDFでサンプルを生成する確率を得る:
Grid[{#, RarerProbability[ld, #]} & /@ testimages]irises = ResourceData["Sample Tabular Data: Fisher Iris"]Tabularオブジェクトから直接得た分布を訓練する:
ld = LearnDistribution[irises]RandomVariate[ld]RandomVariate[ld, 4]分布からの変数"PetalLength"と"SepalLength"のランダムなサンプルを可視化し,それらをデータ集合と比較する:
Show[
ListPlot[RandomVariate[ld, 100] -> {"PetalLength", "SepalLength"}, AxesLabel -> Automatic],
ListPlot[irises -> {"PetalLength", "SepalLength"}, PlotStyle -> Red]
]titanic = ResourceData["Sample Data: Titanic Survival"]ld = LearnDistribution[titanic]この分布とSynthesizeMissingValuesを使って,不完全な例から完全な例を生成する:
SynthesizeMissingValues[ld, <|"Class" -> "1st"|>]SynthesizeMissingValues[ld, <|"Class" -> "1st", "Sex" -> "female"|>]p = PDF[ld, <|"Class" -> "1st", "Sex" -> "female", "Age" -> Quantity[20, "Years"], "SurvivalStatus" -> #|>] & /@ {"survived", "died"};
First[p / Total[p]]p = PDF[ld, <|"Class" -> "3rd", "Sex" -> "name", "Age" -> Quantity[40, "Years"], "SurvivalStatus" -> #|>] & /@ {"survived", "died"};
First[p / Total[p]]iris = ExampleData[{"MachineLearning", "FisherIris"}, "Data"][[All, 1, {1, 3}]];ld = LearnDistribution[iris]Show[ContourPlot[PDF[ld, {x, y}], {x, 4, 8}, {y, 1, 7}, PlotRange -> All, Contours -> 10], ListPlot[iris, PlotStyle -> Red]]SynthesizeMissingValuesを使い,訓練済みの分布を使って欠落値を補完する:
SynthesizeMissingValues[ld, {5.5, Missing[]}]Histogram[Table[Last@SynthesizeMissingValues[ld, {5.5, Missing[]}], 2000], 50]関連するガイド
-
▪
- 教師なし機械学習 ▪
- 科学的データ解析 ▪
- 機械学習法 ▪
- ノンパラメトリック統計分布
テキスト
Wolfram Research (2019), LearnDistribution, Wolfram言語関数, https://reference.wolfram.com/language/ref/LearnDistribution.html (2025年に更新).
CMS
Wolfram Language. 2019. "LearnDistribution." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/LearnDistribution.html.
APA
Wolfram Language. (2019). LearnDistribution. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LearnDistribution.html
BibTeX
@misc{reference.wolfram_2026_learndistribution, author="Wolfram Research", title="{LearnDistribution}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/LearnDistribution.html}", note=[Accessed: 02-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_learndistribution, organization={Wolfram Research}, title={LearnDistribution}, year={2025}, url={https://reference.wolfram.com/language/ref/LearnDistribution.html}, note=[Accessed: 02-November-2026]}