Skip to main content

Tests coverage

Multiple instance learning via embedded instance selection

This python package is an implementation of MILES: Multiple-instance learning via embedded instance selection from IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. 28, NO. 12, DECEMBER 2006.

The paper describes a method to encode bag-space features into a space defined by the most-likely-cause-estimator of the bag and training feature space.

The most likely cause estimator is defined as Most Likely Estimator

An example encoding

Look at embedding_test.py for an example embedding of dummy data. Dummy data is created from 5 normal distributions, and each instance is generated by one of the following two-dimensional probability distributions:

N1([5,5]^T, I), -> The normal distribution with mean [5,5] and 1 unit standard deviation N2([5,-5]^T, I), N3([-5,5]^T, I), N4([-5,-5]^T, I), N5([0,0]^T, I)

Bags are created from a variable number of instances per bag, and this example uses 8. A bag is labeled positive if it contains instances from at least two different distributions among N1, N2, and N3. Otherwise the bag is negative. This image displays the raw 2-dimensional data #2-D Raw Data

A single bag is of shape (N_INSTANCES, FEATURE_SPACE) where n is the number of instances in a bag, and p is the feature space of the instances.

All positive bags are of shape (N_POSITIVE_BAGS, N_INSTANCES, FEATURE_SPACE) where N_POSITIVE_BAGS is the number of positive bags. Negative bags are of shape (N_NEGATIVE_BAGS, N_INSTANCES, FEATURE_SPACE). The total set of training instances is of shape (N_POSITIVE_BAGS + N_NEGATIVE_BAGS, N_INSTANCES, FEATURE_SPACE).

A single bag is embedded into a vector of shape ((N_POSITIVE_BAGS + N_NEGATIVE_BAGS) * N_INSTANCES), which is the total number of instances from all positive and negative bags.

In this example let When projecting the training instances onto the vectors

# Feature vectors close to mean of `true` positive distributions
x1 = np.array([4.3, 5.2])
x2 = np.array([5.4, -3.9])
x3 = np.array([-6.0, 4.8])

the result is a (3,40) matrix which is visualized below. #Linearly Separable Bags

Testing

  • python -m unittest tests.embedding_test
  • python -m unittest tests.l1_svm_test

Code coverage and linting

  • pylint -r n src/tests/ src/pyMILES
  • From src directory: coverage run -m unittest tests.embedding_test
  • autopep8 --recursive --in-place src/tests/ src/pyMILES/

Building

Increment build version in setup.cfg python -m build . python -m twine upload dist/*

Metadata

Release files for pyMILES 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyMILES 0.0.6
File Size Uploaded Provenance Actions
pyMILES-0.0.6.tar.gz 9.9 kB Without provenance Details for pyMILES-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyMILES 0.0.6
File Interpreter ABI Platform Actions
pyMILES-0.0.6-py3-none-any.whl Python 3 none any Details for pyMILES-0.0.6-py3-none-any.whl

Total release size: 22.6 kB

Release files / pyMILES-0.0.6.tar.gz

Download URL pyMILES-0.0.6.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
48bdbe673249555168068eba5d75c6d5b46c52287d954a8a22bff7779fce65c6
BLAKE2b-256 checksum
How to use checksums
ee700aeadd50e5674185f077213415022386d3ba9d112274b2e95e079f6e6352
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release files / pyMILES-0.0.6-py3-none-any.whl

Download URL pyMILES-0.0.6-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ebe04e0ca6f1ae78aad7ca44589658ce34b197d025bceae714976b041a946fdf
BLAKE2b-256 checksum
How to use checksums
d5390f2a00fed80aa016f000e6640d3c9b58917074702b089bc4067cb9adf3bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Security for pyMILES 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page