def compose_input_data(x: List[Union[Tuple[Union[np.ndarray, list, spmatrix, str]],
                                         List[Union[np.ndarray, list, spmatrix, str]],
                                         np.ndarray, spmatrix]]) -> Union[spmatrix, np.ndarray]:
        """
        Stack given list of different types of inputs to the one matrix. If one of the inputs is a sparse matrix, \
            then output will be also a sparse matrix

        Args:
            x: list of data elements

        Returns:
            sparse or dense array of stacked data
        """
        x_features = []
        for i in range(len(x)):
            if ((isinstance(x[i], tuple) or isinstance(x[i], list) or isinstance(x[i], np.ndarray) and len(x[i]))
                    or (issparse(x[i]) and x[i].shape[0])):
                if issparse(x[i][0]):
                    x_features.append(vstack(list(x[i])))
                elif isinstance(x[i][0], np.ndarray) or isinstance(x[i][0], list):
                    x_features.append(np.vstack(list(x[i])))
                elif isinstance(x[i][0], str):
                    x_features.append(np.array(x[i]))
                else:
                    raise ConfigError('Not implemented this type of vectors')
            else:
                raise ConfigError("Input vectors cannot be empty")

        sparse = False
        for inp in x_features:
            if issparse(inp):
                sparse = True
        if sparse:
            x_features = hstack(list(x_features))
        else:
            x_features = np.hstack(list(x_features))

        return x_features

        Stack given list of different types of inputs to the one matrix. If one of the inputs is a sparse matrix,             then output will be also a sparse matrix

        Args:
            x: list of data elements

        Returns:
            sparse or dense array of stacked data
        
deeppavlov/models/sklearn/sklearn_component.py