I need to know what is the memory usage of my Machine Learning model. I am using memit from memory_profiler as follows.
from memory_profiler import profile
from memory_profiler import memory_usage
def MLmodel (X_train, y_train):
model = linearregression ()
model.fit(X_train,Y_train)
return model
trainmemory = % memit -o MLmodel (X_train, y_train)
the result is:
peak memory: 458.21 MiB, increment: 0.00 MiB
now I want to get a dictionary like this:
dic_memory = {'peak memory': 458.21 MiB, 'increment': 0.00 MiB }
I do not know how can I get the peak memory and increment separately and put them in a dictionary.