Why do we need the Ho-Kashyap algorithm?
Despite the boom in neural networks in machine learning, linear classification algorithms remain much simpler to use and interpret. But at the same time, sometimes I don’t feel like using any advanced methods, such as the support vector method or logistic regression, and there is a temptation to drive all the data into one large linear MNC regression, moreover, even MS Excel is able to build it perfectly.
The problem with this approach is that even if the input data is linearly separable, the resulting classifier may not separate them. For example, for a set of points

The question arises - is it possible to somehow get rid of this feature of behavior?
Linear classification problem
First, we formalize the subject of the article.
A matrix is given
>>> import numpy as np
>>> X = np.array([[6, 9, 1], [5, 7, 1], [5, 9, 1], [0, 10, 1]])
>>> y = np.array([[1], [1], [-1], [-1]])
The easiest way to do this is to construct an OLS regression for
>>> w = np.dot(np.linalg.pinv(X), y)
>>> w
array([[ 0.15328467],
[-0.4379562 ],
[ 3.2189781 ]])
>>> np.dot(X, w)
array([[ 0.19708029],
[ 0.91970803],
[ 0.04379562],
[-1.16058394]])
Linear separability
For the convenience of writing, we multiply each line of inequality
>>> Y = y * X
>>> Y
array([[ 6, 9, 1],
[ 5, 7, 1],
[ -5, -9, -1],
[ 0, -10, -1]])
At this point, we can recall that the condition for separating classes is
We introduce a vector
>>> b = np.ones([4, 1])
>>> b[3] = 10
>>> w = np.dot(np.linalg.pinv(Y), b)
>>> np.dot(Y, w)
array([[ 0.8540146 ],
[ 0.98540146],
[ 0.81021898],
[ 10.02919708]])
Ho Kashyap Algorithm
The Ho-Kashyap algorithm is designed to be
- Calculate the OLS regression coefficients (
).
- Calculate the indentation vector
.
- If the solution does not fit (
), then repeat step 1.
I want to calculate the indent vector in some way, sort of
>>> e = -np.inf * np.ones([4, 1])
>>> b = np.ones([4, 1])
>>> while np.any(e < 0):
... w = np.dot(np.linalg.pinv(Y), b)
... e = b - np.dot(Y, w)
... b = b - e * (e < 0)
...
>>> b
array([[ 1.],
[ 1.],
[ 1.],
[ 12.]])
>>> w
array([[ 2.],
[-1.],
[-2.]])

In the case of a linearly separable sample, the algorithm always converges and converges to the separating plane (if all elements of the gradient are
If linearly inseparable sample loss function can be arbitrarily small, since it is sufficient to multiply
Connection of the Ho-Kashyap algorithm and linear SVM
You may notice that if the object is classified correctly, then the error in the posed optimization problem (
In turn, the linear SVM loss function has the form:
Thus, the problem solved by the Ho-Kashyap algorithm is an analogue of SVM with a quadratic loss function (it fines heavier for emissions far from the separating plane) and ignoring the width of the separating strip (i.e., looking for a non-plane located as far as possible from the nearest correctly classified elements, but any dividing plane).
Multidimensional case
We may recall that MNC regression is an analogue of Fisher's two-class linear discriminant (their solutions coincide up to a constant). The Ho-Kashpyap algorithm can also be applied to the case of
Acknowledgments
parpalak for a convenient editor.
rocket3 for the original article.
References
(1) http://www.csd.uwo.ca/~olga/Courses/CS434a_541a/Lecture10.pdf
(2) http://research.cs.tamu.edu/prism/lectures/pr/pr_l17.pdf
( 3) http://web.khu.ac.kr/~tskim/PatternClass Lec Note 07-1.pdf
(4) A.E. Lepsky, A.G. Bronevich Mathematical methods for pattern recognition. Lecture Course
(5) Tu J., González R. Principles of Pattern Recognition
(6) R. Duda, P. Hart Pattern Recognition and Scene Analysis