@extensionmethod(Observable, alias="flat_map")
def select_many(self, selector, result_selector=None):

    if result_selector:
        def projection(x, i):
            selector_result = selector(x, i)
            if isinstance(selector_result, collections.Iterable):
                result = Observable.from_(selector_result)
            else:
                result = Observable.from_future(selector_result)
            return result.map(lambda y: result_selector(x, y, i))

        return self.flat_map(projection)

    if callable(selector):
        selector = adapt_call(selector)
        ret = _flat_map(self, selector)
    else:
        ret = _flat_map(self, lambda _,__: selector)

    return ret
Check classification on a toy dataset.
dataset/ETHPy150Open ReactiveX/RxPY/rx/linq/observable/selectmany.py/select_many--crossover with--dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/ensemble/tests/test_forest.py/check_classification_toy