Aprioripy: Apriori algorithm.
Apriori algorithm usage:
from apriopy import Apriopy
test_table = pd.DataFrame({
"items": ["1, 3, 4", "2, 3, 5", "1, 2, 3, 5", "2, 5"]
})
print("Test table")
print(test_table)
ap = Aprioripy(table=test_table)
print("\nFrequency table:")
print(ap.frequency_table)
ap.apriori(min_support=0.5)
for i in ap.association_tables.keys():
print("\nAssociation table " + i)
print(ap.association_tables[i])
test_table = pd.DataFrame(
[
{"1": 1, "2": 0, "3": 1, "4": 1, "5": 0},
{"1": 0, "2": 1, "3": 1, "4": 0, "5": 1},
{"1": 1, "2": 1, "3": 1, "4": 0, "5": 1},
{"1": 0, "2": 1, "3": 0, "4": 0, "5": 1}
]
)
print("\nTest table:")
print(test_table)
ap = Aprioripy(table=test_table, convert=False)
print("\nFrequency table:")
print(ap.frequency_table)
ap.apriori(min_support=0.5)
for i in ap.association_tables.keys():
print("\nAssociation table " + i)
print(ap.association_tables[i])
Output:
Test table
items
0 1, 3, 4
1 2, 3, 5
2 1, 2, 3, 5
3 2, 5
Frequency table:
item frequency
0 1 0.50
1 2 0.75
2 3 0.75
3 4 0.25
4 5 0.75
Association table L1
item frequency
0 1 0.50
1 2 0.75
2 3 0.75
4 5 0.75
Association table L2
itemset frequency
1 (1, 3) 0.50
4 (2, 3) 0.50
6 (2, 5) 0.75
8 (3, 5) 0.50
Association table L3
itemset frequency
7 (2, 3, 5) 0.5
Test table:
1 2 3 4 5
0 1 0 1 1 0
1 0 1 1 0 1
2 1 1 1 0 1
3 0 1 0 0 1
Frequency table:
item frequency
0 1 0.50
1 2 0.75
2 3 0.75
3 4 0.25
4 5 0.75
Association table L1
item frequency
0 1 0.50
1 2 0.75
2 3 0.75
4 5 0.75
Association table L2
itemset frequency
1 (1, 3) 0.50
4 (2, 3) 0.50
6 (2, 5) 0.75
8 (3, 5) 0.50
Association table L3
itemset frequency
7 (2, 3, 5) 0.5
Metadata
Release files for aprioripy 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| aprioripy-0.0.2.tar.gz | 2.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aprioripy-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.2 kB
Release files / aprioripy-0.0.2.tar.gz
| Download URL | aprioripy-0.0.2.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f14bcc0e9ef1d31b81cd55062057789754833d36f887ef9bf2151791a503980c
|
|
BLAKE2b-256 checksum How to use checksums |
d553a0e9c036278a972e139e685a643a7f0bf6e97001c3519dbfa008c9191664
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8
|
Release files / aprioripy-0.0.2-py3-none-any.whl
| Download URL | aprioripy-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2d6078103dbb404e258513dcf5a5784671d23c6a5dec4a128f472f46840cf68e
|
|
BLAKE2b-256 checksum How to use checksums |
cbd97ff71b33b94262f19d6b43321b9135c33b3ff2aa77ebf958d24f28c064a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8
|
Security for aprioripy 0.0.2
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.