UdiBhaskar / Human-Activity-Recognition--Using-Deep-NN

Human Activity Recognition Using Deep Learning
48 stars 22 forks source link

throw some more light on the code #1

Open ariyurjana opened 4 years ago

ariyurjana commented 4 years ago
    def fit(self, X):
        # remove overlaping
        remove = int(X.shape[1] / 2)
        temp_X = X[:, -remove:, :]

Can you explain a bit more briefly as to why we are performing the above code ?

regards jana

atomtony commented 3 years ago

What version of python?

ariyurjana commented 3 years ago

Hi,

from sklearn.base import BaseEstimator, TransformerMixin
class scaling_tseries_data(BaseEstimator, TransformerMixin):
    from sklearn.preprocessing import StandardScaler
    def __init__(self):
        self.scale = None

    def transform(self, X):
        temp_X1 = X.reshape((X.shape[0] * X.shape[1], X.shape[2]))
        temp_X1 = self.scale.transform(temp_X1)
        return temp_X1.reshape(X.shape)

    def fit(self, X):
        # remove overlaping
        remove = int(X.shape[1] / 2)
        temp_X = X[:, -remove:, :]
        # flatten data
        temp_X = temp_X.reshape((temp_X.shape[0] *

temp_X.shape[1], temp_X.shape[2])) scale = StandardScaler() scale.fit(temp_X)

saving for furter usage

        ## will use in predicton pipeline
        pickle.dump(scale,open('Scale_2class.p','wb'))
        self.scale = scale
        return self

My question is regarding these two lines

        remove = int(X.shape[1] / 2)
        temp_X = X[:, -remove:, :]

I understand that you are trying to split the data into two datasets, but why is this required.

regards

On Fri, Oct 30, 2020 at 2:59 PM atomtony notifications@github.com wrote:

What version of python

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/UdiBhaskar/Human-Activity-Recognition--Using-Deep-NN/issues/1#issuecomment-719444909, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJFPWC2MMV4DBWE7F7HKXXLSNKBQRANCNFSM4KFGQSEQ .