Getting acquainted with skootΒΆ

This example walks through the package layout and where various transformers/classes can be located, as well as displays some nuances between scikit-learn and skoot.


Out:

['QRDecomposition', 'SelectiveIncrementalPCA', 'SelectiveKernelPCA', 'SelectiveNMF', 'SelectivePCA', 'SelectiveTruncatedSVD', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_dqrsl', '_dqrutl', 'decompose']

   sepal length (cm)  ...  Species
0                5.1  ...        0
1                4.9  ...        0
2                4.7  ...        0
3                4.6  ...        0
4                5.0  ...        0

[5 rows x 5 columns]

The base class for all Pandas frame transformers.

    Provides the base class for all skoot transformers that require
    Pandas dataframes as input.

    Parameters
    ----------
        cols : array-like, shape=(n_features,), optional (default=None)
        The names of the columns on which to apply the transformation.
        If no column names are provided, the transformer will be fit
        on the entire frame. Note that the transformation will also
        only apply to the specified columns, and any other
        non-specified columns will still be present after
        the transformation.


        as_df : bool, optional (default=True)
        Whether to return a Pandas ``DataFrame`` in the ``transform``
        method. If False, will return a Numpy ``ndarray`` instead.
        Since most skoot transformers depend on explicitly-named
        ``DataFrame`` features, the ``as_df`` parameter is True by
        default.


    Examples
    --------
    The following is an example of how to subclass a BasePDTransformer:

        >>> from skoot.base import BasePDTransformer
        >>> class A(BasePDTransformer):
        ...     def __init__(self, cols=None, as_df=None):
        ...             super(A, self).__init__(cols, as_df)
        ...
        >>> A()
        A(as_df=None, cols=None)

print(__doc__)

# Author: Taylor Smith <taylor.smith@alkaline-ml.com>

# #############################################################################
# Skoot is laid out much like scikit-learn. That is, many of the same modules
# exist in skoot that are present in scikit. For example:
from skoot import decomposition
print(dir(decomposition))  # many are similar to sklearn classes
print("")

# #############################################################################
# Skoot also has a dataset interface, like sklearn. Except it returns
# dataframes rather than numpy arrays:
from skoot.datasets import load_iris_df
df = load_iris_df(include_tgt=True, tgt_name='Species')
print(df.head())
print("")

# #############################################################################
# All skoot transformers are based on the BasePDTransformer:
from skoot.base import BasePDTransformer

print(BasePDTransformer.__doc__)

Total running time of the script: ( 0 minutes 0.027 seconds)

Gallery generated by Sphinx-Gallery