Comments (5)
This is a mathematical question @Andhu7. I don't see how what you describe above is an intersection of two rules.
I hope the following code can get you started.
from efficient_apriori import apriori
transactions = [('eggs', 'bacon', 'soup'),
('eggs', 'bacon', 'apple'),
('soup', 'bacon', 'banana')]
itemsets, rules = apriori(transactions, min_support=0.5, min_confidence=1)
print(rules) # [{eggs} -> {bacon}, {soup} -> {bacon}]
from functools import reduce
def intersection(rule1, rule2):
# Here you must define what you believe an intersection is.
# I have taken the union of the RHS and LHS of both rules,
# since it complies with your example. It's obviously not an intersection.
return reduce(set.union, (set(k) for k in (rule1.lhs, rule1.rhs, rule2.lhs, rule2.rhs)))
new_rule = intersection(rules[0], rules[1])
# Simply loop over the transactions and count
count = 0
for trans in transactions:
if new_rule.issubset(set(trans)):
count += 1
print(count) # Should print 1.
I'm going to close this issue. The purpose of Issues as they relate to this repository is to report bugs or suggest improvements to the software. The purpose of Issues is not to get help with general Python and mathematics, even if they relate to itemsets and the apriori algorithm.
from efficient-apriori.
Where is the code of count_all
?
from efficient-apriori.
Sry count_full which is used to count the union of the lhs and rhs in the dataset.
from efficient-apriori.
count_full
the total number of times the union of the left hand side and right hand side appear in the data set.
If you want a more detailed explanation, you're gonna have to ask a more detailed question. I don't fully understand what you're asking for here.
from efficient-apriori.
Can u hlp me with this..
how to find intersection of two rules?
if rule1 is {a, b} -> {c} and rule2 is {a} -> {c, d}
{a, b} -> {c} intersection {a} -> {c, d} means
the count of every time {a, b,c,d} appear together in a transaction...
Any idea how to get this???
from efficient-apriori.
Related Issues (20)
- Input dataset format HOT 4
- Misprint in instructional comment HOT 2
- Clarifications on rules direction meaning HOT 3
- Why not add Rule Power Factor (RPF) as one more property to Rule? HOT 1
- Is there any way to export the rules with data to Excel? HOT 4
- ModuleNotFoundError: No module named 'dataclasses' HOT 2
- run time HOT 7
- Seeing #30, tuning confidence and min support for max itemsets? HOT 3
- lhs and rhs mixed up in the comments? HOT 1
- KeyError while generating rules HOT 6
- the min_support value HOT 1
- H_1 is not reduced, unnecessary rule candidate generation/checking HOT 3
- Using iterator or generator to provide transactions HOT 2
- A doubt HOT 2
- GPL-3.0 license classifier? HOT 2
- Reducing H_1 update broken HOT 3
- weighted Association rule mining HOT 1
- sort step not needed after combinations for join_step HOT 2
- Could Polars increase memory usage and speed? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efficient-apriori.