Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Haleshot committed Aug 26, 2024
1 parent 1600131 commit 9c6521f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions easy/Linear_Kernel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ A kernel function in machine learning is used to measure the similarity between

The linear kernel between two vectors $\mathbf{x}_1$ and $\mathbf{x}_2$ is mathematically defined as:

$ K(\mathbf{x}_1, \mathbf{x}_2) = \mathbf{x}_1 \cdot \mathbf{x}_2 = \sum_{i=1}^{n} x_{1,i} \cdot x_{2,i} $
$$
K(\mathbf{x}_1, \mathbf{x}_2) = \mathbf{x}_1 \cdot \mathbf{x}_2 = \sum_{i=1}^{n} x_{1,i} \cdot x_{2,i}
$$

Where $n$ is the number of features, and $x_{1,i}$ and $x_{2,i}$ are the components of the vectors $\mathbf{x}_1$ and $\mathbf{x}_2$ respectively.

Expand Down Expand Up @@ -111,4 +113,5 @@ Both NumPy functions are more efficient and can handle multi-dimensional arrays,

The custom implementation and `np.dot()` work correctly for 1D arrays, which is sufficient for the given test cases. However, `np.inner()` is the most versatile approach, as it can handle both 1D and 2D arrays correctly. For a more robust solution that works with multidimensional inputs, `np.inner()` is recommended.

When dealing with 2D arrays or matrices, `np.inner()` computes the inner product of vectors for the last dimension of `x1` and `x2`. This makes it more flexible and suitable for a wider range of input types.
When dealing with 2D arrays or matrices, `np.inner()` computes the inner product of vectors for the last dimension of `x1` and `x2`. This makes it more flexible and suitable for a wider range of input types.

0 comments on commit 9c6521f

Please sign in to comment.