Coder Social home page Coder Social logo

gokinjo's Introduction

gokinjo

CircleCI

What is this?

  • A feature extraction library based on k-nearest neighbor algorithm in Python
    • k-NN based feature has experience of being used on 1st place solution of Kaggle competition (see references)
  • Be able to switch backend of k-NN algorithm
  • FYI: "gokinjo" is meant neighborhood in japanese.

Prerequisite

  • Python 3.6 or later
  • setuptools >= 30.0.3.0

How to install

From PyPI

$ pip install gokinjo
With annoy backend
$ pip install "gokinjo[annoy]"

From source code

$ pip install git+https://github.com/momijiame/gokinjo.git

Quick start

step 1: generate example data

import numpy as np
x0 = np.random.rand(500) - 0.5
x1 = np.random.rand(500) - 0.5
X = np.array(list(zip(x0, x1)))
y = np.array([1 if i0 * i1 > 0 else 0 for i0, i1 in X])

step 2: plot the above

from matplotlib import pyplot as plt
plt.scatter(X[:, 0], X[:, 1], c=y)
plt.show()

not linearly separable data

It is not linearly separable obviously.

step 3: extract k-NN feature with K-Fold

from gokinjo import knn_kfold_extract
X_knn = knn_kfold_extract(X, y)

step 4: plot the above

plt.scatter(X_knn[:, 0], X_knn[:, 1], c=y)
plt.show()

linearly separable data

It looks like almost linearly separable.

Usage example

  • Please see examples in GitHub repository.

How to setup a development environment

$ pip install -e ".[develop]"
$ pytest

References

gokinjo's People

Contributors

momijiame avatar

Stargazers

Дiegushko Хименес avatar

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.