I have an anomaly detection model, that I run per store with a bunch of features. I intend to run this code, everyday, per store. Now, lets say I have 8000 stores, I would imagine, I should write a for loop and iterate and create the model per store:

final is the dataframe that consists of all the stores

Something like:

for store in final['StoreNbr'].unique():
   run the model. 

My input features include: Store number, Cashier, etcc (many other features). Can I use one hot encoding for the StoreNbr column and then run the model once as opposed to a for loop and running the model per storenbr?

  • $\begingroup$ So if I understand well you want to run a new model every day, one model per store? And use each day the past training data plus the new data of the day ? $\endgroup$ May 12, 2020 at 15:51
  • $\begingroup$ Yes I want to run a new model every day per store. For a day's run. I dont need the old day data. So, If I run something today - run per day per store and get the results to the user. Second day - pick up data for second day - run per store the model for that day and get the users the results. $\endgroup$ May 12, 2020 at 18:44

1 Answer 1


If you want to train the data each day and have a new model per store and per day, you should not use One Hot Encoding. If you do One Hot Encoding you will get one single trained model which will learn from the data you have in all the stores. I suppose you do not want one trained model but one model for each store.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.