Giter Club home page Giter Club logo

fuku-ml's Introduction

image

image

image

image

image

Simple machine learning library / 簡單易用的機器學習套件

Installation

$ pip install FukuML

Tutorial

Algorithm

  • Perceptron
    • Perceptron Binary Classification Learning Algorithm
    • Perceptron Multi Classification Learning Algorithm
    • Pocket Perceptron Binary Classification Learning Algorithm
    • Pocket Perceptron Multi Classification Learning Algorithm
  • Regression
    • Linear Regression Learning Algorithm
    • Linear Regression Binary Classification Learning Algorithm
    • Linear Regression Multi Classification Learning Algorithm
    • Ridge Regression Learning Algorithm
    • Ridge Regression Binary Classification Learning Algorithm
    • Ridge Regression Multi Classification Learning Algorithm
    • Kernel Ridge Regression Learning Algorithm
    • Kernel Ridge Regression Binary Classification Learning Algorithm
    • Kernel Ridge Regression Multi Classification Learning Algorithm
  • Logistic Regression
    • Logistic Regression Learning Algorithm
    • Logistic Regression Binary Classification Learning Algorithm
    • Logistic Regression One vs All Multi Classification Learning Algorithm
    • Logistic Regression One vs One Multi Classification Learning Algorithm
    • L2 Regularized Logistic Regression Learning Algorithm
    • L2 Regularized Logistic Regression Binary Classification Learning Algorithm
    • Kernel Logistic Regression Learning Algorithm
  • Support Vector Machine
    • Primal Hard Margin Support Vector Machine Binary Classification Learning Algorithm
    • Dual Hard Margin Support Vector Machine Binary Classification Learning Algorithm
    • Polynomial Kernel Support Vector Machine Binary Classification Learning Algorithm
    • Gaussian Kernel Support Vector Machine Binary Classification Learning Algorithm
    • Soft Polynomial Kernel Support Vector Machine Binary Classification Learning Algorithm
    • Soft Gaussian Kernel Support Vector Machine Binary Classification Learning Algorithm
    • Polynomial Kernel Support Vector Machine Multi Classification Learning Algorithm
    • Gaussian Kernel Support Vector Machine Multi Classification Learning Algorithm
    • Soft Polynomial Kernel Support Vector Machine Multi Classification Learning Algorithm
    • Soft Gaussian Kernel Support Vector Machine Multi Classification Learning Algorithm
    • Probabilistic Support Vector Machine Learning Algorithm
    • Least Squares Support Vector Machine Binary Classification Learning Algorithm
    • Least Squares Support Vector Machine Multi Classification Learning Algorithm
    • Support Vector Regression Learning Algorithm
  • Decision Tree
    • Decision Stump Binary Classification Learning Algorithm
    • AdaBoost Stump Binary Classification Learning Algorithm
    • AdaBoost Decision Tree Classification Learning Algorithm
    • Gradient Boost Decision Tree Regression Learning Algorithm
    • Decision Tree Classification Learning Algorithm
    • Decision Tree Regression Learning Algorithm
    • Random Forest Classification Learning Algorithm
    • Random Forest Regression Learning Algorithm
  • Neural Network
    • Neural Network Learning Algorithm
    • Neural Network Binary Classification Learning Algorithm
  • Accelerator
    • Linear Regression Accelerator
  • Feature Transform
    • Polynomial Feature Transform
    • Legendre Feature Transform
  • Validation
    • 10 Fold Cross Validation
  • Blending
    • Uniform Blending for Classification
    • Linear Blending for Classification
    • Uniform Blending for Regression
    • Linear Blending for Regression

Usage

>>> import numpy as np
# we need numpy as a base libray

>>> import FukuML.PLA as pla
# import FukuML.PLA to do Perceptron Learning

>>> your_input_data_file = '/path/to/your/data/file'
# assign your input data file, please check the data format: https://github.com/fukuball/fuku-ml/blob/master/FukuML/dataset/pla_binary_train.dat

>>> pla_bc = pla.BinaryClassifier()
# new a PLA binary classifier

>>> pla_bc.load_train_data(your_input_data_file)
# load train data

>>> pla_bc.set_param()
# set parameter

>>> pla_bc.init_W()
# init the W

>>> W = pla_bc.train()
# train by Perceptron Learning Algorithm to find best W

>>> test_data = 'Each feature of data x separated with spaces. And the ground truth y put in the end of line separated by a space'
# assign test data, format like this '0.97681 0.10723 0.64385 ........ 0.29556 1'

>>> prediction = pla_bc.prediction(test_data)
# prediction by trained W

>>> print prediction['input_data_x']
# print test data x

>>> print prediction['input_data_y']
# print test data y

>>> print prediction['prediction']
# print the prediction, will find out prediction is the same as pla_bc.test_data_y

For detail, please check https://github.com/fukuball/fuku-ml/blob/master/doc/sample_code.rst

Tests

python test_fuku_ml.py

PEP8

