resampling data - using SMOTE from imblearn with 3D numpy arrays

前端 未结 3 1888
别跟我提以往
别跟我提以往 2021-01-25 06:02

I want to resample my dataset. This consists in categorical transformed data with labels of 3 classes. The amount of samples per class are:

  • counts of class A: 6945
3条回答
  •  盖世英雄少女心
    2021-01-25 06:28

    I am considering a dummy 3d array and assuming a 2d array size by myself,

    arr = np.random.rand(160, 10, 25)
    orig_shape = arr.shape
    print(orig_shape)
    

    Output: (160, 10, 25)

    arr = np.reshape(arr, (arr.shape[0], arr.shape[1]))
    print(arr.shape)
    

    Output: (4000, 10)

    arr = np.reshape(arr, orig_shape))
    print(arr.shape)
    

    Output: (160, 10, 25)

提交回复
热议问题