{"id":16654430,"url":"https://github.com/ikegami-yukino/oll-python","last_synced_at":"2025-07-10T17:04:38.466Z","repository":{"id":11120324,"uuid":"13479424","full_name":"ikegami-yukino/oll-python","owner":"ikegami-yukino","description":"Online machine learning algorithms (based on OLL C++ library)","archived":false,"fork":false,"pushed_at":"2017-06-29T17:00:17.000Z","size":99,"stargazers_count":22,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-23T08:03:17.856Z","etag":null,"topics":["alma","binary-classification","machine-learning","online-learning","perceptron"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ikegami-yukino.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-10T18:26:45.000Z","updated_at":"2022-04-15T10:05:36.000Z","dependencies_parsed_at":"2022-09-04T02:11:01.330Z","dependency_job_id":null,"html_url":"https://github.com/ikegami-yukino/oll-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ikegami-yukino/oll-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikegami-yukino%2Foll-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikegami-yukino%2Foll-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikegami-yukino%2Foll-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikegami-yukino%2Foll-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ikegami-yukino","download_url":"https://codeload.github.com/ikegami-yukino/oll-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikegami-yukino%2Foll-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264614210,"owners_count":23637537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alma","binary-classification","machine-learning","online-learning","perceptron"],"created_at":"2024-10-12T09:49:45.960Z","updated_at":"2025-07-10T17:04:38.448Z","avatar_url":"https://github.com/ikegami-yukino.png","language":"C++","readme":"oll-python\n==========\n\n|travis| |coveralls| |version| |license|\n\nThis is a Python binding of the OLL library for machine learning.\n\nCurrently, OLL 0.03 supports following binary classification algorithms:\n\n- Perceptron\n- Averaged Perceptron\n- Passive Agressive (PA, PA-I, PA-II, Kernelized)\n- ALMA (modified slightly from original)\n- Confidence Weighted Linear-Classification.\n\nFor details of oll, see: http://code.google.com/p/oll\n\nInstallation\n------------\n\n::\n\n $ pip install oll\n\nOLL library is bundled, so you don't need to install it separately.\n\nUsage\n-----\n\n.. code:: python\n\n import oll\n # You can choose algorithms in\n # \"P\" -\u003e Perceptron,\n # \"AP\" -\u003e Averaged Perceptron,\n # \"PA\" -\u003e Passive Agressive,\n # \"PA1\" -\u003e Passive Agressive-I,\n # \"PA2\" -\u003e Passive Agressive-II,\n # \"PAK\" -\u003e Kernelized Passive Agressive,\n # \"CW\" -\u003e Confidence Weighted Linear-Classification,\n # \"AL\" -\u003e ALMA\n o = oll.oll(\"CW\", C=1.0, bias=0.0)\n o.add({0: 1.0, 1: 2.0, 2: -1.0}, 1)  # train\n o.classify({0:1.0, 1:1.0})  # predict\n o.save('oll.model')\n o.load('oll.model')\n\n # scikit-learn like fit/predict interface\n import numpy as np\n array = np.array([[1, 2, -1], [0, 0, 1]])\n o.fit(array, [1, -1])\n o.predict(np.array([[1, 2, -1], [0, 0, 1]]))\n # =\u003e [1, -1]\n from scipy.sparse import csr_matrix\n matrix = csr_matrix([[1, 2, -1], [0, 0, 1]])\n o.fit(matrix, [1, -1])\n o.predict(matrix)\n # =\u003e [1, -1]\n\n # Multi label classification\n import time\n import oll\n from sklearn.multiclass import OutputCodeClassifier\n from sklearn import datasets, cross_validation, metrics\n\n\n dataset = datasets.load_digits()\n ALGORITHMS = (\"P\", \"AP\", \"PA\", \"PA1\", \"PA2\", \"PAK\", \"CW\", \"AL\")\n for algorithm in ALGORITHMS:\n     print(algorithm)\n     occ_predicts = []\n     expected = []\n     start = time.time()\n     for (train_idx, test_idx) in cross_validation.StratifiedKFold(dataset.target,\n                                                                   n_folds=10, shuffle=True):\n         clf = OutputCodeClassifier(oll.oll(algorithm))\n         clf.fit(dataset.data[train_idx], dataset.target[train_idx])\n         occ_predicts += list(clf.predict(dataset.data[test_idx]))\n         expected += list(dataset.target[test_idx])\n     print('Elapsed time: %s' % (time.time() - start))\n     print('Accuracy', metrics.accuracy_score(expected, occ_predicts))\n # =\u003e P\n # =\u003e Elapsed time: 109.82188701629639\n # =\u003e Accuracy 0.770172509738\n # =\u003e AP\n # =\u003e Elapsed time: 111.42936396598816\n # =\u003e Accuracy 0.760155815248\n # =\u003e PA\n # =\u003e Elapsed time: 110.95964503288269\n # =\u003e Accuracy 0.74735670562\n # =\u003e PA1\n # =\u003e Elapsed time: 111.39844799041748\n # =\u003e Accuracy 0.806343906511\n # =\u003e PA2\n # =\u003e Elapsed time: 115.12716913223267\n # =\u003e Accuracy 0.766277128548\n # =\u003e PAK\n # =\u003e Elapsed time: 119.53838682174683\n # =\u003e Accuracy 0.77796327212\n # =\u003e CW\n # =\u003e Elapsed time: 121.20785689353943\n # =\u003e Accuracy 0.771285475793\n # =\u003e AL\n # =\u003e Elapsed time: 116.52497220039368\n # =\u003e Accuracy 0.785754034502\n\nNote\n----\n- This module requires C++ compiler to build.\n- oll.cpp \u0026 oll.hpp : Copyright (c) 2011, Daisuke Okanohara\n- oll_swig_wrap.cxx is generated based on 'oll_swig.i' in oll-ruby (https://github.com/syou6162/oll-ruby)\n\nLicense\n-------\nNew BSD License.\n\n.. |travis| image:: https://travis-ci.org/ikegami-yukino/oll-python.svg?branch=master\n    :target: https://travis-ci.org/ikegami-yukino/oll-python\n    :alt: travis-ci.org\n.. |coveralls| image:: https://coveralls.io/repos/ikegami-yukino/oll-python/badge.png\n    :target: https://coveralls.io/r/ikegami-yukino/oll-python\n    :alt: coveralls.io\n\n.. |version| image:: https://img.shields.io/pypi/v/oll.svg\n    :target: http://pypi.python.org/pypi/oll/\n    :alt: latest version\n\n.. |license| image:: https://img.shields.io/pypi/l/oll.svg\n    :target: http://pypi.python.org/pypi/oll/\n    :alt: license\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikegami-yukino%2Foll-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fikegami-yukino%2Foll-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikegami-yukino%2Foll-python/lists"}