Skip to content

Instantly share code, notes, and snippets.

@cosmic-cortex
Created January 27, 2020 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosmic-cortex/2d916ef4394c97bae00c5a3c4932a4db to your computer and use it in GitHub Desktop.
Save cosmic-cortex/2d916ef4394c97bae00c5a3c4932a4db to your computer and use it in GitHub Desktop.
Mock for unit testing the API
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