以下のプログラムで、「axis 1 is out of bounds for array of dimension 1」というエラーが出ます。恐らくaxisの指定が誤っているのかと思いますが、どのよう
以下のプログラムで、
「axis 1 is out of bounds for array of dimension 1」というエラーが出ます。
恐らくaxisの指定が誤っているのかと思いますが、どのように修正すればよいのでしょうか?
お詳しい方、ご指導よろしくお願いいたします。
# 未知データの読み込み
df1 = pd.read_excel('test_base_2_未知.xlsx',sheetname='未知')## 未知データのエクセル読み込み
x_test_keras_1 = np.array(df1)
## データを標準化
x_test_keras_1_std = stdsc.fit_transform(x_test_keras_1)
# 未知データをロードした学習済モデルで予測
y_test_keras_1_std =grid.predict(x_test_keras_1_std)
# 予測値をインデックス(0,1)に変換
Survived = np.argmax(y_test_keras_1_std, axis=1)
print(Survived)
---------------------------------------------------------------------------
AxisError Traceback (most recent call last)
<ipython-input-56-cd06f22ac336> in <module>
12
13 # 予測値をインデックス(0,1)に変換
---> 14 Survived = np.argmax(y_test_keras_1_std, axis=1)
15 print(Survived)
~\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py in argmax(a, axis, out)
1101
1102 """
-> 1103 return _wrapfunc(a, 'argmax', axis=axis, out=out)
1104
1105
~\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py in _wrapfunc(obj, method, *args, **kwds)
54 def _wrapfunc(obj, method, *args, **kwds):
55 try:
---> 56 return getattr(obj, method)(*args, **kwds)
57
58 ## An AttributeError occurs if the object does not have
AxisError: axis 1 is out of bounds for array of dimension 1
Static code analysis is a method of debugging by examining source code before a program is run. It's done by analyzing a set of code against a set (or multiple sets) of coding rules. Static code analysis and static analysis are often used interchangeably, along with source code analysis.
There are more code smells. Let’s keep changing the aromas. We see several symptoms and situations that make us doubt the quality of our development. Let's look at some possible solutions.
In this video, I'll be talking about when do I think code is ready to be sold. 🔴 Subscribe for more https://www.youtube.com/channel/UCMA8gVyu_IkVIixXd2p18NQ?...
The story of Softagram is a long one and has many twists. Everything started in a small company long time ago, from the area of static analysis tools development. After many phases, Softagram is focusing on helping developers to get visual feedback on the code change: how is the software design evolving in the pull request under review.
We, at Analytics India Magazine, spoke to founder and CEO, Vishal Rai, to understand how Embold can detect anti-patterns in code for seamless integration. Embold started a decade ago, with the vision of creating a product that can revolutionise the way developers write and design code.