Skip to content
Extreme learning machine implemented by python3 with scikit-learn interface
Branch: master
Clone or download
Latest commit 816d829 Nov 30, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src [Fix] fix sigmoid overflow Nov 30, 2017
.gitignore [ADD]add ipython notebook Sep 3, 2015
LICENSE.txt [Fix] Fix License.txt Feb 8, 2017
README.md [Add] add license Jan 29, 2017
setup.py [Up] Nov 30, 2017

README.md

Python-ELM

Extreme Learning Machine implemented in Python3 with scikit-learn

This module has 3-type ELM

Require

  • scikit-learn: 0.18.1
  • numpy: 1.10.4 and up

How to install

pip install git+https://github.com/masaponto/python-elm

Usage

Basic

from elm import ELM
from sklearn.preprocessing import normalize
from sklearn.datasets import fetch_mldata
from sklearn.model_selection import train_test_split

db_name = 'australian'

data_set = fetch_mldata(db_name)
data_set.data = normalize(data_set.data)

X_train, X_test, y_train, y_test = train_test_split(
    data_set.data, data_set.target, test_size=0.4)

elm = ELM(hid_num=10).fit(X_train, y_train)

print("ELM Accuracy %0.3f " % elm.score(X_test, y_test))

For cross-validation

from elm import ELM
from sklearn.preprocessing import normalize
from sklearn.datasets import fetch_mldata
from sklearn.model_selection import KFold, cross_val_score

db_names = ['australian', 'iris']
hid_nums = [10, 20, 30]

for db_name in db_names:
    print(db_name)
    data_set = fetch_mldata(db_name)
    data_set.data = normalize(data_set.data)

    for hid_num in hid_nums:
        print(hid_num, end=' ')
        e = ELM(hid_num)

        ave = 0
        for i in range(10):
            cv = KFold(n_splits=5, shuffle=True)
            scores = cross_val_score(
                e, data_set.data, data_set.target, cv=cv, scoring='accuracy', n_jobs=-1)
            ave += scores.mean()

        ave /= 10

        print("Accuracy: %0.3f " % (ave))

License

MIT

You can’t perform that action at this time.