日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python predict y和x是必须一致吗_数据科学python错误 - ValueError:x和y必须具有相同的第一维...

發(fā)布時間:2024/9/15 python 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python predict y和x是必须一致吗_数据科学python错误 - ValueError:x和y必须具有相同的第一维... 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

對于背景,我計算了一組sample_means,每個樣本大小200次。然后,我計算每個樣本大小的平均值和標準偏差,然后將其存儲在數(shù)組中。這是我的代碼:

in[] =

sample_sizes = np.arange(1,1001,1)

number_of_samples = 200

mean_of_sample_means = []

std_dev_of_sample_means = []

for x in range (number_of_samples):

mean_of_sample_means.append(np.mean(sample_sizes))

std_dev_of_sample_means.append(np.std(sample_sizes))

in[] = # mean and std of 200 means from 200 replications, each of size 10

trials[0], mean_of_sample_means[0], std_dev_of_sample_means[0]

out[] = (10, 500.5, 288.67499025720952)

現(xiàn)在我想要繪制具有以下輸入數(shù)據(jù):

plt.plot(sample_sizes, mean_of_sample_means);

plt.ylim([0.480,0.520]);

plt.xlabel("sample sizes")

plt.ylabel("mean probability of heads")

plt.title("Mean of sample means over 200 replications");

然而,當我這樣做,我拋出了以下錯誤:

242 if x.shape[0] != y.shape[0]:

243 raise ValueError("x and y must have same first dimension, but "

--> 244 "have shapes {} and {}".format(x.shape, y.shape))

245 if x.ndim > 2 or y.ndim > 2:

246 raise ValueError("x and y can be no greater than 2-D, but have "

ValueError: x and y must have same first dimension, but have shapes (1000,) and (200,)

關于我要去哪里的錯誤?我覺得它可能很明顯,我沒有看到,因為我是新手。任何幫助,將不勝感激!!

+0

嗨,你能嘗試編輯代碼,以實際代碼你用來生成'ValueError'?包括所有模塊導入和變量定義(例如'trials' does not exist) –

+1

我認為相同,但我認為從筆記本粘貼的OP副本 –

+0

我認為你的'mean_of sample_means'將有一個常數(shù)條目500.5所有200人。與'std_dev_of_sample_means'相同,它將成為288.67499025720952 –

總結

以上是生活随笔為你收集整理的python predict y和x是必须一致吗_数据科学python错误 - ValueError:x和y必须具有相同的第一维...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。