-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08049d3
commit 7b2c629
Showing
12 changed files
with
103 additions
and
22 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from .app import app | ||
from .runner import ModelRunner |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from hemlock_highway.ml import HemlockModelBase | ||
|
||
|
||
class ModelRunner: | ||
""" | ||
Responsible for running a model in either training/testing/prediction modes | ||
""" | ||
|
||
def __init__(self, model: HemlockModelBase=None, bucket: str=None, key: str=None): | ||
""" | ||
Load the model, but not the data using either directly passing model or pointing to s3 location | ||
""" | ||
if model is None and all((m is None for m in (bucket, key))): | ||
raise ValueError('Must specify either a loaded model or an s3 location specifying both bucket and key!') | ||
|
||
self.model = model if model is not None else HemlockModelBase.load(bucket, key) | ||
|
||
def fit(self): | ||
"""Fit the underlying model to the data from it's DataManager""" | ||
X, y = self.model.data_manager.load() | ||
self.model.fit(X, y) | ||
return True | ||
|
||
def predict(self): | ||
"""Predict using model from DataManager data""" | ||
X, y = self.model.data_manager.load() | ||
return self.model.predict(X) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,5 @@ coveralls==1.3.0 | |
Flask-Dance==0.14.0 | ||
SQLAlchemy==1.2.7 | ||
SQLAlchemy-Utils==0.33.3 | ||
fakeredis==0.10.2 | ||
redis==2.10.6 |
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
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
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
File renamed without changes.