This file contains 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
$ lore init my_app --python-version=3.6.4 --keras |
This file contains 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
# On Linux | |
$ pip install lore | |
# On OS X use homebrew python 2 or 3 | |
$ brew install python3 && pip3 install lore |
This file contains 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
$ cd my_app | |
$ lore generate scaffold product_popularity --keras --regression --holdout |
This file contains 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
# my_app/pipelines/product_popularity.py part 1 | |
import os | |
from lore.encoders import Token, Unique, Norm | |
import lore.io | |
import lore.pipelines.holdout | |
import lore.env | |
import pandas |
This file contains 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
department_id | department | |
---|---|---|
1 | frozen | |
2 | other | |
3 | bakery | |
4 | produce | |
5 | alcohol |
This file contains 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
product_id | product_name | aisle_id | department_id | |
---|---|---|---|---|
1 | Chocolate Sandwich Cookies | 61 | 19 | |
2 | All-Seasons Salt | 104 | 13 | |
3 | Robust Golden Unsweetened Oolong Tea | 94 | 7 | |
4 | Smart Ones Classic Favorites Mini Rigatoni With Vodka Cream Sauce | 38 | 1 | |
5 | Green Chile Anytime Sauce | 5 | 13 |
This file contains 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
order_id | product_id | add_to_cart_order | reordered | |
---|---|---|---|---|
2 | 33120 | 1 | 1 | |
2 | 28985 | 2 | 1 | |
2 | 9327 | 3 | 0 | |
2 | 45918 | 4 | 1 | |
2 | 30035 | 5 | 0 |
This file contains 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
# my_app/pipelines/product_popularity.py part 2 | |
def get_encoders(self): | |
return ( | |
# An encoder to tokenize product names into max 15 tokens that | |
# occur in the corpus at least 10 times. We also want the | |
# estimator to spend 5x as many resources on name vs department | |
# since there are so many more words in english than there are | |
# grocery store departments. | |
Token('product_name', sequence_length=15, minimum_occurrences=10, embed_scale=5), |
This file contains 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
# my_app/estimators/product_popularity.py | |
import lore.estimators.keras | |
class Keras(lore.estimators.keras.Regression): | |
pass |
This file contains 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
# my_app/models/product_popularity.py | |
import lore.models.keras | |
import my_app.pipelines.product_popularity | |
import my_app.estimators.product_popularity | |
class Keras(lore.models.keras.Base): | |
def __init__(self, pipeline=None, estimator=None): |
OlderNewer