not to be taken seriously!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.pyplot as plt | |
| def myplot(x, y, **kwargs): | |
| plt.plot(x, y, **kwargs) | |
| plt.xlabel('X') | |
| plt.ylabel('Y') | |
| plt.title('My plot') | |
| plt.show() | |
| x = [1, 3, 4, 5] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| n = 100 | |
| x = np.arange(n) | |
| plt.plot(x, x, label='linear') | |
| plt.plot(x, 2*x, label='double') | |
| plt.plot(x, x*x, label='square') | |
| plt.plot(x, x**3, label='power') | |
| plt.grid() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Jeans | Shirt | Jacket | Shoes | |
|---|---|---|---|---|
| 1 | 1 | 0 | 1 | |
| 0 | 0 | 0 | 1 | |
| 0 | 1 | 0 | 1 | |
| 0 | 1 | 1 | 1 | |
| 1 | 0 | 1 | 0 | |
| 1 | 0 | 1 | 0 | |
| 1 | 0 | 1 | 0 | |
| 1 | 0 | 0 | 0 | |
| 0 | 1 | 0 | 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!../venv/bin/python | |
| import pandas as pd | |
| import mlxtend.preprocessing | |
| import mlxtend.frequent_patterns | |
| # 1. Prepare the dataset (list of lists) | |
| dataset = [ | |
| {'Butter', 'Bread', 'Milk'}, | |
| {'Bread', 'Milk'}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shrimp | almonds | avocado | vegetables mix | green grapes | whole weat flour | yams | cottage cheese | energy drink | tomato juice | low fat yogurt | green tea | honey | salad | mineral water | salmon | antioxydant juice | frozen smoothie | spinach | olive oil | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| burgers | meatballs | eggs | ||||||||||||||||||
| chutney | ||||||||||||||||||||
| turkey | avocado | |||||||||||||||||||
| mineral water | milk | energy bar | whole wheat rice | green tea | ||||||||||||||||
| low fat yogurt | ||||||||||||||||||||
| whole wheat pasta | french fries | |||||||||||||||||||
| soup | light cream | shallot | ||||||||||||||||||
| frozen vegetables | spaghetti | green tea | ||||||||||||||||||
| french fries |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import argparse | |
| import itertools | |
| import collections | |
| def get_frequent_itemsets(transactions, min_support): | |
| # Count individual items | |
| freq = collections.defaultdict(int) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import argparse | |
| import itertools | |
| import collections | |
| sample = [ | |
| ['Butter', 'Bread', 'Milk'], | |
| ['Bread', 'Milk'], |
This file has been truncated, but you can view the full file.