import tensorflow as tf
import numpy as np
import argparse
import pandas as pd
from collections import namedtuple
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
import s3fs
from sys import getsizeof
import time
from scipy.sparse import csr_matrix
import sys
import gc
import tracemalloc
from scipy import sparse

from collections import namedtuple
# from Model.saveFeature2S3 import saveFeature2S3

class StandardScaler:
    """
    Standard the input
    """

    def __init__(self, mean, std):
        self.mean = mean
        self.std = std

    def transform(self, data):
        if data.shape != self.mean.shape:
            self.mean = np.expand_dims(self.mean, axis=-1)
            self.std = np.expand_dims(self.std, axis=-1)
        return (data - self.mean) / (self.std + 1e-12)

    def inverse_transform(self, data):
        return (data * self.std) + self.mean


class preprocessing():
    def __init__(self, **args):
        print("-----*****INIT****------")
        # super(SequenceDataLoader, self).__init__()
        # 获取 s3数据
        dataset_dir = args['dataset_dir']
        # dataset_dir = args.data_input.split(',')[0]
        seq_length = args['seq_length']
        print('seq_length is :', seq_length)
        print('dataset_dir is :', dataset_dir)

        self._data = self.generate_train_val(dataset_dir, seq_length)

    def missing_data_impute(self,args):
        pass

    def data_denoise(self,args):
        pass

    def zeros_padding(self,args):
        pass

    def data_split(self,args):
        pass
