@@ -0,0 +1,1768 @@
+from collections import namedtuple%0Afrom h2o import H2OConnection, _quoted, get_frame%0A%0A%0Aclass H2OAssembly:%0A  %22%22%22%0A  Extension class of Pipeline implementing additional methods:%0A%0A    * to_pojo: Exports the assembly to a self-contained Java POJO used in a per-row, high-throughput environment.%0A    * fuse: Combine two H2OAssembly objects, the resulting row from each H2OAssembly are joined with simple concatenation.%0A  %22%22%22%0A  def __init__(self, steps):%0A    %22%22%22%0A    Build a new H2OAssembly.%0A%0A    :param steps: A list of steps that sequentially transforms the input data.%0A    :return: An H2OFrame.%0A    %22%22%22%0A    self.steps = steps%0A    self.fuzed = %5B%5D%0A    self.in_colnames = None%0A    self.out_colnames = None%0A%0A  @property%0A  def names(self):%0A    return zip(*self.steps)%5B0%5D%5B:-1%5D%0A%0A  def to_pojo(self,pojo_name=None):%0A    pass%0A%0A  def union(self, assemblies):%0A    # fuse the assemblies onto this one, each is added to the end going left -%3E right%0A    # assemblies must be a list of namedtuples.%0A    #   %5B(H2OAssembly, X, y, %7Bparams%7D), ..., (H2OAssembly, X, y, %7Bparams%7D)%5D%0A    for i in assemblies:%0A      if not isinstance(i, namedtuple):%0A        raise ValueError(%22Not a namedtuple. Assembly must be of type collections.namedtuple with fields %5Bassembly, x, params%5D.%22)%0A      if i._fields != ('assembly','x','params'):%0A        raise ValueError(%22Assembly must be a namedtuple with fields ('assembly', 'x', 'params').%22)%0A      self.fuzed.append(i)%0A%0A  def fit(self, fr, **fit_params):%0A    res = %5B%5D%0A    for step in self.steps:%0A      res.append(step%5B1%5D.to_rest(step%5B0%5D))%0A    res = %22,%22.join(%5B_quoted(r.replace('%22',%22'%22)) for r in res%5D)%0A    res = %22%5B%22 + res + %22%5D%22%0A    j = H2OConnection.post_json(url_suffix=%22Assembly%22, assembly=res, frame=fr._id, _rest_version=99)%0A    return get_frame(j%5B%22result%22%5D)%0A

add python assembly class