Skip to main content

Python-Wrapper for Francesco Parrella's OnlineSVR C++ implementation.

Project description

PyOnlineSVR

pipeline status coverage report Code style: black PyPI package License: GPL v3 python version 3.7|3.8|3.9

Python-Wrapper for Francesco Parrella's OnlineSVR [PAR2007] C++ implementation with scikit-learn-compatible interfaces. You can find more information about the OnlineSVR here and the original source code here.

Installation

Dependencies

PyOnlineSVR requires the following dependencies:

  • python (>=3.7)
  • numpy (>=1.13.3)
  • scipy (>=0.19.1)
  • joblib (>=0.11)
  • scikit-learn (>=0.23.0)

Binaries

PyOnlineSVR is published to PyPi and can be installed using pip.

Prerequisites

Steps

You can use pip to install PyOnlineSVR using:

pip install PyOnlineSVR

From Source (Linux)

If you are installing PyOnlineSVR from source, you will need Python 3.7 or later and a modern C++ compiler. We highly recommend using an Anaconda environment for building this project.

In the following, we explain the steps to build PyOnlineSVR using Anaconda and git.

Prepare environment

Create a new Anaconda environment and install the required dependencies. This includes python, SWIG to generate the C++ wrapper, and the C and C++ compiler toolchains.

conda create -n pyonlinesvr python swig gcc_linux-64 gxx_linux-64
conda activate pyonlinesvr

Install dependencies

conda install -n pyonlinesvr numpy scipy scikit-learn

Get the source code

git clone https://github.com/CodeLionX/pyonlinesvr.git
cd pyonlinesvr

Install PyOnlineSVR

python setup.py install

Note that if your are using Anaconda, you may experience an error caused by the linker:

build/temp.linux-x86_64-3.7/torch/csrc/stub.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1

This is caused by the linker ld from the Conda environment shadowing the system ld. You should use a newer version of Python in your environment that fixes this issue. The recommended Python versions are (3.6.10+,) 3.7.6+ and 3.8.1+. For further details see the issue.

Usage

>>> import numpy as np
>>> from pyonlinesvr import OnlineSVR
>>> X = np.array([[0, 0], [2, 2]])
>>> y = np.array([0.5, 2.5])
>>> regr = OnlineSVR()
>>> regr.fit(X[:1], y[:1])
OnlineSVR()
>>> regr.predict([[1, 1]])
array([ 0.4])
>>> regr.partial_fit(X[1:], y[1:])
OnlineSVR()
>>> regr.predict([[1, 1]])
array([ 1.5])

License

PyOnlineSVR is free software under the terms of the GNU General Public License, as found in the LICENSE file.

References

[PAR2007]: Parrelly, Francesco (2007). "Online Support Vector Machines for Regression." Master thesis. University of Genoa, Italy. PDF

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyOnlineSVR-0.0.4.tar.gz (47.2 kB view hashes)

Uploaded Source

Built Distributions

PyOnlineSVR-0.0.4-cp310-cp310-win_amd64.whl (169.1 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

PyOnlineSVR-0.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

PyOnlineSVR-0.0.4-cp310-cp310-macosx_10_9_x86_64.whl (173.3 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

PyOnlineSVR-0.0.4-cp39-cp39-win_amd64.whl (169.1 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

PyOnlineSVR-0.0.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

PyOnlineSVR-0.0.4-cp39-cp39-macosx_10_9_x86_64.whl (173.3 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

PyOnlineSVR-0.0.4-cp38-cp38-win_amd64.whl (168.9 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

PyOnlineSVR-0.0.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

PyOnlineSVR-0.0.4-cp38-cp38-macosx_10_9_x86_64.whl (173.7 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

PyOnlineSVR-0.0.4-cp37-cp37m-win_amd64.whl (168.7 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

PyOnlineSVR-0.0.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

PyOnlineSVR-0.0.4-cp37-cp37m-macosx_10_9_x86_64.whl (173.5 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page