yandex / rep

Machine Learning toolbox for Humans
http://yandex.github.io/rep/
Other
687 stars 144 forks source link

Problem with TMVAClassifier #38

Closed HolyBayes closed 9 years ago

HolyBayes commented 9 years ago

After REP installation from here, I've met the following problem with TMVAClassifier fitting: I'm trying to train TMVAClassifier, and IOError raises after following strings: " baseline = TMVAClassifier(method='kBDT', features=variables, BoostType='Grad', NTrees=40, Shrinkage=0.01, MaxDepth=7, UseNvars=6, nCuts=-1) features=variables)

baseline.fit(train, train['signal'])"

Stacktrace is next: IOError Traceback (most recent call last) in () 3 UseNvars=6, nCuts=-1) 4 # baseline = TMVAClassifier(method='kBDT', NTrees=50, Shrinkage=0.05, features=variables) ----> 5 baseline.fit(train, train['signal'])

/usr/local/lib/python2.7/dist-packages/rep-0.6.3-py2.7.egg/rep/estimators/tmva.pyc in fit(self, X, y, sample_weight) 288 self.factory_options = '{}:AnalysisType=Multiclass'.format(self.factory_options) 289 --> 290 return self._fit(X, y, sample_weight=sample_weight) 291 292 def predict_proba(self, X):

/usr/local/lib/python2.7/dist-packages/rep-0.6.3-py2.7.egg/rep/estimators/tmva.pyc in _fit(self, X, y, sample_weight, model_type) 104 add_info = _AdditionalInformation(directory, model_type=model_type) 105 try: --> 106 self._run_tmva_training(add_info, X, y, sample_weight) 107 finally: 108 self._remove_tmp_directory(directory)

/usr/local/lib/python2.7/dist-packages/rep-0.6.3-py2.7.egg/rep/estimators/tmva.pyc in _run_tmva_training(self, info, X, y, sample_weight) 134 xmlfilename = os.path.join(info.directory, 'weights', 135 '{job}{name}.weights.xml'.format(job=info.tmva_job, name=self._method_name)) --> 136 with open(xml_filename, 'r') as xml_file: 137 self.formula_xml = xml_file.read() 138

IOError: [Errno 2] No such file or directory: '/home/artem/Documents/IPython Notebooks/CERN + Yandex/Original Baseline/flavours-of-physics-start/tmp0Fhtqe/weights/TMVAEstimation_REP_Estimator.weights.xml'

As I found, weights/ folder was created outside of temporary folder instead created inside in last one. It causes the error above.

ROOT 5.34, Python 2.7, GCC 4.8, Ubuntu 14.04 LTS (x64). All requirenments for REP were installed successfully (from requirenments.txt)

tlikhomanenko commented 9 years ago

Can you run in the same notebook the following code:

import tempfile
import os
name = tempfile.mkdtemp(dir=os.getcwd())

and then in other cell:

!cd $name

I want to check that process has access to the temporary folder.

HolyBayes commented 9 years ago

The result is: /bin/sh: 1: cd: can't cd to /home/artem/Documents/IPython

tlikhomanenko commented 9 years ago

Run:

!ls -la /home/artem/Documents/

!whoami
HolyBayes commented 9 years ago

ls -la /home/artem/Documents/ works OK. IPython was launched from admin user, but admin not in sudo group.

tlikhomanenko commented 9 years ago

Write output of ls -la /home/artem/Documents/ to see the rights of /home/artem/Documents/IPython

HolyBayes commented 9 years ago

итого 13172 drwxr-xr-x 5 artem artem 4096 сент. 27 16:27 ./ drwxr-xr-x 27 artem artem 4096 сент. 27 15:26 ../ -rw-r----- 1 artem artem 2326130 сент. 15 18:37 EkmanPol_PsihologiyaLzhi.pdf -rw-r----- 1 artem artem 3829480 сент. 17 13:41 evaluating-machine-learning-models.pdf drwx------ 4 artem artem 4096 сент. 8 21:49 IPython Notebooks/ -rw-r----- 1 artem artem 3144056 сент. 11 19:43 K_V_Vorontsov_Mat_metody_obuchenia_po_pretsede.pdf drwxrwxr-x 3 artem artem 4096 сент. 27 14:31 SHAD/ -rw-r----- 1 artem artem 4147233 сент. 15 18:37 Telling Lies - Clues to Deceit in the Marketplace, Politics, and Marriage.pdf drwxrwxr-x 3 artem artem 4096 сент. 27 16:27 tmp/

tlikhomanenko commented 9 years ago

The problem is your path: IPython Notebooks/. It contains space, that is why command 'cd {folder}' doesn't work, and weights is created outside the temp folder.

Thanks, will fix this error in next release.

At this moment, rename this folder without spaces, or move starter kit notebooks into other place.

HolyBayes commented 9 years ago

Ok, thanks!

tlikhomanenko commented 9 years ago

this bug is fixed in commit 1ac0a59cc3c568646fbf360c3dc0b62a63471090