Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
aksnzhy committed Dec 5, 2017
1 parent 5e87879 commit a69a352
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 37 deletions.
Binary file modified _build/doctrees/environment.pickle
Binary file not shown.
Binary file modified _build/doctrees/index.doctree
Binary file not shown.
16 changes: 4 additions & 12 deletions _build/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,17 @@ Here is a simple python demo no how to use xLearn.
import xlearn as xl
# create ffm model
# Training task
ffm_model = xl.create_ffm()
# Set training data
ffm_model.setTrain("./small_train.txt")
# Set validation data
ffm_model.setValidate("./small_test.txt")
# set some hyper-parameters
param = { 'task':'binary',
'lr':0.2,
'lambda':0.002,
'metric':'auc'}
# Train model
param = {'task':'binary', 'lr':0.2,
'lambda':0.002, 'metric':'auc'}
ffm_model.fit(param, "./model.out")
# Set test data
# Prediction task
ffm_model.setTest("./small_test.txt")
# Convert output result to 0~1
ffm_model.setSigmoid()
# Predict
ffm_model.predict("./model.out", "./output.txt")
This example shows how to use xlearn to solve a simple binary classification task.
Expand Down
16 changes: 4 additions & 12 deletions _build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,25 +201,17 @@ <h2>Python Demo<a class="headerlink" href="#python-demo" title="Permalink to thi
<p>Here is a simple python demo no how to use xLearn.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">xlearn</span> <span class="kn">as</span> <span class="nn">xl</span>

<span class="c1"># create ffm model</span>
<span class="c1"># Training task</span>
<span class="n">ffm_model</span> <span class="o">=</span> <span class="n">xl</span><span class="o">.</span><span class="n">create_ffm</span><span class="p">()</span>
<span class="c1"># Set training data</span>
<span class="n">ffm_model</span><span class="o">.</span><span class="n">setTrain</span><span class="p">(</span><span class="s2">&quot;./small_train.txt&quot;</span><span class="p">)</span>
<span class="c1"># Set validation data</span>
<span class="n">ffm_model</span><span class="o">.</span><span class="n">setValidate</span><span class="p">(</span><span class="s2">&quot;./small_test.txt&quot;</span><span class="p">)</span>
<span class="c1"># set some hyper-parameters</span>
<span class="n">param</span> <span class="o">=</span> <span class="p">{</span> <span class="s1">&#39;task&#39;</span><span class="p">:</span><span class="s1">&#39;binary&#39;</span><span class="p">,</span>
<span class="s1">&#39;lr&#39;</span><span class="p">:</span><span class="mf">0.2</span><span class="p">,</span>
<span class="s1">&#39;lambda&#39;</span><span class="p">:</span><span class="mf">0.002</span><span class="p">,</span>
<span class="s1">&#39;metric&#39;</span><span class="p">:</span><span class="s1">&#39;auc&#39;</span><span class="p">}</span>
<span class="c1"># Train model</span>
<span class="n">param</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;task&#39;</span><span class="p">:</span><span class="s1">&#39;binary&#39;</span><span class="p">,</span> <span class="s1">&#39;lr&#39;</span><span class="p">:</span><span class="mf">0.2</span><span class="p">,</span>
<span class="s1">&#39;lambda&#39;</span><span class="p">:</span><span class="mf">0.002</span><span class="p">,</span> <span class="s1">&#39;metric&#39;</span><span class="p">:</span><span class="s1">&#39;auc&#39;</span><span class="p">}</span>
<span class="n">ffm_model</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">param</span><span class="p">,</span> <span class="s2">&quot;./model.out&quot;</span><span class="p">)</span>

<span class="c1"># Set test data</span>
<span class="c1"># Prediction task</span>
<span class="n">ffm_model</span><span class="o">.</span><span class="n">setTest</span><span class="p">(</span><span class="s2">&quot;./small_test.txt&quot;</span><span class="p">)</span>
<span class="c1"># Convert output result to 0~1</span>
<span class="n">ffm_model</span><span class="o">.</span><span class="n">setSigmoid</span><span class="p">()</span>
<span class="c1"># Predict</span>
<span class="n">ffm_model</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="s2">&quot;./model.out&quot;</span><span class="p">,</span> <span class="s2">&quot;./output.txt&quot;</span><span class="p">)</span>
</pre></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion _build/html/searchindex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 4 additions & 12 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,17 @@ Here is a simple python demo no how to use xLearn.
import xlearn as xl
# create ffm model
# Training task
ffm_model = xl.create_ffm()
# Set training data
ffm_model.setTrain("./small_train.txt")
# Set validation data
ffm_model.setValidate("./small_test.txt")
# set some hyper-parameters
param = { 'task':'binary',
'lr':0.2,
'lambda':0.002,
'metric':'auc'}
# Train model
param = {'task':'binary', 'lr':0.2,
'lambda':0.002, 'metric':'auc'}
ffm_model.fit(param, "./model.out")
# Set test data
# Prediction task
ffm_model.setTest("./small_test.txt")
# Convert output result to 0~1
ffm_model.setSigmoid()
# Predict
ffm_model.predict("./model.out", "./output.txt")
This example shows how to use xlearn to solve a simple binary classification task.
Expand Down

0 comments on commit a69a352

Please sign in to comment.