Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model learning result is not found #13

Closed
finlay-liu opened this issue Mar 12, 2017 · 9 comments
Closed

Model learning result is not found #13

finlay-liu opened this issue Mar 12, 2017 · 9 comments

Comments

@finlay-liu
Copy link

Hi fukatani,

I install rfg, and then alter the loc_exec/loc_temp path in rgf.py,
when i use rgf_python, it can use fit(), but can not use rgf.predict() or rgf.score(), the error msg is :

/usr/local/lib/python2.7/dist-packages/rgf_sklearn-0.0.1-py2.7.egg/rgf/rgf.pyc in predict_proba(self, X)
    357         model_glob = loc_temp + os.sep + self.file_prefix + "*"
    358         if not glob(model_glob):
--> 359             raise Exception('Model learning result is not found @{0}. This is rgf_python error.'.format(loc_temp))
    360         latest_model_loc = sorted(glob(model_glob), reverse=True)[0]
    361 

Exception: Model learning result is not found @/tmp/rgf. This is rgf_python error.

Thanks for your reading.

@fukatani
Copy link
Member

Hi finlay-llu,

Thanks for your report.
Could you check the following item?

  1. /tmp/rgf does exist?
  2. /tmp/rgf is writable directory without superuser administration?
  3. Are there any files in /tmp/rgf?

Normally, training data and model result exist in /tmp/reg

@finlay-liu
Copy link
Author

yes the dir /tmp/rgf exist, and also have the train/test file in /tmp/rgf.

@fukatani
Copy link
Member

Thanks.
Could you tell me name of all file in /tmp/rgf?

@finlay-liu
Copy link
Author

yeah, the output is :

lyz@~/Workspace/Github/LightGBM$ ls /tmp/rgf/
test.data.x  train.data.x  train.data.y

@fukatani
Copy link
Member

Hmm. It's strange.
Can your script and (part of) data be pasted?
And rgf_python/rgf/test/test.py is working?

You can execute test by,

python test.py

@finlay-liu
Copy link
Author

my own code is

X_train = train_df
y_train = train_label

test_loss = []
for i, (train_index, test_index) in enumerate(kf):
    x_tr = X_train[train_index]; x_te = X_train[test_index]
    y_tr = y_train[train_index]; y_te = y_train[test_index]
    
    clf = RGFClassifier(max_leaf=400,
                    algorithm="RGF_Sib",
                    test_interval=100, verbose=True)
    clf.fit(x_tr, y_tr)
    test_loss.append(clf.score(x_te, y_te))
    
# print np.mean(test_loss)

and i run the example/cross_validation_for_iris.py is ok, and the test/test.py is ok, quite strange, maybe is my code bug.

@finlay-liu
Copy link
Author

i fine the bug in my code, the RFG verbose output is

None
"train": 
   algorithm=RGF_Sib
   train_x_fn=/tmp/rgf/train.data.x
   train_y_fn=/tmp/rgf/train.data.y
   Log:ON
   model_fn_prefix=/tmp/rgf/model_c2
--------------------
Sun Mar 12 21:31:18 2017: Reading training data ... 
!Input error!: (Detected in AzSvDataS::_parseDataLine) 
Invalid number expression in line# 1 of the input data file: False 0 5 3000 66993.0 0 1 0 0 0 0 0

so this maybe my own code bug, thx, damn verbose.

@fukatani
Copy link
Member

fukatani commented Mar 12, 2017

Great!
So your input data including 'False' string?
If so, Data type must be number.
You have to convert it as follows.

False -> 0
True -> 0

@finlay-liu
Copy link
Author

yes, thank you fukatani. it's all my fault, thank you again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants