Last updated on Oct. 12, 2021, 7:23 a.m.
Step 1: Initialize the basic class functions including initialization of regularization parameter C
and number of iterations.
Step 2: Implement the Objective function i.e; Hinge Loss Function.
Step 3: After implementing the Hinge Loss Objective function, we will implement the Subgradient calculation function. Now as we know the Hinge loss function is not differentiable, but it is convex.
Step 4: Now we can implement the fit function, which will take in input X
and y
and learn the w
and b
parameters using objective function and Subgradient descent algorithm.
Step 5: Lastly, we can implement the predict function.