From the course: Data Science Foundations: Data Mining in Python
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Apriori - Python Tutorial
From the course: Data Science Foundations: Data Mining in Python
Apriori
- [Instructor] By far, the most common method for association analysis is the Apriori algorithm. To do this in Python, we're going to have to download a special package called Apyori and you can download it possibly with this, uncomment it or I had to use this command down here. Again, uncomment the two lines, run them. It only needs to be done once per machine and I've already installed it. But once you have all Apyori installed, then we'll come and load these additional libraries to work with data. And then we're going to use the groceries dataset that I showed you before but Apyori needs it in a list format. So what we're going to do is we're going to create an object called transactions and then we're going to go through the groceries dataset and we're going to take each line in that, we're going to split the cells and put commas in between them and get rid of the NAN or not a number, and then append that. And we'll…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.