Beispiel #1
0
def _build_pipeline():
    builder = build_pipelines(input=Tuple(List(List(Flags())),
                                          List(List(Category()))),
                              output=List(List(Category())),
                              registry=find_classes(include="CRF"))

    return builder.sample(sampler=Sampler(random_state=0))
Beispiel #2
0
    def _make_pipeline_builder(self):
        registry = self.registry or find_classes(include=self.include_filter,
                                                 exclude=self.exclude_filter)

        return build_pipelines(
            input=Tuple(self.input, self.output),
            output=self.output,
            registry=registry,
        )
import logging

logging.basicConfig(level=logging.DEBUG)


@nice_repr
class A:
    def run(self, input: Sentence()) -> List(Word()):
        pass


@nice_repr
class B:
    def run(self, input: List(Word())) -> List(Vector()):
        pass


@nice_repr
class C:
    def run(self, input: List(Vector())) -> Matrix():
        pass


builder = build_pipelines(input=Tuple(Sentence(), Vector()),
                          output=Matrix(),
                          registry=[A, B, C])

pipeline = builder.sample()
print(pipeline)
print(pipeline.run([[[True], [False, True]]]))