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 мульти-языковая модель на основе Sentence-BERT уже способна распознавать различные поля протоколов. Для улучшения ее качества используется 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.3.2.tar.gz (13.1 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.3.2-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: selector-standardizers-0.3.2.tar.gz
  • Upload date:
  • Size: 13.1 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.3.2.tar.gz
Algorithm Hash digest
SHA256 3ad0946623e7abf5f732230f1142848594190102c660b7b3e9a4a5c7447b5938
MD5 c8cad077d2cb2eed8923dc36c03a304d
BLAKE2b-256 e6fec0c98300c1df96ae71ff72f780d95762508833326286a529854950e11c4c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: selector_standardizers-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 21.8 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.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f993765c1a2351ca65f6ce0b63f853b475329f8869f6f9ee632c1f6175c1f4df
MD5 a5ce2011e2761d0cb3b58d735db69fdf
BLAKE2b-256 e0227aa67eebf8b410bfc86845a6f17b32c5ddc71314a5811d56bccc45fd9922

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