pep8 FukuML/*.py --ignore=E501

Donate

If you find fuku-ml useful, please consider a donation. Thank you!

  • bitcoin: 1BbihQU3CzSdyLSP9bvQq7Pi1z1jTdAaq9
  • eth: 0x92DA3F837bf2F79D422bb8CEAC632208F94cdE33

License

The MIT License (MIT)

Copyright (c) 2016 fukuball

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

fuku-ml's People

Contributors

fukuball avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fuku-ml's Issues

PLA中檢查data是否線性可分的方法

我在網上找的資料說,如果數據線性可分,那麼PLA一定會停止,最大步數為 對於R我們可以從數據集中得到,但是對於gamma,我們無法求得,所以我們只知道存在最大步數,但具體是多少無從得知。

看你的code(PLA.py),似乎是能確定一個上界,可以請問下相關的理論證明麼

if (self.tune_times > (2 * self.data_num)):
      print("Dataset not linear separable.")
      break

Installation Error

Collecting FukuML
Downloading FukuML-0.4.1-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 490kB/s
Collecting cvxopt==1.1.8 (from FukuML)
Downloading cvxopt-1.1.8.tar.gz (5.3MB)
100% |████████████████████████████████| 5.3MB 167kB/s
Collecting scikit-learn==0.17.1 (from FukuML)
Downloading scikit_learn-0.17.1-cp27-cp27mu-manylinux1_x86_64.whl (17.6MB)
100% |████████████████████████████████| 17.6MB 69kB/s
Collecting scipy==0.17.0 (from FukuML)
Downloading scipy-0.17.0-cp27-cp27mu-manylinux1_x86_64.whl (39.5MB)
100% |████████████████████████████████| 39.5MB 36kB/s
Collecting numpy==1.10.4 (from FukuML)
Downloading numpy-1.10.4-cp27-cp27mu-manylinux1_x86_64.whl (15.0MB)
100% |████████████████████████████████| 15.0MB 79kB/s
Requirement already satisfied: pep8==1.7.0 in /mnt/disk1/anaconda2/lib/python2.7/site-packages (from FukuML)
Building wheels for collected packages: cvxopt
Running setup.py bdist_wheel for cvxopt ... error
Complete output from command /mnt/disk1/anaconda2/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-Yide8J/cvxopt/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmpr_lP_apip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/cvxopt
copying src/python/coneprog.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/modeling.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/printing.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/cvxprog.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/info.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/init.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/msk.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/solvers.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/misc.py -> build/lib.linux-x86_64-2.7/cvxopt
running build_ext
building 'base' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/C
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/mnt/disk1/anaconda2/include/python2.7 -c src/C/base.c -o build/temp.linux-x86_64-2.7/src/C/base.o
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/mnt/disk1/anaconda2/include/python2.7 -c src/C/dense.c -o build/temp.linux-x86_64-2.7/src/C/dense.o
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/mnt/disk1/anaconda2/include/python2.7 -c src/C/sparse.c -o build/temp.linux-x86_64-2.7/src/C/sparse.o
src/C/sparse.c: In function ‘sparse_concat’:
src/C/sparse.c:368:30: warning: variable ‘blk_ncols’ set but not used [-Wunused-but-set-variable]
int_t blk_nrows = 0, blk_ncols = 0;
^
gcc -pthread -shared -L/mnt/disk1/anaconda2/lib -Wl,-rpath=/mnt/disk1/anaconda2/lib,--no-as-needed build/temp.linux-x86_64-2.7/src/C/base.o build/temp.linux-x86_64-2.7/src/C/dense.o build/temp.linux-x86_64-2.7/src/C/sparse.o -L/usr/lib -L/mnt/disk1/anaconda2/lib -lm -llapack -lblas -lpython2.7 -o build/lib.linux-x86_64-2.7/cvxopt/base.so
/usr/bin/ld: 找不到 -llapack
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1


Failed building wheel for cvxopt
Running setup.py clean for cvxopt
Failed to build cvxopt
Installing collected packages: cvxopt, scikit-learn, scipy, numpy, FukuML
Running setup.py install for cvxopt ... error
Complete output from command /mnt/disk1/anaconda2/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-Yide8J/cvxopt/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-vV2hrJ-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/cvxopt
copying src/python/coneprog.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/modeling.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/printing.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/cvxprog.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/info.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/init.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/msk.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/solvers.py -> build/lib.linux-x86_64-2.7/cvxopt
copying src/python/misc.py -> build/lib.linux-x86_64-2.7/cvxopt
running build_ext
building 'base' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/C
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/mnt/disk1/anaconda2/include/python2.7 -c src/C/base.c -o build/temp.linux-x86_64-2.7/src/C/base.o
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/mnt/disk1/anaconda2/include/python2.7 -c src/C/dense.c -o build/temp.linux-x86_64-2.7/src/C/dense.o
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/mnt/disk1/anaconda2/include/python2.7 -c src/C/sparse.c -o build/temp.linux-x86_64-2.7/src/C/sparse.o
src/C/sparse.c: In function ‘sparse_concat’:
src/C/sparse.c:368:30: warning: variable ‘blk_ncols’ set but not used [-Wunused-but-set-variable]
int_t blk_nrows = 0, blk_ncols = 0;
^
gcc -pthread -shared -L/mnt/disk1/anaconda2/lib -Wl,-rpath=/mnt/disk1/anaconda2/lib,--no-as-needed build/temp.linux-x86_64-2.7/src/C/base.o build/temp.linux-x86_64-2.7/src/C/dense.o build/temp.linux-x86_64-2.7/src/C/sparse.o -L/usr/lib -L/mnt/disk1/anaconda2/lib -lm -llapack -lblas -lpython2.7 -o build/lib.linux-x86_64-2.7/cvxopt/base.so
/usr/bin/ld: 找不到 -llapack
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

----------------------------------------

Command "/mnt/disk1/anaconda2/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-Yide8J/cvxopt/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-vV2hrJ-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-Yide8J/cvxopt/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.