def learners(): kwargs = dict(event_size=EVENT_SIZE, outcome_size=OUTCOME_SIZE) for klass in ("Perceptron", "AveragedPerceptron"): factory = getattr(perceptron, klass) yield (klass, " vanilla ", factory(**kwargs)) for d in DEGREES: yield (klass, "polynomial-%d" % d, factory(kernel=perceptron.polynomial_kernel(d), **kwargs)) for g in GAMMAS: yield (klass, "radial-%.3f" % g, factory(kernel=perceptron.radial_basis_kernel(g), **kwargs)) for b in BEAM_WIDTHS: yield ("SparseAveragedPerceptron", "beam-%d" % b, perceptron.SparseAveragedPerceptron(beam_width=b, **kwargs))
def learners(): kwargs = dict(event_size=EVENT_SIZE, outcome_size=OUTCOME_SIZE) for klass in ('Perceptron', 'AveragedPerceptron'): factory = getattr(perceptron, klass) yield (klass, ' vanilla ', factory(**kwargs)) for d in DEGREES: yield (klass, 'polynomial-%d' % d, factory(kernel=perceptron.polynomial_kernel(d), **kwargs)) for g in GAMMAS: yield (klass, 'radial-%.3f' % g, factory(kernel=perceptron.radial_basis_kernel(g), **kwargs)) for b in BEAM_WIDTHS: yield ('SparseAveragedPerceptron', 'beam-%d' % b, perceptron.SparseAveragedPerceptron(beam_width=b, **kwargs))
def learners(): kwargs = dict(event_size=EVENT_SIZE, outcome_size=OUTCOME_SIZE) for klass in ('Perceptron', 'AveragedPerceptron'): factory = getattr(perceptron, klass) yield (klass, ' vanilla ', factory(**kwargs)) for d in DEGREES: yield (klass, 'polynomial-%d' % d, factory(kernel=perceptron.polynomial_kernel(d), **kwargs)) for g in GAMMAS: yield (klass, 'radial_gua-%.3f' % g, factory(kernel=perceptron.radial_basis_gua_kernel(g), **kwargs)) yield (klass, 'radial_mq-%.3f' % g, factory(kernel=perceptron.radial_basis_mq_kernel(g), **kwargs)) yield (klass, 'radial_thin-%.3f' % g, factory(kernel=perceptron.radial_basis_thin_kernel(g), **kwargs))