Skip to content

Commit

Permalink
Merge pull request #3 from ikegami-yukino/sklearn-interface
Browse files Browse the repository at this point in the history
v 0.2
  • Loading branch information
ikegami-yukino committed Nov 26, 2016
2 parents e7a30e1 + e523df9 commit cd26fc1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGES.rst
Expand Up @@ -2,6 +2,14 @@
CHANGES
=======

0.2 (2016-11-26)
-------------------

- scikit-learn like fit/predict interfaces are available
- Setting C and bias parameters is available in initialization
- Support Python 3.5
- Unsupport Python 2.6 and 3.3

0.1.2 (2015-01-11)
-------------------

Expand Down
25 changes: 23 additions & 2 deletions README.rst
Expand Up @@ -5,7 +5,7 @@ oll-python

This is a Python binding of the OLL library for machine learning.

Currently, OLL 0.03 supports following algorithms:
Currently, OLL 0.03 supports following binary classification algorithms:

- Perceptron
- Averaged Perceptron
Expand All @@ -30,12 +30,33 @@ Usage
.. code:: python
import oll
o = oll.oll("CW")
# You can choose algorithms in
# "P" -> Perceptron,
# "AP" -> Averaged Perceptron,
# "PA" -> Passive Agressive,
# "PA1" -> Passive Agressive-I,
# "PA2" -> Passive Agressive-II,
# "PAK" -> Kernelized Passive Agressive,
# "CW" -> Confidence Weighted Linear-Classification,
# "AL" -> ALMA
o = oll.oll("CW", C=1.0, bias=0.0)
o.add({0: 1.0, 1: 2.0, 2: -1.0}, 1) # train
o.classify({0:1.0, 1:1.0}) # predict
o.save('oll.model')
o.load('oll.model')
# scikit-learn like fit/predict interface
import numpy as np
array = np.array([[1, 2, -1], [0, 0, 1]])
o.fit(array, [1, -1])
o.predict(np.array([[1, 2, -1], [0, 0, 1]]))
# => [1, -1]
from scipy.sparse import csr_matrix
matrix = csr_matrix([[1, 2, -1], [0, 0, 1]])
o.fit(matrix, [1, -1])
o.predict(matrix)
# => [1, -1]
Note
----
Expand Down
4 changes: 2 additions & 2 deletions oll/__init__.py
@@ -1,5 +1,5 @@
from .oll import oll

VERSION = (0, 1, 2)
__version__ = "0.1.2"
VERSION = (0, 2)
__version__ = "0.2"
__all__ = ["oll"]

0 comments on commit cd26fc1

Please sign in to comment.