## Linear Regression with Multiple Variables

#### Multiple Features #### Gradient Descent for Multiple Variables #### Feature Scaling

We can speed up gradient descent by having each of our input values in roughly the same range.

• feature scaling: involves dividing the input values by the range of the input variable resulting in a new range of just 1.
• mean normalization: involves subtracting the average value for an input variable from the values for that input variable resulting in a new average value for the input variable of just zero. ui是平均值，si是最大-最小或者是标准差

#### Learning Rate

• Debugging gradient descent: Make a plot with number of iterations on the x-axis. Now plot the cost function, J(θ) over the number of iterations of gradient descent. If J(θ) ever increases, then you probably need to decrease α.
• Automatic convergence test: Declare convergence if J(θ) decreases by less than E in one iteration, where E is some small value such as 10−3. However in practice it's difficult to choose this threshold value. If α is too small: slow convergence.

If α is too large: ￼may not decrease on every iteration and thus may not converge.

#### Features and Polynomial Regression

We can change the behavior or curve of our hypothesis function by making it a quadratic, cubic or square root function (or any other form).

One important thing to keep in mind is, if you choose your features this way then feature scaling becomes very important.

#### Normal Equation if XtX is noninvertible, the common causes might be having :

• Redundant features, where two features are very closely related (i.e. they are linearly dependent)
• Too many features (e.g. m ≤ n). In this case, delete some features or use "regularization" (to be explained in a later lesson).
{"ft_lang_label":"__label__en","ft_lang_prob":0.8635782,"math_prob":0.96158797,"size":1608,"snap":"2020-34-2020-40","text_gpt3_token_len":355,"char_repetition_ratio":0.11533666,"word_repetition_ratio":0.015267176,"special_character_ratio":0.20273632,"punctuation_ratio":0.097972974,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.988127,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],"im_url_duplicate_count":[null,6,null,6,null,6,null,6,null,6,null,6,null,6,null,6,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-09-26T13:42:15Z\",\"WARC-Record-ID\":\"<urn:uuid:0fadc951-15f7-4e87-94e2-f59b3ea1e54e>\",\"Content-Length\":\"16048\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:239820a1-feb9-43ce-aae2-b036cd1240e2>\",\"WARC-Concurrent-To\":\"<urn:uuid:3677b984-3f41-4fd3-9ef7-bb6e09375522>\",\"WARC-IP-Address\":\"192.95.36.177\",\"WARC-Target-URI\":\"https://yyqing.me/post/2017/2017-08-02-machine-learning\",\"WARC-Payload-Digest\":\"sha1:2QM4M7VJC3CEMRXEGV377JZFUFJFVQLE\",\"WARC-Block-Digest\":\"sha1:2GPAQ2UKZH5CBT5MMJD74BX7MJLUSKYU\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-40/CC-MAIN-2020-40_segments_1600400244231.61_warc_CC-MAIN-20200926134026-20200926164026-00077.warc.gz\"}"}