Mljar python wrapper api "no such file or directory" error

Question:

I’m getting Ups, [Errno 2] No such file or directory error when I try to fit models using the python wrapper for the mljar api.

Does anyone know how to fix this?

The code:

from sklearn import datasets

iris = datasets.load_iris()
X, y = iris.data, iris.target

from sklearn.cross_validation import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5)

from mljar import Mljar

models = Mljar(
    project='MLJAR api test', experiment='Iris',
    metric='logloss',
    validation_kfolds=5, # we will use 5-fold CV with stratify and shuffle
    validation_shuffle=True,
    validation_stratify=True,
    algorithms=['xgb', 'lgb', 'mlp'], # select Xgboost, LightGBM and Neural Network
    tuning_mode='Normal', # number of models to be checked for each algorithm
    single_algorithm_time_limit=5
)

models.fit(X_train, y_train)

For some reason, there is no traceback. I just get the error:
Ups, [Errno 2] No such file or directory: /tmp/dataset-002317be.csv

Asked By: Victor Valente

||

Answers:

I just figured it out.

This is part of the python api wrapper code at C:UsersusernameAppDataLocalContinuumanaconda2Libsite-packagesmljarclientdataset.py

def add_new_dataset(self, data, y, title_prefix = 'dataset-'):
    [...]
    file_path = '/tmp/dataset-'+ str(uuid.uuid4())[:8]+'.csv'
    [...]
    data.to_csv(file_path, index=False)

It tries to create the dataset file at /tmp but the directory doesn’t exist.
In my opinion, the best way to solve this is to create a tmp folder at the root of your current drive.
In my case, this is shared network drive, in which there was no /tmp folder.

I also found the part of the code responsible for the missing traceback:
C:UsersusernameAppDataLocalContinuumanaconda2Libsite-packagesmljarmljar.py

except Exception as e:
    print 'Ups, %s' % str(e)
Answered By: Victor Valente
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.