Help with a basic python error

help plz, @rhyolight and @learner
traceback (most recent call last):
encoding =encode (reader.next())
StopIteration
this is the input data

1 Like

Iā€™m using NuPIC 1.0.5, but your error looks like a problem with your file. Did you edit it? It should have 3 header rows and 4391 rows of data. See here.

2 Likes

Hy @way-sal, I think itā€™d help to see more of your code since Iā€™m not sure how you initialized ā€˜encodeā€™. Iā€™d check how yours lines up with this section of @learnerā€™s document (or the API demo):

record = [ā€˜7/2/10 0:00ā€™, ā€˜21.2ā€™]

Convert date string into Python date object

dateString = dt.strptime(record[0], ā€œ%m/%d/%y %H:%Mā€)

Convert data value string into float

consumption = float(record[1])

To encode, we need to provide numpy arrays for the encoders to populate

timeOfDayBits = np.zeros(timeOfDayEncoder.getWidth())
weekendBits = np.zeros(weekendEncoder.getWidth())
consumptionBits = np.zeros(scalarEncoder.getWidth())

Now we call the encoders to create bit representations for each value

timeOfDayEncoder.encodeIntoArray(dateString, timeOfDayBits)
weekendEncoder.encodeIntoArray(dateString, weekendBits)
scalarEncoder.encodeIntoArray(consumption, consumptionBits)

Concatenate all these encodings into one large encoding

encoding = np.concatenate((timeOfDayBits, weekendBits, consumptionBits))

@learnerand @sheiser1 thanks, i solve those problems but now i have this:
en franƧais
paramĆØtre non valide -15
paramĆØtre non valide -15
ā€˜mvā€™ nā€™est pas reconnu en tant que commande interne ou externe , un fichier excutable ou un fichier de commandes

in english
invalid parameter -15
invalid parameter -15
ā€˜mvā€™ is not recognized as an internal or external command, an executable file or a batch file
maybe the problem that iā€™m on windows not linux -_-

Sure @way-sal no problem. If youā€™d like to show the code producing that error maybe I can help (Iā€™m not sure where -15 should come in as a parameter). Though if its a windows vs linux issue Iā€™ll have to defer

this the code of @learner : https://github.com/psdyer/NuPIC-Algorithm-API-Example/blob/master/algorithm_api_example.ipynb

I notice that he comments before the cell containing that code:

For an extra treat, you can use the code below (on Linux) to make GIFs for the first N records of data.

You said youā€™re on Windows right, so maybe that part wonā€™t work. The block on code seems to produce GIFā€™s, which is cool and likely work doing though not necessary to getting the algorithms running.

1 Like

oops yes, thatā€™s part of code run on Linux and is not necessary so I delete

the same error ::

That specific RuntimeError is saying that it is missing an environment variable called ā€˜USERā€™. You might try setting it to some value to see if you can get any further:

SET USER=dell

(I donā€™t really use Windows much myself, so this may not be very helpful)

no is not working :frowning:

Do you get the same error about the environment variable ā€˜USERā€™ not being defined, or some different error?

If it is the same error, then someone more familiar with Windows will have to help. I saw a similar error about missing environment variable ā€˜USERā€™ when installing NuPIC from source in Docker, but in my case it was resolved after setting the environment variable.

thanks @learner is very helpful , but what version of nupic do you use ? because i have a problem of modules , maybe my version of nupic canā€™t read some under moduls

any idea ???

Given the error, it looks like you need to define the USER environment variable. What is the code inside C:\Users\dell\Desktop\tests\moduls.py?

its your code :https://github.com/psdyer/NuPIC-Algorithm-API-Example/blob/master/algorithm_api_example.ipynb
and the other one is taken from :http://nupic.docs.numenta.org/1.0.5/quick-start/algorithms.html
pffff the same problemin configuration_base.py

Try running these two lines of code from a fresh command line.

>> from nupic.algorithms.sdr_classifier_factory import SDRClassifierFactory
>> classifier = SDRClassifierFactory.create(steps=[1], alpha=0.01)

If you get an error there, then thereā€™s something wrong with your setup.

1 Like

yes the same problem

Iā€™m at a loss then. Iā€™ve only ever run NuPIC on Linux and Mac, and since this looks like a setup issue, Iā€™m guessing something special has to be done in Windows. I suggest reading through the forum for NuPIC+Windows topics and see if thereā€™s something youā€™re missing.

I donā€™t want to break your system, but as a hack you could try setting the USER variable to something/anything. Iā€™m sure a quick google will show you how to do that.

2 Likes

ok thanks @learner , i will try that