計算統計學 (程式實作) -- 機率模型

機率統計

教學錄影

數學符號

數學基礎

排列組合

機率統計簡介

機率

機率公理

隨機變數

連續測度

單一分布

條件機率

聯合分布

貝氏定理

動差生成函數

特徵函數

機率法則匯總

離散分布

二項分布

多項分布

負二項分布

幾何分布

超幾何分布

布瓦松分布

連續分布

均勻分布

常態分布

Gamma 分布

指數分布

卡方分布

柯西分布

Weibull 分布

T 分布

F 分布

Beta 分布

多維分布

統計

抽樣

敘述統計

推論統計

中央極限定理

估計方法

單組樣本估計

兩組樣本估計

檢定方法

單組樣本檢定

兩組樣本檢定

平均値的推論

變異數的推論

無母數推論

迴歸分析

變異數分析

實驗設計

因子實驗

品質管制

時間序列

數據分類

統計定理匯總

統計情況分類

計算統計

蒙地卡羅法

最大似然法則

假說與學習

EM 算法

簡單貝氏分類

貝氏網路

隨機過程

馬可夫鏈

蒙地卡羅馬可夫

資源

範例

投影片

教學錄影

練習題

考題解答

訊息

相關網站

參考文獻

最新修改

簡體版

English

[フレーム]

統計 (Statistics) 物件

統計物件根據樣本的統計值,計算每個樣本的出現機率。

程式實作

 public class Statistics : ProbDistribution
 {
 public Bag bag = new Bag();
 public int total = 0;
 public virtual double p(String exp)
 {
 return (double)bag[exp] / total;
 }
 public Statistics addSample(String sample, String spliter)
 {
 sample = PR.normalize(sample);
 bag.add(sample, 1);
 foreach (String v in sample.split(spliter))
 bag.add(v, 1);
 total++;
 return this;
 }
 public Statistics addSampleList(SampleList list, String spliter)
 {
 foreach (var sample in list) 
 addSample(sample, spliter);
 return this;
 }
 public override String ToString()
 {
 var rzStr = new StringBuilder();
 foreach (var pair in bag.sort()) 
 {
 String s = pair.Key as String;
 rzStr.Append(String.Format("{0:F4}:{1}\n", this.p(s), s));
 }
 return rzStr.ToString();
 }
 }

機率表

機率表根據預設的機率值,直接透過查詢的方法,查詢樣本的出現機率。

程式實作

 public class ProbMap : Map<Object, double>, ProbDistribution
 {
 public ProbMap() {}
 public virtual double p(String exp) { return this[PR.normalize(exp)]; }
 public virtual ProbMap p(String exp, double value) { 
 this[PR.normalize(exp)] = value; return this; 
 }
 public virtual ProbMap d(params object[] args)
 {
 double psum = 0.0;
 for (int i = 0; i < args.Length; i += 2)
 {
 String exp = (String) args[i];
 double pi;
 if (i == args.Length - 1)
 pi = 1.0 - psum;
 else
 pi = (double)args[i + 1];
 p(exp, pi);
 psum += pi;
 }
 Trace.Assert(psum < 1.00001);
 return this;
 }
 public virtual ProbMap normalize()
 {
 double psum = this.Sum(pair => pair.Value);
 var keys = this.Keys.ToList();
 foreach (var o in keys)
 this[o] = this[o] / psum;
 return this;
 }
 public void log()
 {
 foreach (var pair in this)
 {
 Log.log("{0:F4}:{1}", pair.Value, pair.Key);
 }
 }
 }

機率模型

機率模型會利用基本的機率分布,推斷聯合機率分布 (或運算式) 的機率

 public class ProbModel : ProbDistribution
 {
 public ProbDistribution d = null;
 public virtual double p(String exp) 
 {
 exp = PR.normalize(exp);
 if (exp == "") return 1.0;
 return d.p(exp);
 }
 }

機率問題

一個機率問題經由測試可以觀察並驗證我們的模型有多接近真實的機率源模型,如此就可以檢驗機率模型預測的正確性。

程式實作

 public class ProbProblem : ProbMap, RandomSource
 {
 public virtual String generate() { return ""; }
 public virtual void test(ProbModel model, String expList)
 {
 model.d = this;
 PR.dump(expList, model);
 }
 }

Facebook

[フレーム]

Facebook

[フレーム]

Wikidot

Post preview:

(will not be published)


本網頁的作者、授權與引用方式

作者
陳鍾誠,於金門大學資訊工程系,電子郵件:wt.ude.uqn|ccc#wt.ude.uqn|ccc,網站:http://ccckmit.wikidot.com
授權
本文採用創作共用 (Creative Common) 3.0 版的 姓名標示─非商業性─相同方式分享 授權條款,歡迎轉載或修改使用,但若做為商業使用時必須取得授權,引用本文時請參考下列格式。
中文版 (APA格式)
陳鍾誠 (06 Oct 2010 10:46),(網頁標題) 計算統計學 (程式實作) — 機率模型,(網站標題) 陳鍾誠的網站,取自 http://ccckmit.wikidot.com/st:probcode ,網頁修改第 0 版。
英文版 (APA格式)
Chung-Chen Chen (06 Oct 2010 10:46), Retrieved from http://ccckmit.wikidot.com/st:probcode , Page Revision 0.
page revision: 0, last edited: 06 Oct 2010 10:46
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
Click here to edit contents of this page.
Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.
Append content without editing the whole page source.
Check out how this page has evolved in the past.
If you want to discuss contents of this page - this is the easiest way to do it.
View and manage file attachments for this page.
A few useful tools to manage this Site.
Change the name (also URL address, possibly the category) of the page.
View wiki source for this page without editing.
View/set parent page (used for creating breadcrumbs and structured layout).
Notify administrators if there is objectionable content in this page.
Something does not work as expected? Find out what you can do.
General Wikidot.com documentation and help section.
Wikidot.com Terms of Service - what you can, what you should not etc.
Wikidot.com Privacy Policy.

AltStyle によって変換されたページ (->オリジナル) /