Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quantization error formula #111

Open
FlorentF9 opened this issue Oct 5, 2019 · 0 comments
Open

Quantization error formula #111

FlorentF9 opened this issue Oct 5, 2019 · 0 comments

Comments

@FlorentF9
Copy link

I see in the code that quantization error is defined using a L1 norm (mean absolute error), and not a euclidean distance :

def calculate_quantization_error(self):
        neuron_values = self.codebook.matrix[self.find_bmu(self._data)[0].astype(int)]
        quantization_error = np.mean(np.abs(neuron_values - self._data))
        return quantization_error

Traditionally, quantization error is defined by the mean euclidean distance between samples and BMUs (see papers or other SOM libraries such as Matlab SOM-Toolbox). Shouldn't it be:

def calculate_quantization_error(self):
        neuron_values = self.codebook.matrix[self.find_bmu(self._data)[0].astype(int)]
        quantization_error = np.mean(np.sqrt(np.sum(np.square(neuron_values - self._data), axis=1)))
        return quantization_error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant