Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
aksnzhy committed Sep 4, 2018
1 parent 2fc4d62 commit c272add
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,24 @@ Here is a simple Python demo no how to use xLearn for a binary classification pr
import xlearn as xl
# Training task
ffm_model = xl.create_ffm() # Use field-aware factorization machine
ffm_model.setTrain("./small_train.txt") # Training data
ffm_model.setValidate("./small_test.txt") # Validation data
ffm_model = xl.create_ffm() # Use field-aware factorization machine (ffm)
ffm_model.setTrain("./small_train.txt") # Path of training data
ffm_model.setValidate("./small_test.txt") # Path of validation data
# param:
# 0. binary classification
# 0. task: binary classification
# 1. learning rate: 0.2
# 2. regular lambda: 0.002
# 3. evaluation metric: accuracy
param = {'task':'binary', 'lr':0.2,
'lambda':0.002, 'metric':'acc'}
param = {'task':'binary', 'lr':0.2, 'lambda':0.002, 'metric':'acc'}
# Start to train
# The trained model will be stored in model.out
ffm_model.fit(param, './model.out')
# Prediction task
ffm_model.setTest("./small_test.txt") # Test data
ffm_model.setSigmoid() # Convert output to 0-1
ffm_model.setTest("./small_test.txt") # Path of test data
ffm_model.setSigmoid() # Convert output to 0-1
# Start to predict
# The output result will be stored in output.txt
Expand Down

0 comments on commit c272add

Please sign in to comment.