0
forest = RandomForestRegressor(n_estimators=1000,
                               criterion='mse')
forest.fit(X_train, y_train)

The forest model stored above

import joblib 
file_name = 'mormalize.pkl' 
joblib.dump(forest, file_name) 

I saved it using the code above.

I'm gonna bring this up.

model_name = 'C:\\myenv\\object_01.pkl'
forest=joblib.load(model_name)
y_pred = forest.predict(df)

used as . In the process of making this file an exe file using the phystaller,

enter image description here

As shown in the image above, the problem of importing unused files (used in the model) continued. Results brought up using hidden import The capacity of the exe file exceeded 3GB when three sklear modules were loaded. Still requesting import.

The prompt to add hidden import in the spec answered in the other questions does not work.

How can I make an exe file? Also, could you recommend another module if it's the limit of the pyintaller?

desertnaut
  • 57,590
  • 26
  • 140
  • 166
  • Failing to install a package (even if it's an ML one) is not actually a `machine-learning` or `artificial-intelligence` question - kindly do not spam irrelevant tags (removed). – desertnaut Oct 05 '20 at 09:36

1 Answers1

1

One of the output of

pyinstaller file.py 

is file.spec. What I have done in order to solve this is actually editing the spec file and added the following to top:

from PyInstaller.utils.hooks import collect_submodules

and in the Analysis I added the following line:

hiddenimports=collect_submodules('sklearn'),

after that you should runt the following command in the command line:

pyinstaller file.spec

I hope this is clear enough.

Pr0digy
  • 29
  • 2
  • The problem has been resolved! But it's still heavy. It's probably because it's not a virtual environment, so I think it's because I dragged all the modules. Thank you very much for your reply! – moobaek Oct 07 '20 at 00:08