Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
aksnzhy committed Dec 4, 2017
1 parent e91af73 commit 1462513
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 33 deletions.
Binary file modified _build/doctrees/environment.pickle
Binary file not shown.
Binary file modified _build/doctrees/index.doctree
Binary file not shown.
25 changes: 14 additions & 11 deletions _build/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,25 @@ source code and build it locally. We will update the xLearn source code on pip w

sudo pip install --index-url https://test.pypi.org/simple/ xlearnn

If you want to build the lastest code, or you want to use the xLearn command line
interface, you can see how to build xLearn from source code from `Installation Guide`__.
If you want to build the lastest code on github, or you want to use the xLearn command line,
you can see how to build xLearn from source code from `Installation Guide`__.

Python Demo
----------------------------------

Here is a simple python demo no how to use xLearn. Now type **python** and get started!

>>> import xlearn as xl
>>> ffm_model = xl.create_ffm() # Create FFM model
>>> ffm_model.setTrain("./small_train.txt") # Training set
>>> ffm_model.setValidate("./small_test.txt") # Validation set
>>> param = { 'task':'binary', 'lr':0.2, 'lambda':0.002, 'metric':'auc'} # Set parameter
>>> ffm_model.fit(param, "./model.out") # Train model
>>> ffm_model.setTest("./small_test.txt") # Test set
>>> ffm_model.predict("./model.out", "./output.txt") # Predict

This example shows how to use xlearn to solve a binary classification task.
>>> ffm_model = xl.create_ffm() # create ffm model
>>> ffm_model.setTrain("./small_train.txt") # set training data
>>> ffm_model.setValidate("./small_test.txt") # Validation data
>>> param = { 'task':'binary', 'lr':0.2, 'lambda':0.002, 'metric':'auc'} # set parameters
>>> ffm_model.fit(param, "./model.out") # train model
>>> ffm_model.setTest("./small_test.txt") # set test data
>>> ffm_model.predict("./model.out", "./output.txt") # predict

This example shows how to use xlearn to solve a simple binary classification task.
You can find the demo data **small_train.txt** and **small_test.txt** from the **demo/classification/criteo_ctr/**

.. __: install
.. __: commandline
Expand Down
22 changes: 12 additions & 10 deletions _build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,22 +187,24 @@ <h2>Quick Install<a class="headerlink" href="#quick-install" title="Permalink to
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="n">index</span><span class="o">-</span><span class="n">url</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">test</span><span class="o">.</span><span class="n">pypi</span><span class="o">.</span><span class="n">org</span><span class="o">/</span><span class="n">simple</span><span class="o">/</span> <span class="n">xlearnn</span>
</pre></div>
</div>
<p>If you want to build the lastest code, or you want to use the xLearn command line
interface, you can see how to build xLearn from source code from <a class="reference external" href="install">Installation Guide</a>.</p>
<p>If you want to build the lastest code on github, or you want to use the xLearn command line,
you can see how to build xLearn from source code from <a class="reference external" href="install">Installation Guide</a>.</p>
</div>
<div class="section" id="python-demo">
<h2>Python Demo<a class="headerlink" href="#python-demo" title="Permalink to this headline"></a></h2>
<p>Here is a simple python demo no how to use xLearn. Now type <strong>python</strong> and get started!</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">xlearn</span> <span class="k">as</span> <span class="nn">xl</span>
<span class="gp">&gt;&gt;&gt; </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"># Create FFM model</span>
<span class="gp">&gt;&gt;&gt; </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"># Training set</span>
<span class="gp">&gt;&gt;&gt; </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"># Validation set</span>
<span class="gp">&gt;&gt;&gt; </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"># Set parameter</span>
<span class="gp">&gt;&gt;&gt; </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"># Train model</span>
<span class="gp">&gt;&gt;&gt; </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"># Test set</span>
<span class="gp">&gt;&gt;&gt; </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> <span class="c1"># Predict</span>
<span class="gp">&gt;&gt;&gt; </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"># create ffm model</span>
<span class="gp">&gt;&gt;&gt; </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 training data</span>
<span class="gp">&gt;&gt;&gt; </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"># Validation data</span>
<span class="gp">&gt;&gt;&gt; </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"># set parameters</span>
<span class="gp">&gt;&gt;&gt; </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"># train model</span>
<span class="gp">&gt;&gt;&gt; </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"># set test data</span>
<span class="gp">&gt;&gt;&gt; </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> <span class="c1"># predict</span>
</pre></div>
</div>
<p>This example shows how to use xlearn to solve a binary classification task.</p>
<p>This example shows how to use xlearn to solve a simple binary classification task.
You can find the demo data <strong>small_train.txt</strong> and <strong>small_test.txt</strong> from the <strong>demo/classification/criteo_ctr/</strong></p>
<blockquote>
<div></div></blockquote>
<div class="toctree-wrapper compound">
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.

25 changes: 14 additions & 11 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,25 @@ source code and build it locally. We will update the xLearn source code on pip w

sudo pip install --index-url https://test.pypi.org/simple/ xlearnn

If you want to build the lastest code, or you want to use the xLearn command line
interface, you can see how to build xLearn from source code from `Installation Guide`__.
If you want to build the lastest code on github, or you want to use the xLearn command line,
you can see how to build xLearn from source code from `Installation Guide`__.

Python Demo
----------------------------------

Here is a simple python demo no how to use xLearn. Now type **python** and get started!

>>> import xlearn as xl
>>> ffm_model = xl.create_ffm() # Create FFM model
>>> ffm_model.setTrain("./small_train.txt") # Training set
>>> ffm_model.setValidate("./small_test.txt") # Validation set
>>> param = { 'task':'binary', 'lr':0.2, 'lambda':0.002, 'metric':'auc'} # Set parameter
>>> ffm_model.fit(param, "./model.out") # Train model
>>> ffm_model.setTest("./small_test.txt") # Test set
>>> ffm_model.predict("./model.out", "./output.txt") # Predict

This example shows how to use xlearn to solve a binary classification task.
>>> ffm_model = xl.create_ffm() # create ffm model
>>> ffm_model.setTrain("./small_train.txt") # set training data
>>> ffm_model.setValidate("./small_test.txt") # Validation data
>>> param = { 'task':'binary', 'lr':0.2, 'lambda':0.002, 'metric':'auc'} # set parameters
>>> ffm_model.fit(param, "./model.out") # train model
>>> ffm_model.setTest("./small_test.txt") # set test data
>>> ffm_model.predict("./model.out", "./output.txt") # predict

This example shows how to use xlearn to solve a simple binary classification task.
You can find the demo data **small_train.txt** and **small_test.txt** from the **demo/classification/criteo_ctr/**

.. __: install
.. __: commandline
Expand Down

0 comments on commit 1462513

Please sign in to comment.