aprioripy-0.0.2
توضیحات
Apriori algorithm.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | aprioripy-0.0.2 |
| نام | aprioripy |
| نسخه کتابخانه | 0.0.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Gökhan Gerdan |
| ایمیل نویسنده | gokhang1327@gmail.com |
| آدرس صفحه اصلی | https://github.com/gokhangerdan/Aprioripy |
| آدرس اینترنتی | https://pypi.org/project/aprioripy/ |
| مجوز | - |
# Aprioripy: Apriori algorithm.
<img src="4742c1dc-c672-4194-96c3-54ee5b88a840.jpeg">
## Apriori algorithm usage:
```python
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
```
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl aprioripy-0.0.2:
pip install aprioripy-0.0.2.whl
نصب پکیج tar.gz aprioripy-0.0.2:
pip install aprioripy-0.0.2.tar.gz