Machine Learning-week 3

?Question 1

Suppose that you have trained a logistic regression classifier, and it outputs on a new examplex a prediction hθ(x) = 0.7. This means (check all that apply):

Our estimate forP(y=1|x;θ) is 0.7.

Our estimate forP(y=0|x;θ) is 0.3.

Our estimate forP(y=1|x;θ) is 0.3.

Our estimate forP(y=0|x;θ) is 0.7.

Solution

Our estimate for P(y=1|x;θ) is 0.7. T hθ(x)is preciselyP(y=1|x;θ) , so each is 0.7. Our estimate for P(y=0|x;θ) is 0.3. T Since we must have P(y=0|x;θ) = 1?P(y=1|x;θ) , the former is 1?0.7=0.3 . Our estimate for P(y=1|x;θ) is 0.3. F hθ(x) gives P(y=1|x;θ) , not 1?P(y=1|x;θ) . Our estimate for P(y=0|x;θ) is 0.7. F hθ(x) is P(y=1|x;θ) , not P(y=0|x;θ)

Question2?

Which of the following are true? Check all that apply.

1.? J(θ) will be a convex function, so gradient descent should converge to the global minimum.

2. CORRECT Adding polynomial features (e.g., instead using hθ(x)=g(θ0+θ1x1+θ2x2+θ3x21+θ4x1x2+θ5x22) ) could increase how well we can fit the training data.

3. The positive and negative examples cannot be separated using a straight line. So, gradient descent will fail to converge.

4. WRONG Because the positive and negative examples cannot be separated using a straight line, linear regression will perform as well as logistic regression on this data.

1,4 not correct


Question 3

For logistic regression, the gradient is given by ??θjJ(θ)=1m∑mi=1(hθ(x(i))?y(i))x(i)j. Which of these is a correct gradient descent update for logistic regression with a learning rate of α? Check all that apply.

θ:=θ?α1m∑mi=1(θTx?y(i))x(i).

CORRECT θj:=θj?α1m∑mi=1(hθ(x(i))?y(i))x(i)j (simultaneously update for all j).

θj:=θj?α1m∑mi=1(hθ(x(i))?y(i))x(i) (simultaneously update for all j).

CORRECT θj:=θj?α1m∑mi=1(11+e?θTx(i)?y(i))x(i)j (simultaneously update for all j).

Suppose you have the following training set, and fit a logistic regression classifier hθ(x)=g(θ0+θ1x1+θ2x2) .

4.

Which of the following statements are true? Check all that apply.

CORRECT The sigmoid function g(z)=11+e?z is never greater than one (>1).

CORRECT The cost function J(θ) for logistic regression trained with m≥1 examples is always greater than or equal to zero.

For logistic regression, sometimes gradient descent will converge to a local minimum (and fail to find the global minimum). This is the reason we prefer more advanced optimization algorithms such as fminunc (conjugate gradient/BFGS/L-BFGS/etc).

WRONG Linear regression always works well for classification if you classify by using a threshold on the prediction made by linear regression.

%-----------------------%

CORRECT The one-vs-all technique allows you to use logistic regression for problems in which each y(i) comes from a fixed, discrete set of values.

For logistic regression, sometimes gradient descent will converge to a local minimum (and fail to find the global minimum). This is the reason we prefer more advanced optimization algorithms such as fminunc (conjugate gradient/BFGS/L-BFGS/etc).

CORRECT The cost function J(θ) for logistic regression trained with m≥1 examples is always greater than or equal to zero.

Since we train one classifier when there are two classes, we train two classifiers when there are three classes (and we do one-vs-all classification).

%===================================================%

5.

Suppose you train a logistic classifier hθ(x)=g(θ0+θ1x1+θ2x2). Suppose θ0=?6,θ1=1,θ2=0. Which of the following figures represents the decision boundary found by your classifier?

WRONG% 1 | 0 vertical

Figure:

right

% 0 | 1 vertical

Figure:

% 0 | 1 horizontal

Figure:

% 1 | 0 horizontal

