Skip to main content

A Hamming Encoder package

Project description

HammingEncoder

HammingEncoder is the source code for paper.

Installation

You can install HammingEncoder from PyPI:

pip install HammingEncoder

Usage

Here's how to use the HammingEncoder package:

Importing the package

from HammingEncoder import HammingEncoder

# Example data
sequences = [
    ['0', '1', '2', '3', '4', '5', '1', '6', '5', '1', '7', '4', '5', '8', '5'], 
    ['0', '1', '4', '2', '3', '4', '5', '8', '5', '1', '7', '4', '5', '1', '5', '1', '5', '6', '5'],
    ['0', '1', '2', '3', '4', '5', '8', '5', '1', '5', '7', '5', '1', '8', '5', '1', '5', '1', '5', '1', '6', '4', '5'], 
    ['0', '4', '2', '3', '5', '7', '5', '1', '5', '4', '6', '5', '1', '5', '4', '5'],
    ]
labels = [0, 1, 0, 1]

# Initialize the encoder
encoder = HammingEncoder(sequences, labels, gap_constrain=5, label_number=2, Preset_set_pattern_num=1024, device='cpu')

# Fit the model
encoder.fit(n_epochs=100, patience=2, batch_size=64)

# Transform the data
encoded_data = encoder.transform(sequences)

print("Encoded data:", encoded_data)

# test
acc = encoder.test(sequences, labels)
print("Accuracy:", acc)

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

hammingencoder-0.1.8.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

HammingEncoder-0.1.8-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file hammingencoder-0.1.8.tar.gz.

File metadata

  • Download URL: hammingencoder-0.1.8.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for hammingencoder-0.1.8.tar.gz
Algorithm Hash digest
SHA256 d08fd2e29ac607731de4294a27aee66be4c126bc4c448733795f423f61c47b02
MD5 05c234e8ce4e00c2f71138bedcef80ed
BLAKE2b-256 feaebca6b4da8092a2dc59ae7b5d67319aae28a044346a8d7f29ad08b0c4760b

See more details on using hashes here.

File details

Details for the file HammingEncoder-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: HammingEncoder-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for HammingEncoder-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 023eed049abee5ece2da40bf6dbfa8ff08056065b78cb9a3355225ac81162b4d
MD5 c06495f35a82012b76f3d66e45f60ec4
BLAKE2b-256 6a816d1bed8a74bd410604adf449a7d66bf354875573308aeda255330f691fec

See more details on using hashes here.

Supported by

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