小编iMa*_*rix的帖子

TypeError:“ float”对象无法解释为索引

我遇到的问题以前从未发生过,也许某些规则已更改。

    Traceback (most recent call last)
    <ipython-input-3-f47687e192a7> in <module>()
          5 n_examples = X.shape[0]
          6 n_train = n_examples * 0.5
    ----> 7 train_idx = np.random.choice(range(0,n_examples), size=n_train, replace=False)
          8 test_idx = list(set(range(0,n_examples))-set(train_idx))
          9 X_train = X[train_idx]

    mtrand.pyx in mtrand.RandomState.choice (numpy/random/mtrand/mtrand.c:18822)()

    TypeError: 'float' object cannot be interpreted as an index
Run Code Online (Sandbox Code Playgroud)

python deep-learning keras

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

deep-learning ×1

keras ×1

python ×1