5757from bigml .cluster import Cluster
5858from bigml .anomaly import Anomaly
5959from bigml .association import Association
60+ from bigml .timeseries import TimeSeries
6061try :
6162 from bigml .topicmodel import TopicModel
6263 TOPIC_ENABLED = True
8384 "cluster" : Cluster ,
8485 "anomaly" : Anomaly ,
8586 "association" : Association ,
86- "topicmodel " : TopicModel ,
87- "pca " : PCA }
87+ "pca " : PCA ,
88+ "timeseries " : TimeSeries }
8889MODEL_CLASSES .update (SUPERVISED_CLASSES )
90+ if TOPIC_ENABLED :
91+ MODEL_CLASSES .update ({"topicmodel" : TopicModel })
8992
9093
9194def extract_id (model , api ):
@@ -139,7 +142,7 @@ def extract_id(model, api):
139142class LocalModel (BaseModel ):
140143 """ A lightweight wrapper around any BigML model.
141144
142- Uses any BigML remote supervised model to build a local version
145+ Uses any BigML remote model to build a local version
143146 that can be used to generate predictions locally.
144147
145148 """
@@ -179,7 +182,7 @@ def data_transformations(self):
179182
180183 def batch_predict (self , input_data_list , outputs = None , ** kwargs ):
181184 """Creates a batch prediction for a list of inputs using the local
182- supervised model. Allows to define some output settings to
185+ BigML model. Allows to define some output settings to
183186 decide the fields to be added to the input_data (prediction,
184187 probability, etc.) and the name that we want to assign to these new
185188 fields. The outputs argument accepts a dictionary with keys
@@ -196,8 +199,9 @@ def batch_predict(self, input_data_list, outputs=None, **kwargs):
196199 :rtype: list or Panda's dataframe depending on the input type in
197200 input_data_list
198201 """
199- if isinstance (self .local_model , Association ):
200- raise ("The method is not available for Associations." )
202+ if isinstance (self .local_model , (Association , TimeSeries )):
203+ raise ValueError ("The method is not available for Associations or "
204+ "TimeSeries." )
201205 if self .supervised :
202206 if outputs is None :
203207 outputs = {}
@@ -220,9 +224,8 @@ def batch_predict(self, input_data_list, outputs=None, **kwargs):
220224 if data_format != INTERNAL :
221225 return format_data (inner_data_list , out_format = data_format )
222226 return inner_data_list
223- else :
224- return self .local_model .batch_predict (input_data_list ,
225- outputs = outputs , ** kwargs )
227+ return self .local_model .batch_predict (input_data_list ,
228+ outputs = outputs , ** kwargs )
226229
227230 #pylint: disable=locally-disabled,arguments-differ
228231 def dump (self , ** kwargs ):
0 commit comments