Skip to main content

Posts

[LeetCode Solution 39]: Combination Sum

[LeetCode Solution 39]:  Combination Sum ********************************************************************************* Question: Given a  set  of candidate numbers ( C )  (without duplicates)  and a target number ( T ), find all unique combinations in  C  where the candidate numbers sum to  T . The  same  repeated number may be chosen from  C  unlimited number of times. Note: All numbers (including the target) will be positive integers. The solution set must not contain duplicate combinations. For example, given candidate set  [2, 3, 6, 7]  and target, 7 A solution set is:  [ [7], [2, 2, 3] ] -------------------------------------------------------------------------------------------------- Approach Recursive Method Intuition Most problems like this, which requires the return of all the required solutions, can be solved by recursive and the thinking part is similar. if you carefully study these topics are found in a routine, are required to

[Machine Learning]: #3 Parameter Learning

[Machine Learning]: Parameter Learning The problem is how to solve the math model I post in Bolg  [Machine Learning] Model and Cost Function . ------------------------------- Question and Math Model:          Hypothesis:                               \({H_\theta }(x) = {\theta _0} + {\theta _1}x\)          Parameters:                               \({\theta _0}, {\theta _1}\)          Cost Function:                          \(J({\theta _0},{\theta _1}) = {1 \over {2m}}\sum\nolimits_{i = 1}^m {{{(\hat y_i^{} - {y_i})}^2}}  = {1 \over {2m}}\sum\nolimits_{i = 1}^m {{{({H_\theta }({x_i}) - {y_i})}^2}} \)          Goal: minimize:                         \(J({\theta _0},{\theta _1})\) ------------------------------- In this Bolg, we are going to give a general method to solve this question. 1. Gradient Descent The \(z\) axis is the value of the cost function. and  \({\theta _0}\) and   \({\theta _1}\)   is the \(x\) axis and \(y\) axis.  Our goal is to find the