Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
aksnzhy committed Dec 19, 2017
1 parent 780c8e2 commit 6fa0751
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 1 deletion.
Binary file modified _build/doctrees/demo.doctree
Binary file not shown.
Binary file modified _build/doctrees/environment.pickle
Binary file not shown.
22 changes: 22 additions & 0 deletions _build/html/_sources/demo.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ for Poisonous Oak and Ivy.

You can find a small portion of data used in this demo in the path ``/demo/classification/mushroom/``.

The follow code is the Python demo:

.. code-block:: python
import xlearn as xl
# Training task
linear_model = xl.create_linear()
linear_model.setTrain("./agaricus_train.txt")
linear_model.setValidate("./agaricus_test.txt")
param = {'task':'binary', 'lr':0.2,
'lambda':0.002, 'metric':'acc',
'opt':'sgd'}
linear_model.fit(param, './model.out')
# Prediction task
linear_model.setTest("./agaricus_test.txt")
# Convert output to 0-1
linear_model.setSigmoid()
linear_model.predict("./model.out", "./output.txt")
Predict Survival in Titanic
-----------------------------

Expand Down
20 changes: 20 additions & 0 deletions _build/html/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,26 @@ <h2>Mushroom Classification<a class="headerlink" href="#mushroom-classification"
states that there is no simple rule for determining the edibility of a mushroom; no rule like <em>leaflets three, let it be</em>
for Poisonous Oak and Ivy.</p>
<p>You can find a small portion of data used in this demo in the path <code class="docutils literal"><span class="pre">/demo/classification/mushroom/</span></code>.</p>
<p>The follow code is the Python demo:</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"># Training task</span>
<span class="n">linear_model</span> <span class="o">=</span> <span class="n">xl</span><span class="o">.</span><span class="n">create_linear</span><span class="p">()</span>
<span class="n">linear_model</span><span class="o">.</span><span class="n">setTrain</span><span class="p">(</span><span class="s2">&quot;./agaricus_train.txt&quot;</span><span class="p">)</span>
<span class="n">linear_model</span><span class="o">.</span><span class="n">setValidate</span><span class="p">(</span><span class="s2">&quot;./agaricus_test.txt&quot;</span><span class="p">)</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;acc&#39;</span><span class="p">,</span>
<span class="s1">&#39;opt&#39;</span><span class="p">:</span><span class="s1">&#39;sgd&#39;</span><span class="p">}</span>

<span class="n">linear_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="s1">&#39;./model.out&#39;</span><span class="p">)</span>

<span class="c1"># Prediction task</span>
<span class="n">linear_model</span><span class="o">.</span><span class="n">setTest</span><span class="p">(</span><span class="s2">&quot;./agaricus_test.txt&quot;</span><span class="p">)</span>
<span class="c1"># Convert output to 0-1</span>
<span class="n">linear_model</span><span class="o">.</span><span class="n">setSigmoid</span><span class="p">()</span>
<span class="n">linear_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>
</div>
<div class="section" id="predict-survival-in-titanic">
<h2>Predict Survival in Titanic<a class="headerlink" href="#predict-survival-in-titanic" title="Permalink to this headline"></a></h2>
Expand Down
2 changes: 1 addition & 1 deletion _build/html/searchindex.js

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions demo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ for Poisonous Oak and Ivy.

You can find a small portion of data used in this demo in the path ``/demo/classification/mushroom/``.

The follow code is the Python demo:

.. code-block:: python
import xlearn as xl
# Training task
linear_model = xl.create_linear()
linear_model.setTrain("./agaricus_train.txt")
linear_model.setValidate("./agaricus_test.txt")
param = {'task':'binary', 'lr':0.2,
'lambda':0.002, 'metric':'acc',
'opt':'sgd'}
linear_model.fit(param, './model.out')
# Prediction task
linear_model.setTest("./agaricus_test.txt")
# Convert output to 0-1
linear_model.setSigmoid()
linear_model.predict("./model.out", "./output.txt")
Predict Survival in Titanic
-----------------------------

Expand Down

0 comments on commit 6fa0751

Please sign in to comment.