From 604fd7533d36322d310d560b9de46d215046ecd0 Mon Sep 17 00:00:00 2001 From: Amir MOHAMMADI <amir.mohammadi@idiap.ch> Date: Mon, 4 Apr 2022 14:46:54 +0200 Subject: [PATCH] [pre-commit] autoupdate --- .pre-commit-config.yaml | 6 +++--- bob/learn/em/gmm.py | 11 ++++------- bob/learn/em/kmeans.py | 2 +- doc/conf.py | 10 +++++----- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1515754..1daa230 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,12 +2,12 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/timothycrosley/isort - rev: 5.9.3 + rev: 5.10.1 hooks: - id: isort args: [--settings-path, "pyproject.toml"] - repo: https://github.com/psf/black - rev: 21.7b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 @@ -15,7 +15,7 @@ repos: hooks: - id: flake8 - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.1.0 hooks: - id: check-ast - id: check-case-conflict diff --git a/bob/learn/em/gmm.py b/bob/learn/em/gmm.py index 07c807e..2d5b0b9 100644 --- a/bob/learn/em/gmm.py +++ b/bob/learn/em/gmm.py @@ -962,13 +962,10 @@ def map_gmm_m_step( # n_threshold[statistics.n > mean_var_update_threshold] = statistics.n[ # statistics.n > mean_var_update_threshold # ] - new_means = ( - np.multiply( - alpha[:, None], - (statistics.sum_px / n_threshold[:, None]), - ) - + np.multiply((1 - alpha[:, None]), machine.ubm.means) - ) + new_means = np.multiply( + alpha[:, None], + (statistics.sum_px / n_threshold[:, None]), + ) + np.multiply((1 - alpha[:, None]), machine.ubm.means) machine.means = np.where( statistics.n[:, None] < mean_var_update_threshold, machine.ubm.means, diff --git a/bob/learn/em/kmeans.py b/bob/learn/em/kmeans.py index c1b7153..8a17af3 100644 --- a/bob/learn/em/kmeans.py +++ b/bob/learn/em/kmeans.py @@ -166,7 +166,7 @@ def reduce_indices_means_vars(stats): weights_count = np.bincount(closest_centroid_indices, minlength=n_clusters) weights = weights_count / weights_count.sum() means = means_sum / weights_count[:, None] - variances = (variances_sum / weights_count[:, None]) - (means ** 2) + variances = (variances_sum / weights_count[:, None]) - (means**2) return variances, weights diff --git a/doc/conf.py b/doc/conf.py index dd19c99..5996403 100755 --- a/doc/conf.py +++ b/doc/conf.py @@ -73,10 +73,10 @@ source_suffix = ".rst" master_doc = "index" # General information about the project. -project = u"bob.learn.em" +project = "bob.learn.em" import time -copyright = u"%s, Idiap Research Institute" % time.strftime("%Y") +copyright = "%s, Idiap Research Institute" % time.strftime("%Y") # Grab the setup entry distribution = pkg_resources.require(project)[0] @@ -126,8 +126,8 @@ pygments_style = "sphinx" # Some variables which are useful for generated material project_variable = project.replace(".", "_") -short_description = u"Core utilities required on all Bob modules" -owner = [u"Idiap Research Institute"] +short_description = "Core utilities required on all Bob modules" +owner = ["Idiap Research Institute"] # -- Options for HTML output --------------------------------------------------- @@ -209,7 +209,7 @@ html_favicon = "img/favicon.ico" # html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = project_variable + u"_doc" +htmlhelp_basename = project_variable + "_doc" # -- Post configuration -------------------------------------------------------- -- GitLab