def __init__(self, logger=None, vw='vw', moniker=None, name=None, bits=None, loss=None, passes=None, log_stderr_to_file=False, silent=False, l1=None, l2=None, learning_rate=None, quadratic=None, audit=None, power_t=None, adaptive=False, working_dir=None, decay_learning_rate=None, initial_t=None, lda=None, lda_D=None, lda_rho=None, lda_alpha=None, minibatch=None, total=None, node=None, unique_id=None, span_server=None, bfgs=None, oaa=None, old_model=None, incremental=False, mem=None, nn=None, raw=False, **kwargs): assert moniker and passes if logger is None: self.log = VPLogger() else: self.log = logger self.node = node self.total = total self.unique_id = unique_id self.span_server = span_server if self.node is not None: assert self.total is not None assert self.unique_id is not None assert self.span_server is not None if name is None: self.handle = '%s' % moniker else: self.handle = '%s.%s' % (moniker, name) if self.node is not None: self.handle = "%s.%d" % (self.handle, self.node) if old_model is None: self.filename = '%s.model' % self.handle self.incremental = False else: self.filename = old_model self.incremental = True self.incremental = incremental self.filename = '%s.model' % self.handle self.name = name self.bits = bits self.loss = loss self.vw = vw self.l1 = l1 self.l2 = l2 self.learning_rate = learning_rate self.log_stderr_to_file = log_stderr_to_file self.silent = silent self.passes = passes self.quadratic = quadratic self.power_t = power_t self.adaptive = adaptive self.decay_learning_rate = decay_learning_rate self.audit = audit self.initial_t = initial_t self.lda = lda self.lda_D = lda_D self.lda_rho = lda_rho self.lda_alpha = lda_alpha self.minibatch = minibatch self.oaa = oaa self.bfgs = bfgs self.mem = mem self.nn = nn self.raw = raw # Do some sanity checking for compatability between models if self.lda: assert not self.l1 assert not self.l1 assert not self.l2 assert not self.loss assert not self.adaptive assert not self.oaa assert not self.bfgs else: assert not self.lda_D assert not self.lda_rho assert not self.lda_alpha assert not self.minibatch self.working_directory = working_dir or os.getcwd()