Skip to content

The index goes beyond int32 (индекс выходит за рамки int32). #1

@GenKlim

Description

@GenKlim

English:

Everything is fine in the method, but I found a small hitch in line 90:
current_index[:, 1] = np.random.randint(0,100000000000)
It needs to be changed to:
current_index[:, 1] = np.random.randint(0, 2**31 - 1)
, so that no more errors appear in the attachment (about going beyond the int32 boundaries).

Original:

В методе всё нормально, однако нашёл небольшую заминку в строке 90:
current_index[:, 1] = np.random.randint(0,100000000000)
Её нужно поменять на:
current_index[:, 1] = np.random.randint(0, 2**31 - 1)
, чтобы больше не появлялось ошибки во вложении (по поводу выхода за границы int32).

Attachment (вложение):

  File "…\gmeans.py", line 90, in _recursiveClustering
    current_index[:, 1] = np.random.randint(0,100000000000)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "numpy\\random\\mtrand.pyx", line 796, in numpy.random.mtrand.RandomState.randint
  File "numpy\\random\\_bounded_integers.pyx", line 2881, in numpy.random._bounded_integers._rand_int32
ValueError: high is out of bounds for int32

Надеюсь, я смог как-то помочь (I hope I was able to help in some way)!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions