Created
January 27, 2020 17:27
-
-
Save cosmic-cortex/2d916ef4394c97bae00c5a3c4932a4db to your computer and use it in GitHub Desktop.
Mock for unit testing the API
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
import numpy as np | |
class MockModel: | |
def __init__(self, model_path: str = None): | |
self._model_path = None | |
self._model = None | |
def predict(self, X: np.ndarray) -> np.ndarray: | |
n_instances = len(X) | |
return np.random.rand(n_instances) | |
def train(self, X: np.ndarray, y: np.ndarray): | |
return self | |
def save(self): | |
pass | |
def load(self): | |
return self |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment