def __init__(self,
                 model,
                 training_rdd,
                 criterion,
                 end_trigger,
                 batch_size,
                 optim_method=None,
                 bigdl_type="float"):
        """
        Create an optimizer.


        :param model: the neural net model
        :param training_data: the training dataset
        :param criterion: the loss function
        :param optim_method: the algorithm to use for optimization,
           e.g. SGD, Adagrad, etc. If optim_method is None, the default algorithm is SGD.
        :param end_trigger: when to end the optimization
        :param batch_size: training batch size
        """
        if not optim_method:
            optim_methods = {model.name(): SGD()}
        elif isinstance(optim_method, OptimMethod):
            optim_methods = {model.name(): optim_method}
        elif isinstance(optim_method, JavaObject):
            optim_methods = {model.name(): OptimMethod(optim_method, bigdl_type)}
        else:
            optim_methods = optim_method
        if isinstance(training_rdd, RDD):
            JavaValue.__init__(self, None, bigdl_type, model.value,
                               training_rdd, criterion,
                               optim_methods, end_trigger, batch_size)
        elif isinstance(training_rdd, DataSet):
            self.bigdl_type = bigdl_type
            self.value = callBigDlFunc(self.bigdl_type, "createDistriOptimizerFromDataSet",
                                       model.value, training_rdd, criterion,
                                       optim_methods, end_trigger, batch_size)
def __init__ ( self , model , training_rdd , criterion , end_trigger , batch_size , optim_method = None , bigdl_type = "float" ) : if not optim_method : optim_methods = { model . name ( ) : SGD ( ) } elif isinstance ( optim_method , OptimMethod ) : optim_methods = { model . name ( ) : optim_method } elif isinstance ( optim_method , JavaObject ) : optim_methods = { model . name ( ) : OptimMethod ( optim_method , bigdl_type ) } else : optim_methods = optim_method if isinstance ( training_rdd , RDD ) : JavaValue . __init__ ( self , None , bigdl_type , model . value , training_rdd , criterion , optim_methods , end_trigger , batch_size ) elif isinstance ( training_rdd , DataSet ) : self . bigdl_type = bigdl_type self . value = callBigDlFunc ( self . bigdl_type , "createDistriOptimizerFromDataSet" , model . value , training_rdd , criterion , optim_methods , end_trigger , batch_size )
Create an optimizer.


        :param model: the neural net model
        :param training_data: the training dataset
        :param criterion: the loss function
        :param optim_method: the algorithm to use for optimization,
           e.g. SGD, Adagrad, etc. If optim_method is None, the default algorithm is SGD.
        :param end_trigger: when to end the optimization
        :param batch_size: training batch size