mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-15 12:15:22 +08:00
ENH: Add support for Classifiers.
Classifiers are computations that represent grouping keys. They can be used in conjuction with normalization functions like ``zscore`` or ``demean`` to perform normalizations over subsets of a dataset. Notable changes: - Added ``demean()`` and ``zscore()`` methods to ``Factor``. - Added a classifier versions of ``Latest`` and ``CustomTermMixin``. The .latest attribute of int64 dataset columns no produces a classifier by default. - Added ``Everything``, a classifier that maps all data to the same value. - Added ``zipline.lib.normalize``, which implements a naive, pure-Python grouped normalize function. This will likely be moved to Cython in a subsequent PR.
This commit is contained in:
@@ -147,6 +147,24 @@ class BasePipelineTestCase(TestCase):
|
||||
"""
|
||||
return arange(prod(shape), dtype=dtype).reshape(shape)
|
||||
|
||||
@with_default_shape
|
||||
def randn_data(self, seed, shape):
|
||||
"""
|
||||
Build a block of testing data from a seeded RandomState.
|
||||
"""
|
||||
return np.random.RandomState(seed).randn(*shape)
|
||||
|
||||
@with_default_shape
|
||||
def eye_mask(self, shape):
|
||||
"""
|
||||
Build a mask using np.eye.
|
||||
"""
|
||||
return ~np.eye(*shape, dtype=bool)
|
||||
|
||||
@with_default_shape
|
||||
def ones_mask(self, shape):
|
||||
return np.ones(shape, dtype=bool)
|
||||
|
||||
|
||||
class EventLoaderCommonMixin(object):
|
||||
@abc.abstractproperty
|
||||
|
||||
Reference in New Issue
Block a user