Skip to content

Instantly share code, notes, and snippets.

@kmaehashi
Created September 21, 2016 03:12
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 kmaehashi/b0e1bde84e582bb56f5c58e5bf5be74f to your computer and use it in GitHub Desktop.
Save kmaehashi/b0e1bde84e582bb56f5c58e5bf5be74f to your computer and use it in GitHub Desktop.
__all__ = [
'ConfigFile',
'Anomaly',
'Bandit',
'Burst',
'Classifier',
'Clustering',
'NearestNeighbor',
'Recommender',
'Regression',
'Stat',
'Graph',
'Weight',
]
class ConfigFile(dict):
def __init__(self, filename):
with open(filename) as f:
self.update(json.load(f))
class _EmbeddedUnavailable(object):
def __init__(self, *args, **kwargs):
raise RuntimeError('Embedded Jubatus Python module is not installed.')
# Remove the following code once embedded_jubatus supports these engine.
class _EmbeddedNotImplemented(object):
def __init__(self, *args, **kwargs):
raise RuntimeError('Embedded Jubatus Python module currently does not support this engine.')
Graph = _EmbeddedNotImplemented
Weight = _EmbeddedNotImplemented
try:
from embedded_jubatus import *
except ImportError:
Anomaly = _EmbeddedUnavailable
Bandit = _EmbeddedUnavailable
Burst = _EmbeddedUnavailable
Classifier = _EmbeddedUnavailable
Clustering = _EmbeddedUnavailable
NearestNeighbor = _EmbeddedUnavailable
Recommender = _EmbeddedUnavailable
Regression = _EmbeddedUnavailable
Stat = _EmbeddedUnavailable
Graph = _EmbeddedUnavailable
Weight = _EmbeddedUnavailable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment