提交 778cda7a 编写于 作者: T Till Rohrmann

[ml] [docs] Adds distance formulas to documentation. Automatically include...

[ml] [docs] Adds distance formulas to documentation. Automatically include latex_commands.html with mathjax markdown files.
上级 ce2163e6
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
$$
\newcommand{\R}{\mathbb{R}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\x}{\mathbf{x}}
\newcommand{\y}{\mathbf{y}}
\newcommand{\wv}{\mathbf{w}}
\newcommand{\av}{\mathbf{\alpha}}
\newcommand{\bv}{\mathbf{b}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\id}{\mathbf{I}}
\newcommand{\ind}{\mathbf{1}}
\newcommand{\0}{\mathbf{0}}
\newcommand{\unit}{\mathbf{e}}
\newcommand{\one}{\mathbf{1}}
\newcommand{\zero}{\mathbf{0}}
\newcommand\rfrac[2]{^{#1}\!/_{#2}}
$$
\ No newline at end of file
......@@ -51,6 +51,10 @@ under the License.
{% comment %} Includes are found in the _includes directory. {% endcomment %}
{% include navbar.html %}
{% if page.mathjax %}
{% include latex_commands.html %}
{% endif %}
<!-- Main content. -->
<div class="container">
{% comment %}
......
---
mathjax: include
title: Distance Metrics
---
<!--
......@@ -31,13 +32,62 @@ use other distance metric by implementing `DistanceMetric` trait.
## Built-in Implementations
* Euclidean Distance
* Squared Euclidean Distance
* Cosine Distance
* Tanimoto Distance
* Chebyshev Distance
* Manhattan Distance
* Minkowski Distance
Currently, FlinkML supports the following metrics:
<table class="table table-bordered">
<thead>
<tr>
<th class="text-left" style="width: 20%">Metric</th>
<th class="text-center">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Euclidean Distance</strong></td>
<td>
$$d(\x, \y) = \sqrt{\sum_{i=1}^n \left(x_i - y_i \right)^2}$$
</td>
</tr>
<tr>
<td><strong>Squared Euclidean Distance</strong></td>
<td>
$$d(\x, \y) = \sum_{i=1}^n \left(x_i - y_i \right)^2$$
</td>
</tr>
<tr>
<td><strong>Cosine Similarity</strong></td>
<td>
$$d(\x, \y) = 1 - \frac{\x^T \y}{\Vert \x \Vert \Vert \y \Vert}$$
</td>
</tr>
<tr>
<td><strong>Chebyshev Distance</strong></td>
<td>
$$d(\x, \y) = \max_{i}\left(\left \vert x_i - y_i \right\vert \right)$$
</td>
</tr>
<tr>
<td><strong>Manhattan Distance</strong></td>
<td>
$$d(\x, \y) = \sum_{i=1}^n \left\vert x_i - y_i \right\vert$$
</td>
</tr>
<tr>
<td><strong>Minkowski Distance</strong></td>
<td>
$$d(\x, \y) = \left( \sum_{i=1}^{n} \left( x_i - y_i \right)^p \right)^{\rfrac{1}{p}}$$
</td>
</tr>
<tr>
<td><strong>Tanimoto Distance</strong></td>
<td>
$$d(\x, \y) = 1 - \frac{\x^T\y}{\Vert \x \Vert^2 + \Vert \y \Vert^2 - \x^T\y}$$
with $\x$ and $\y$ being bit-vectors
</td>
</tr>
</tbody>
</table>
## Custom Implementation
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册