Skip to main content

A library aiding to create challenges for the AnoMed competition platform.

Project description

Code style: black pipeline status coverage

Challenge

A library aiding to create challenges for the AnoMed competition platform.

Usage Example

The following example will create a Falcon-based web app that serves the famous iris dataset and uses plain binary accuracy as an evaluation metric. In more detail, these routes are offered (some may have query parameters not mentioned here):

  • [GET] / (this displays an "alive message")
  • [GET] /data/anonymizer/training (this will serve X_train and y_train)
  • [GET] /data/anonymizer/tuning (this will serve X_tune)
  • [GET] /data/anonymizer/validation (this will serve X_val)
  • [GET] /data/deanonymizer/members (this will serve a subset of X_train and y_train)
  • [GET] /data/deanonymizer/non-members (this will serve a subset of X_val and y_val)
  • [GET] /data/attack-success-evaluation (this will serve data from the complement of members and also from the complement of non-members).
  • [POST] /utility/anonymizer (this will evaluate the quality of an anonymizer's prediction compared to y_tune or y_val.)
  • [POST] /utility/deanonymizer (this will evaluate the quality of a denanonymizer's prediction compared to attack-success-evaluation)
import anomed_challenge as anochal
from sklearn import datasets, model_selection

iris = datasets.load_iris()

X = iris.data  # type: ignore
y = iris.target  # type: ignore

X_train, X_other, y_train, y_other = model_selection.train_test_split(
    X, y, test_size=0.3, random_state=42
)
X_tune, X_val, y_tune, y_val = model_selection.train_test_split(
    X_other, y_other, test_size=0.5, random_state=21
)

example_challenge = anochal.SupervisedLearningMIAChallenge(
    training_data=anochal.InMemoryNumpyArrays(X=X_train, y=y_train),
    tuning_data=anochal.InMemoryNumpyArrays(X=X_tune, y=y_tune),
    validation_data=anochal.InMemoryNumpyArrays(X=X_val, y=y_val),
    anonymizer_evaluator=anochal.strict_binary_accuracy,
    MIA_evaluator=anochal.evaluate_MIA,
    MIA_evaluation_dataset_length=5,
)

# This is what GUnicorn expects
application = anochal.supervised_learning_MIA_challenge_server_factory(
    example_challenge
)

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

anomed_challenge-0.0.14.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

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

anomed_challenge-0.0.14-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file anomed_challenge-0.0.14.tar.gz.

File metadata

  • Download URL: anomed_challenge-0.0.14.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for anomed_challenge-0.0.14.tar.gz
Algorithm Hash digest
SHA256 7b6ed754a733f80713530e3a31b40f06e8ba53f93f8f5eed0e26ac726a88c3aa
MD5 3927ff1de21371bf01fd5b6a9340cf54
BLAKE2b-256 0055181e89467dd2e2cc2b7c187671e8943a4945f828c1b95ef9b0ec0633bbf0

See more details on using hashes here.

File details

Details for the file anomed_challenge-0.0.14-py3-none-any.whl.

File metadata

File hashes

Hashes for anomed_challenge-0.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 a10fa43de9e4b086eafb6e8e1d8dc214a149d7a74ad10f25217b03910fa81bda
MD5 5cab8f844d2eb453dce0205b78fc0480
BLAKE2b-256 57c443ef2d00085f85e3a3fe0862c8cdd886b77e0ab5b2892b5c68874b33fddb

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