Skip to content

Error while executing the example code of Learning Vector Quantization  #37

@martinrioux

Description

@martinrioux

From this page: https://pythonhosted.org/neurolab/ex_newlvq.html
Using numpy 1.13.3 and neurolab 0.3.5
The error message I got was:

Traceback (most recent call last):
  File "learning_vector.py", line 20, in <module>
    net = nl.net.newlvq(nl.tool.minmax(input), 4, [.6, .4])
  File "/usr/local/lib/python2.7/dist-packages/neurolab/net.py", line 179, in newlvq
    layer_out.np['w'][n][st:i].fill(1.0)
TypeError: slice indices must be integers or None or have an __index__ method

I fixed the issue by editing the neurolab/net.py and changing the line 127 from
layer_out.np['w'][n][st:i].fill(1.0)
to
layer_out.np['w'][n][int(st):int(i)].fill(1.0)

Thanks!

Martin Rioux

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