0

random.uniform(low=0.0, high=100.0, size=(150,150))配列を生成しています。これを、 、、および
を生成する関数に入力します。Xxy

ただし、ランダム テスト マトリックスが 100 より大きい場合、以下のエラーが発生します。
シータ値をいじってみました。

誰かがこの問題を抱えていますか?これはバグですか?
私はpython2.6scikit-learn-0.10を使用しています。python3を試す必要がありますか?

提案やコメントは大歓迎です。

ありがとうございました。

gp.fit( XKrn, yKrn )
  File "/usr/lib/python2.6/scikit_learn-0.10_git-py2.6-linux-x86_64.egg/sklearn/gaussian_process/gaussian_process.py", line 258, in fit
    raise ValueError("X and y must have the same number of rows.")
ValueError: X and y must have the same number of rows.
4

2 に答える 2

3

ValueError: X and y must have the same number of rows.あなたの場合XKrn.shape[0]は に等しいことを意味しますyKrn.shape[0]。データセットを生成するコードにエラーがある可能性があります。

これが実際の例です:

In [1]: from sklearn.gaussian_process import GaussianProcess

In [2]: import numpy as np

In [3]: X, y = np.random.randn(150, 10), np.random.randn(150)

In [4]: GaussianProcess().fit(X, y)
Out[4]: 
GaussianProcess(beta0=None,
        corr=<function squared_exponential at 0x10d42aaa0>, normalize=True,
        nugget=array(2.220446049250313e-15), optimizer='fmin_cobyla',
        random_start=1,
        random_state=<mtrand.RandomState object at 0x10b4c8360>,
        regr=<function constant at 0x10d42a488>, storage_mode='full',
        theta0=array([[ 0.1]]), thetaL=None, thetaU=None, verbose=False)

Python 3 はまだサポートされておらず、現時点で scikit-learn の最新リリース バージョンは 0.12.1 です。

于 2012-11-13T23:16:12.377 に答える