簡體   English   中英

將輸入和 output 數組重塑為固定大小

[英]Reshape the input and output array into fix size

我的數據有兩個 arrays 輸入為x和 output y示例如下所示:

   x (100,1)      y(100,1)
   0          
-1.04949            0
0.878099            1
0.959288            0
-1.18013            1
-0.907318           0

重塑后(覆蓋成二維)

x_new = numpy.reshape(x, (-1,2))

y_new = numpy.reshape(y, (-1,2))
x (50,2)     y(50,2)
0.878644    0.895511
1.03967     1.12062
1.06041     1.37661
1.18948     0.788018

我面臨的問題:

  • 將 y 列y(50,2)重塑為y(50,1) 總體所需的 output 將是:

    x (50,2) y(50,1)

您無法將 100 x 1 的數組轉換為 50 x 1。您可以將其拆分為 50 x 1 的兩個 arrays 並選擇兩者之一和 output。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM