Skip to main content

Electoral Data Standardization classes for the Selector project

Project description

Selector-standardizers

Модуль проекта Selector, реализующий основную логику обработки данных протоколов:

  • распознавание уровня выборов
  • распознавание уровня комиссии
  • подбор схемы данных
  • распознавание полей протокола
  • конвертирование в стандартный формат, соответствующий схеме
  • обучение ML-моделей распознавания.

Для работы тестов необходимо задать переменную окружения GOOGLE_APPLICATION_CREDENTIALS, указывающую путь к JSON файлу аутентификации Google Cloud Storage (GCS) проекта codeforrussia-selector.

PYTHONPATH=src GOOGLE_APPLICATION_CREDENTIALS=<path_to_google_credentials_json> pytest

Обучение модели распознавания полей протоколов

Обучение (точнее, fine-tuning) ML-модели осуществляется по текущей Avro схеме. Avro схема разрабатывается для выборов определенного уровня и типа. Pre-trained DeepPavlov RuBERT sentence encoder модель уже способна распознавать различные поля протоколов. Для улучшения ее качества используется fine-tuning модели по отношению к triplet loss на синтетических данных, сгенерированных из Avro схемы.

  1. Генерируются синтетические данные для обучения из имен и алиасов полей протоколов в схеме.
  2. Fine-tuning языковой модели по triplet loss.
  3. Экспорт модели в формат, принимаемый Sentence-BERT.

Пример команды тренировки:

PYTHONPATH=src python -m org.codeforrussia.selector.standardizer.recognizers.similarity.train --election-level REGIONAL --election-type PERSONAL --output-model-dir /tmp/codeforrussia-selector/ml-models/similarity-protocol-recognizer_1_0_0.zip

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

selector-standardizers-0.8.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

selector_standardizers-0.8.0-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file selector-standardizers-0.8.0.tar.gz.

File metadata

  • Download URL: selector-standardizers-0.8.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.3

File hashes

Hashes for selector-standardizers-0.8.0.tar.gz
Algorithm Hash digest
SHA256 dee4ca7078c967a5a867cbee84bc7445fa2455c1c478dccb3da058dfcc0f2b01
MD5 64e9d8b682bf9f214854f04120992920
BLAKE2b-256 fcae96109c0b71f55e458276a87f662732a68217ceac1fbd171d0cb2e3a01a2f

See more details on using hashes here.

File details

Details for the file selector_standardizers-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: selector_standardizers-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 26.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.3

File hashes

Hashes for selector_standardizers-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e3d4f00f44c096084aff9e6022f9992caa5909e5a6f0d7cdaf1e1dc1b86e636
MD5 809bd90c159dcf915b5a24869a9c76e4
BLAKE2b-256 1889a75e31e229b956200e81ddc09e1f7af035833c535830d42a80444a1c3667

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page