FileNotFoundError after validation
Opened this issue · 6 comments
I got the error after validation.
Here is the code.
import pandas as pd
from sklearn.datasets import load_diabetes
from sklearn.model_selection import train_test_split
from pylightgbm.models import GBMClassifier
from sklearn.metrics import roc_auc_score
diabetes = load_diabetes()
split_ind = 200
X = diabetes['data']
y = diabetes['target']
X = pd.DataFrame(X).add_prefix('c')
y = pd.Series(y)
y = (y>150)*1
X_train, X_test = X[:split_ind], X[split_ind:]
y_train, y_test = y[:split_ind], y[split_ind:]
exec = "~/LightGBM/lightgbm"
clf = GBMClassifier(exec_path=exec,
num_iterations=3000,
metric='auc',
early_stopping_round=20)
clf.fit(X_train, y_train,
test_data=[(X_test, y_test)])
clf.param['num_iterations'] = clf.best_round # Also .set_params wouldn't work
clf.fit(X_train, y_train)
The second 'clf.fit' occurs 'FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/~', since in 'def fit' the 'with process.stdout:' does not write LightGBM_model.
Same error when using early_stopping_round and test_data.
For the time being, you should re create the model each time you want to use it. Hope to fix this soon.
Thanks for the feedback guys,
@KazukiOnodera, what is your OS ?
I ran your example (just changed path to lightgbm) and it works (I am on Ubuntu).
I'm on OSX(mac).
I am on Win 10, I found the same error "'FileNotFoundError: [Errno 2] No such file or directory"
@zhengz3000 Use the official Python package https://github.com/Microsoft/LightGBM/