Is it possible to calculate the size of a model ( let's say a Random Forest classifier ) in scikit-learn?
For example:
from sklearn.ensemble import RandomForestClassifier clf = RandomForestClassifier(n_jobs=-1, n_estimators=10000, min_samples_leaf=50) clf.fit(self.X_train, self.y_train)
Can I determine the size of clf
?
Along the same lines as Nijan's answer, you can also do it without having to save the model, using pickle:
import pickle
import sys
p = pickle.dumps(clf)
print(sys.getsizeof(p))
It will return the size in bytes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With