3D np.array normalization

    0

    0

    The code calculates the shape of the dataset, then reshapes it so that it has the same number of samples and rows as the input dataset.

    Library: numpy

    from sklearn import preprocessing
    
    samples_count, rows_count, columns_count = dataset.shape
    dataset = dataset.reshape((samples_count, rows_count * columns_count))
    dataset = preprocessing.StandardScaler().fit_transform(dataset)
    dataset = dataset.reshape(samples_count, rows_count, columns_count)
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.