Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class BigML(LinearRegressionHandler, BatchProjectionHandler,
ProjectionHandler, PCAHandler,
ConfigurationHandler, FusionHandler,
OptimlHandler,
DeepnetHandler, ForecastHandler, TimeSeriesHandler,
BatchTopicDistributionHandler, TopicDistributionHandler,
TopicModelHandler, LibraryHandler, ExecutionHandler, ScriptHandler,
AssociationSetHandler, AssociationHandler,
LogisticRegressionHandler,
StatisticalTestHandler, CorrelationHandler,
SampleHandler, ProjectHandler,
BatchAnomalyScoreHandler, BatchCentroidHandler,
BatchPredictionHandler, EvaluationHandler, AnomalyScoreHandler,
AnomalyHandler, CentroidHandler, ClusterHandler, PredictionHandler,
EnsembleHandler, ModelHandler, DatasetHandler,
SourceHandler, ResourceHandler, BigMLConnection):
"""Entry point to create, retrieve, list, update, and delete
BigML resources.
Full API documentation on the API can be found from BigML at:
https://bigml.com/api
Resources are wrapped in a dictionary that includes:
code: HTTP status code
resource: The resource/id
location: Remote location of the resource
object: The resource itself
error: An error code and message
"""
def __init__(self, username=None, api_key=None, dev_mode=False,
debug=False, set_locale=False, storage=None, domain=None,
"""
try:
import simplejson as json
except ImportError:
import json
from bigml.resourcehandler import ResourceHandler
from bigml.resourcehandler import (check_resource_type, get_resource_type,
check_resource,
get_centroid_id, get_cluster_id)
from bigml.constants import CENTROID_PATH, CLUSTER_PATH, TINY_RESOURCE
class CentroidHandler(ResourceHandler):
"""This class is used by the BigML class as
a mixin that provides the REST calls models. It should not
be instantiated independently.
"""
def __init__(self):
"""Initializes the CentroidHandler. This class is intended to be
used as a mixin on ResourceHandler, that inherits its
attributes and basic method from BigMLConnection, and must not be
instantiated independently.
"""
self.centroid_url = self.prediction_base_url + CENTROID_PATH
def create_centroid(self, cluster, input_data=None,
args=None, wait_time=3, retries=10):
try:
import simplejson as json
except ImportError:
import json
from bigml.resourcehandler import ResourceHandler
from bigml.resourcehandler import (check_resource_type, get_resource_type,
check_resource,
get_association_set_id, get_association_id)
from bigml.constants import (ASSOCIATION_SET_PATH, ASSOCIATION_PATH,
TINY_RESOURCE)
class AssociationSetHandler(ResourceHandler):
"""This class is used by the BigML class as
a mixin that provides the REST calls models. It should not
be instantiated independently.
"""
def __init__(self):
"""Initializes the AssociationSetHandler. This class is intended to be
used as a mixin on ResourceHandler, that inherits its
attributes and basic method from BigMLConnection, and must not be
instantiated independently.
"""
self.association_set_url = self.url + ASSOCIATION_SET_PATH
def create_association_set(self, association, input_data=None,
args=None, wait_time=3, retries=10):
organization administrator.
When organization is set to an organization ID,
the user is considered to be working for an
organization. The scope of the API requests will be limited to the
projects of the organization and permissions need to be previously
given by the organization administrator.
"""
BigMLConnection.__init__(self, username=username, api_key=api_key,
dev_mode=dev_mode, debug=debug,
set_locale=set_locale, storage=storage,
domain=domain, project=project,
organization=organization)
ResourceHandler.__init__(self)
SourceHandler.__init__(self)
DatasetHandler.__init__(self)
ModelHandler.__init__(self)
EnsembleHandler.__init__(self)
PredictionHandler.__init__(self)
ClusterHandler.__init__(self)
CentroidHandler.__init__(self)
AnomalyHandler.__init__(self)
AnomalyScoreHandler.__init__(self)
EvaluationHandler.__init__(self)
BatchPredictionHandler.__init__(self)
BatchCentroidHandler.__init__(self)
BatchAnomalyScoreHandler.__init__(self)
ProjectHandler.__init__(self)
SampleHandler.__init__(self)
CorrelationHandler.__init__(self)
"""
try:
import simplejson as json
except ImportError:
import json
from bigml.resourcehandler import ResourceHandler
from bigml.resourcehandler import (check_resource_type, resource_is_ready,
get_anomaly_id)
from bigml.constants import ANOMALY_PATH
class AnomalyHandler(ResourceHandler):
"""This class is used by the BigML class as
a mixin that provides the REST calls models. It should not
be instantiated independently.
"""
def __init__(self):
"""Initializes the AnomalyHandler. This class is intended to be
used as a mixin on ResourceHandler, that inherits its
attributes and basic method from BigMLConnection, and must not be
instantiated independently.
"""
self.anomaly_url = self.url + ANOMALY_PATH
def create_anomaly(self, datasets, args=None, wait_time=3, retries=10):
"""Creates an anomaly detector from a `dataset` or a list o `datasets`.
try:
import simplejson as json
except ImportError:
import json
from bigml.resourcehandler import ResourceHandler
from bigml.resourcehandler import (check_resource_type, resource_is_ready,
get_resource_type, check_resource,
get_model_id, get_cluster_id)
from bigml.constants import (MODEL_PATH, CLUSTER_PATH, DATASET_PATH,
TINY_RESOURCE)
class ModelHandler(ResourceHandler):
"""This class is used by the BigML class as
a mixin that provides the REST calls models. It should not
be instantiated independently.
"""
def __init__(self):
"""Initializes the ModelHandler. This class is intended to be
used as a mixin on ResourceHandler, that inherits its
attributes and basic method from BigMLConnection, and must not be
instantiated independently.
"""
self.model_url = self.url + MODEL_PATH
def create_model(self, origin_resource, args=None, wait_time=3, retries=10):
"""Creates a model from an origin_resource.
"""
try:
import simplejson as json
except ImportError:
import json
from bigml.resourcehandler import ResourceHandler
from bigml.resourcehandler import (check_resource_type, resource_is_ready,
get_ensemble_id)
from bigml.constants import ENSEMBLE_PATH
class EnsembleHandler(ResourceHandler):
"""This class is used by the BigML class as
a mixin that provides the REST calls models. It should not
be instantiated independently.
"""
def __init__(self):
"""Initializes the EnsembleHandler. This class is intended to be
used as a mixin on ResourceHandler, that inherits its
attributes and basic method from BigMLConnection, and must not be
instantiated independently.
"""
self.ensemble_url = self.url + ENSEMBLE_PATH
def create_ensemble(self, datasets, args=None, wait_time=3, retries=10):
"""Creates an ensemble from a dataset or a list of datasets.
"""
try:
import simplejson as json
except ImportError:
import json
from bigml.resourcehandler import ResourceHandler
from bigml.resourcehandler import (check_resource_type, resource_is_ready,
get_optiml_id)
from bigml.constants import OPTIML_PATH
class OptimlHandler(ResourceHandler):
"""This class is used by the BigML class as
a mixin that provides the REST calls models. It should not
be instantiated independently.
"""
def __init__(self):
"""Initializes the OptimlHandler. This class is intended
to be used as a mixin on ResourceHandler, that inherits its
attributes and basic method from BigMLConnection, and must not be
instantiated independently.
"""
self.optiml_url = self.url + OPTIML_PATH
def create_optiml(self, datasets,
args=None, wait_time=3, retries=10):
"""
try:
import simplejson as json
except ImportError:
import json
from bigml.resourcehandler import ResourceHandler
from bigml.resourcehandler import (check_resource_type, resource_is_ready,
get_logistic_regression_id)
from bigml.constants import LOGISTIC_REGRESSION_PATH
class LogisticRegressionHandler(ResourceHandler):
"""This class is used by the BigML class as
a mixin that provides the REST calls models. It should not
be instantiated independently.
"""
def __init__(self):
"""Initializes the LogisticRegressionHandler. This class is intended
to be used as a mixin on ResourceHandler, that inherits its
attributes and basic method from BigMLConnection, and must not be
instantiated independently.
"""
self.logistic_regression_url = self.url + LOGISTIC_REGRESSION_PATH
def create_logistic_regression(self, datasets,
args=None, wait_time=3, retries=10):
"""
try:
import simplejson as json
except ImportError:
import json
from bigml.resourcehandler import ResourceHandler
from bigml.resourcehandler import (check_resource_type,
get_association_id)
from bigml.constants import ASSOCIATION_PATH
class AssociationHandler(ResourceHandler):
"""This class is used by the BigML class as
a mixin that provides the correlations' REST calls. It should not
be instantiated independently.
"""
def __init__(self):
"""Initializes the CorrelationHandler. This class is intended to be
used as a mixin on ResourceHandler, that inherits its
attributes and basic method from BigMLConnection, and must not be
instantiated independently.
"""
self.association_url = self.url + ASSOCIATION_PATH
def create_association(self, datasets, args=None, wait_time=3, retries=10):
"""Creates an association from a `dataset`.