Connect to MySQL server

Hi, everyone, I’ve gone through a lot of forum posts on setting up the MySQL server for swarm, but they all did not help with my problem.

  1. I configured nupic on Win10 follow this link:
    and when it comes to these steps

    I do not have a folder named nupic inside C:\Python27-x64\Lib\site-packages
    So I created nupic\support, and put in the nupic-default.xml copied from this link:

As suggested by rhyolight in another post, I made a copy of this file, renamed it as nupic-site.xml and updated the server password.

When I run it shows:
OperationalError: (2003, 'Can\'t connect to MySQL server on \'localhost\' ((1045, u"Access denied for user \'root\'@\'localhost\' (using password: NO)"))')

I tested the password and I am able to login to MySQL server thru the cmd line.

Does anyone know what’s going on?

I know it’s not suggested to run swarm, but I kind of need to modify the HotGym example to do my project. If it’s not solvable, anyone has any suggestion on how to bypass swarm to get HotGym prediction and anomaly detection run?

Thanks a lot.


Hey @VeraQing, welcome!

So swarming does nothing but create a model config that’s optimized for predicting a particular field (‘feature’ or ‘variable’ to use more general ML terms) given a particular data set. As described here, this params file for hot gym already exists: nupic/examples/opf/clients/hotgym/prediction/one_gym at master · numenta/nupic · GitHub

This model_params py file is imported by the run script here, and used to initialize a nupic model: nupic/ at master · numenta/nupic · GitHub

Once the nupic model has been initialized, it can receive data in an online fashion row by row. Importantly the data file must be compatible with the model_params, so if the model is expecting columns ‘x’ & ‘y’ from the params and receives data with columns ‘a’ & ‘b’ it won’t work.

The other big thing I’ve found is that the encoding parameters within the model_params should match the data. So if you’re using a simple scalar encoder with min/max = 0/100 and the actual data only range from 0-1, the outputs of the model will be mostly meaningless because the parameters are mis-scoped.

For anomaly detection the model_params will be slightly different. The key difference there is the inferenceType must be TemporalAnomaly instead of MultiStep or anything else.

I think this readme is a bit out of date with the Multistep inferenceType, here are the ones supported by the htm_prediction_model class here:

Hope this helps!

1 Like

Thank you so much for your help, Sam!

I have already gone through the HotGym example in the repository, it helps a lot.

If I were to use the exact same model from the example for another dataset, which has a similar pattern with the hot gym power consumption data, they should be working okay? Or I should make adjustments manually on the model_param?

I’m sorry for the very basic questions. I’m an undergrad rushing for my final project and kind of overwhelmed by HTM. Thanks again for your help!

1 Like

I would definitely adapt the model params to the other data set. If the distributions aren’t very similar you could get junk. You could just take the 5th & 95th percentiles of the metrics and use those for the encoder min/max values – or something simple like that.

Since HTM models are online learning a new model object will form and be continuously updated with each new row from your data set.

No problem! I wish I’d gotten in HTM that early!

I tried to run the with put in the .\model_params dir.

It gives me error saying
Exception: No model params exist for 'rec-center-hourly'. Run swarm first!

I went through the and code and I think the file name or path should be correct. Why is this so hard. :dizzy_face:

If anyone ran this Hot Gym example successfully recently, pls send help!

1 Like

Looks like its failing on the importlib. I suspect there’s a wrong character somewhere in the name such that the params paths doesn’t technically exist:

What you could also do is just paste the 'MODEL_PARAMS" dict from the file into the file, and pass it to the createModel function:

There’s no reason the params dict has to be imported if its already in the file, so you can just bypass the getModelParamsFromName function entirely.


Thanks again! I’ve finally got all these working!