def __init__(self, w_vector, max_iter=1): """ :param w_vector: A global weight vector instance that stores the weight value (float) :param max_iter: Maximum iterations for training the weight vector Could be overridden by parameter max_iter in the method :return: None """ logging.debug("Initialize AveragePerceptronLearner ... ") self.w_vector = w_vector self.max_iter = max_iter self.weight_sum_dict = mydefaultdict(mydouble) self.last_change_dict = mydefaultdict(mydouble) self.c = 1 return
def __init__(self, filename=None): """ :param store_type: Specify the type of database you want to use :type store_type: int :param filename: The file name of the database file. If you are using memory_dict then this could be given here or in dump(). However if you are using shelve or other possible extensions, you must provide a file name here in order to establish the connection to the database. :type filename: str """ # change to hvector #self.data_dict = {} self.data_dict = mydefaultdict(mydouble) if not filename == None: self.load(filename) return