Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ComputerVisionLaboratory/cvlab_toolbox
CVLAB's tool box
https://github.com/ComputerVisionLaboratory/cvlab_toolbox
Last synced: 2 days ago
JSON representation
CVLAB's tool box
- Host: GitHub
- URL: https://github.com/ComputerVisionLaboratory/cvlab_toolbox
- Owner: ComputerVisionLaboratory
- Created: 2017-10-04T05:24:14.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-08-02T04:52:47.000Z (over 1 year ago)
- Last Synced: 2024-08-03T02:10:12.918Z (3 months ago)
- Language: Python
- Size: 18.2 MB
- Stars: 13
- Watchers: 4
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cvlab_toolbox
This is the repository of CVLAB toolbox## Usage
- Scikit-learn API
```python
import numpy as np
from numpy.random import randint, rand
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from cvt.models import KernelMSMdim = 100
n_class = 4
n_train, n_test = 20, 5# input data X is list of vector sets (list of 2d-arrays)
X_train = [rand(randint(10, 20), dim) for i in range(n_train)]
X_test = [rand(randint(10, 20), dim) for i in range(n_test)]# labels y is 1d-array
y_train = randint(0, n_class, n_train)
y_test = randint(0, n_class, n_test)model = KernelMSM(n_subdims=3, sigma=0.01)
# fit
model.fit(X_train, y_train)
# predict
pred = model.predict(X_test)print(accuracy_score(pred, y_test))
```
## Install
- pip
```bash
pip install -U git+https://github.com/ComputerVisionLaboratory/cvlab_toolbox
```## Coding styles
- Follow `PEP8` as much as possible
- [English](https://www.python.org/dev/peps/pep-0008/)
- [日本語](http://pep8-ja.readthedocs.io/ja/latest/)
- Write a description as **docstring**
```python
def PCA(X, whiten = False):
'''
apply PCA
components, explained_variance = PCA(X)Parameters
----------
X: ndarray, shape (n_samples, n_features)
matrix of input vectorswhiten: boolean
if it is True, the data is treated as whitened
on each dimensions (average is 0 and variance is 1)Returns
-------
components: ndarray, shape (n_features, n_features)
the normalized component vectorsexplained_variance: ndarray, shape (n_features)
the variance of each vectors
'''...
```## Contribution rules
1. Make a pull request
2. Ask some lab members to review the code
3. when all agreements are taken, ask any admin member to merge it