Figure

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
  • 序言:七十年代末玖绿,一起剝皮案震驚了整個濱河市唯灵,隨后出現的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖虚汛,帶你破解...
    沈念sama閱讀 216,496評論 6 501
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現場離奇詭異,居然都是意外死亡贤壁,警方通過查閱死者的電腦和手機蜘矢,發(fā)現死者居然都...
    沈念sama閱讀 92,407評論 3 392
  • 文/潘曉璐 我一進店門狂男,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人品腹,你說我怎么就攤上這事岖食。” “怎么了舞吭?”我有些...
    開封第一講書人閱讀 162,632評論 0 353
  • 文/不壞的土叔 我叫張陵泡垃,是天一觀的道長。 經常有香客問我镣典,道長兔毙,這世上最難降的妖魔是什么唾琼? 我笑而不...
    開封第一講書人閱讀 58,180評論 1 292
  • 正文 為了忘掉前任兄春,我火速辦了婚禮,結果婚禮上锡溯,老公的妹妹穿的比我還像新娘赶舆。我一直安慰自己,他們只是感情好祭饭,可當我...
    茶點故事閱讀 67,198評論 6 388
  • 文/花漫 我一把揭開白布芜茵。 她就那樣靜靜地躺著,像睡著了一般倡蝙。 火紅的嫁衣襯著肌膚如雪九串。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,165評論 1 299
  • 那天寺鸥,我揣著相機與錄音猪钮,去河邊找鬼。 笑死胆建,一個胖子當著我的面吹牛烤低,可吹牛的內容都是我干的。 我是一名探鬼主播笆载,決...
    沈念sama閱讀 40,052評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼扑馁,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了凉驻?” 一聲冷哼從身側響起腻要,我...
    開封第一講書人閱讀 38,910評論 0 274
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎涝登,沒想到半個月后雄家,有當地人在樹林里發(fā)現了一具尸體,經...
    沈念sama閱讀 45,324評論 1 310
  • 正文 獨居荒郊野嶺守林人離奇死亡缀拭,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 37,542評論 2 332
  • 正文 我和宋清朗相戀三年咳短,在試婚紗的時候發(fā)現自己被綠了填帽。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,711評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡咙好,死狀恐怖篡腌,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情勾效,我是刑警寧澤嘹悼,帶...
    沈念sama閱讀 35,424評論 5 343
  • 正文 年R本政府宣布,位于F島的核電站层宫,受9級特大地震影響杨伙,放射性物質發(fā)生泄漏。R本人自食惡果不足惜萌腿,卻給世界環(huán)境...
    茶點故事閱讀 41,017評論 3 326
  • 文/蒙蒙 一限匣、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧毁菱,春花似錦米死、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,668評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至窗慎,卻和暖如春物喷,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背遮斥。 一陣腳步聲響...
    開封第一講書人閱讀 32,823評論 1 269
  • 我被黑心中介騙來泰國打工峦失, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人伏伐。 一個月前我還...
    沈念sama閱讀 47,722評論 2 368
  • 正文 我出身青樓宠进,卻偏偏與公主長得像,于是被迫代替她去往敵國和親藐翎。 傳聞我的和親對象是個殘疾皇子材蹬,可洞房花燭夜當晚...
    茶點故事閱讀 44,611評論 2 353

推薦閱讀更多精彩內容

  • 沒有理性的人生,只有理性的片刻吝镣,雖保持理性堤器,那是因為誘惑還沒達到,在高于預期的利益誘惑面前末贾,人都是感性的闸溃,都會不堪...
    諫追閱讀 236評論 0 0
  • Elasticsearch 單機多節(jié)點 下載Elasticsearch安裝包(本文實驗環(huán)境版本為5.5.1) 將安...
    程序員七哥閱讀 3,220評論 0 7
  • 1Q84如果讓杜拉斯來寫,大概200多頁就能說完整個故事了。 第一部的前兩章就有種棄書的念頭辉川,拖沓表蝙,無比拖沓冗長的...
    貓須Alice閱讀 1,220評論 0 3
  • 智能手機府蛇,WiFI、4G網絡遍布屿愚,攝像頭無處不在汇跨,各種設備都帶著智能系統(tǒng)。年終妆距、每月穷遂、每周每天告訴你吃、穿娱据、用蚪黑、玩...
    挖泥巴閱讀 1,597評論 0 51