In LDA model generates different topics everytime i train on the same corpus , by setting the np.random.seed(0)
, the LDA model will always be initialized and tr
Just a remark on the randomness.
If one is working with gensim's W2V model and is using Python version >= 3.3, keep in mind that hash randomisation is turned on by default. If you're seeking consistency between two executions, make sure to set the PYTHONHASHSEED
environment variable. E.g. when running your code like so
PYTHONHASHSEED=123 python3 mycode.py
, next time you generate a model (using the same hash seed) it would be the same as previously generated model (provided, that all other randomness control steps are followed, as mentioned above - random state and single worker).
See gensim's W2V source and Python docs for details.