Skip to content
Snippets Groups Projects
Commit b5fbad1e authored by Fabien  MAREUIL's avatar Fabien MAREUIL
Browse files

add factor normalization

parent 24e91a89
No related branches found
No related tags found
1 merge request!29Prepare for v1.1.0
Pipeline #47628 passed
# Generated by Django 2.2.1 on 2021-02-10 13:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ippidb', '0066_merge_20210128_0926'),
]
operations = [
migrations.AddField(
model_name='metainformation',
name='normalize_factor',
field=models.DecimalField(blank=True, decimal_places=8, default=4.5859973, max_digits=11, null=True, verbose_name='Normalize Factor'),
),
]
...@@ -426,6 +426,14 @@ class MetaInformation(models.Model): ...@@ -426,6 +426,14 @@ class MetaInformation(models.Model):
minimum = models.DecimalField( minimum = models.DecimalField(
verbose_name="Minimum", max_digits=11, decimal_places=8 verbose_name="Minimum", max_digits=11, decimal_places=8
) )
normalize_factor = models.DecimalField(
blank=True,
null=True,
default=4.58599730,
verbose_name="Normalize Factor",
max_digits=11,
decimal_places=8,
)
class Meta: class Meta:
verbose_name_plural = "MetaInformation" verbose_name_plural = "MetaInformation"
......
...@@ -262,10 +262,10 @@ def get_zscore_threshold(avg_std): ...@@ -262,10 +262,10 @@ def get_zscore_threshold(avg_std):
@register.filter @register.filter
def get_zscore(distance, avg_std): def get_zscore(distance, avg_std):
std = float(avg_std.std) factor = float(avg_std.normalize_factor)
# mean = float(avg_std.average) # mean = float(avg_std.average)
dist = float(distance) dist = float(distance)
score = np.exp(-((dist ** 2) / (2 * (std ** 2)))) score = np.exp(-((dist ** 2) / (2 * (factor ** 2))))
return score return score
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment