# Path: percept/fields/base.py
# class List(ValueField):
#     """
#     Store lists
#     """
#     default = []
# 
# class Complex(ValueField):
#     """
#     Store complex objects, such as classes
#     """
#     def to_json(self, value):
#         return pickle.dumps(value)
# 
#     def from_json(self, value):
#         try:
#             new_value = pickle.loads(value)
#         except Exception:
#             log.exception("Could not unpickle value. : {0}".format(value))
#             new_value = None
#         return new_value
# 
# Path: percept/conf/base.py
# class Settings(object):
#     def _initialize(self, settings_module):
#     def _setup(self):
#     def __getattr__(self, name):
#     def _configure_logging(self):
#     def configured(self):
# 
# Path: percept/utils/models.py
# class RegistryCategories(object):
#     """
#     Define valid registry categories
#     """
#     base = "base"
#     preprocessors = "preprocessors"
#     inputs = "inputs"
#     formatters = "formatters"
#     algorithms = "algorithms"
#     workflows = "workflows"
# 
# Path: percept/tests/framework.py
# class NormalizationTester(Tester):
#     test_case_format = {'stream' : basestring, 'dataformat' : basestring}
# 
#     def test(self, **kwargs):
#         super(NormalizationTester, self).test(**kwargs)
#         stream = kwargs.get('stream')
#         dataformat = kwargs.get('dataformat')
#         inst = self.cls()
#         output_format = inst.data_format
#         data = self.read_and_reformat(output_format, stream, dataformat)
# 
#         inst.train(data.copy())
#         assert len(inst.column_means)>0
#         assert len(inst.column_stdevs)>0
# 
#         prediction = inst.predict(data)
#         equal_cells = int(sum((prediction == inst.data).unstack()))
#         cell_count = prediction.unstack().shape[0]
#         assert equal_cells == cell_count
# 
# Path: percept/utils/input.py
# class DataFormats(object):
#     """
#     Define acceptable data formats
#     """
#     csv = "csv"
#     dataframe = "dataframe"


from base import Task
from percept.fields.base import List, Complex
from percept.conf.base import settings
from percept.utils.models import RegistryCategories
from percept.tests.framework import NormalizationTester
from percept.utils.input import DataFormats
import numpy as np
import os
import logging
"""
Preprocess data before sending to algorithms
"""

from __future__ import division

log = logging.getLogger(__name__)

class Normalize(Task):
    """
    Normalize values by reducing standard deviation to 1 and mean to 0
    """
    column_means = List()

# Path: percept/fields/base.py
# class List(ValueField):
#     """
#     Store lists
#     """
#     default = []
# 
# class Complex(ValueField):
#     """
#     Store complex objects, such as classes
#     """
#     def to_json(self, value):
#         return pickle.dumps(value)
# 
#     def from_json(self, value):
#         try:
#             new_value = pickle.loads(value)
#         except Exception:
#             log.exception("Could not unpickle value. : {0}".format(value))
#             new_value = None
#         return new_value
# 
# Path: percept/conf/base.py
# class Settings(object):
#     def _initialize(self, settings_module):
#     def _setup(self):
#     def __getattr__(self, name):
#     def _configure_logging(self):
#     def configured(self):
# 
# Path: percept/utils/models.py
# class RegistryCategories(object):
#     """
#     Define valid registry categories
#     """
#     base = "base"
#     preprocessors = "preprocessors"
#     inputs = "inputs"
#     formatters = "formatters"
#     algorithms = "algorithms"
#     workflows = "workflows"
# 
# Path: percept/tests/framework.py
# class NormalizationTester(Tester):
#     test_case_format = {'stream' : basestring, 'dataformat' : basestring}
# 
#     def test(self, **kwargs):
#         super(NormalizationTester, self).test(**kwargs)
#         stream = kwargs.get('stream')
#         dataformat = kwargs.get('dataformat')
#         inst = self.cls()
#         output_format = inst.data_format
#         data = self.read_and_reformat(output_format, stream, dataformat)
# 
#         inst.train(data.copy())
#         assert len(inst.column_means)>0
#         assert len(inst.column_stdevs)>0
# 
#         prediction = inst.predict(data)
#         equal_cells = int(sum((prediction == inst.data).unstack()))
#         cell_count = prediction.unstack().shape[0]
#         assert equal_cells == cell_count
# 
# Path: percept/utils/input.py
# class DataFormats(object):
#     """
#     Define acceptable data formats
#     """
#     csv = "csv"
#     dataframe = "dataframe"


# Path: percept/tasks/preprocess.py
from base import Task
from percept.fields.base import List, Complex
from percept.conf.base import settings
from percept.utils.models import RegistryCategories
from percept.tests.framework import NormalizationTester
from percept.utils.input import DataFormats
import numpy as np
import os
import logging

"""
Preprocess data before sending to algorithms
"""

from __future__ import division

log = logging.getLogger(__name__)

class Normalize(Task):
    """
    Normalize values by reducing standard deviation to 1 and mean to 0
    """
    column_means = List()

    column_stdevs = List()