-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from oujago/develop
integrate auto test development tools
- Loading branch information
Showing
29 changed files
with
322 additions
and
649 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[run] | ||
omit = test/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ __pycache__/ | |
*.py[cod] | ||
*$py.class | ||
|
||
|
||
.pypirc | ||
.idea | ||
docs/_build/* | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
language: python | ||
sudo: false | ||
python: | ||
- "3.3" | ||
- "3.4" | ||
- "3.5" | ||
- "3.6" | ||
- "pypy3" | ||
addons: | ||
apt: | ||
packages: | ||
- libblas-dev | ||
- liblapack-dev | ||
before_install: | ||
- pip install -U pip | ||
install: | ||
- travis_wait travis_retry pip install -r requirements.txt | ||
- travis_retry pip install python-coveralls | ||
- travis_retry python setup.py install | ||
script: py.test --runslow --cov-config=.coveragerc | ||
after_success: | ||
- coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Changelog | ||
--------- | ||
|
||
0.1 (2017-04-11) | ||
~~~~~~~~~~~~~~~~ | ||
|
||
First release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# misc | ||
include LICENSE | ||
include requirements.txt | ||
include CHANGES.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import numpy as np | ||
from sklearn.datasets import load_digits | ||
|
||
import npdl | ||
|
||
|
||
def main(max_iter): | ||
# prepare | ||
npdl.utils.random.set_seed(1234) | ||
|
||
# data | ||
digits = load_digits() | ||
|
||
X_train = digits.data | ||
X_train /= np.max(X_train) | ||
|
||
Y_train = digits.target | ||
n_classes = np.unique(Y_train).size | ||
|
||
# model | ||
model = npdl.model.Model() | ||
model.add(npdl.layers.Dense(n_out=500, n_in=64, activation=npdl.activation.ReLU())) | ||
model.add(npdl.layers.Dense(n_out=n_classes, activation=npdl.activation.Softmax())) | ||
model.compile(loss=npdl.objectives.SCCE(), optimizer=npdl.optimizers.SGD(lr=0.005)) | ||
|
||
# train | ||
model.fit(X_train, npdl.utils.data.one_hot(Y_train), max_iter=max_iter, validation_split=0.1) | ||
|
||
|
||
if __name__ == '__main__': | ||
main(150) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
import numpy as np | ||
from sklearn.datasets import fetch_mldata | ||
|
||
import npdl | ||
|
||
|
||
def main(max_iter): | ||
# data | ||
print("loading data ...") | ||
mnist = fetch_mldata('MNIST original', data_home=os.path.join(os.path.dirname(__file__), './data')) | ||
X_train = mnist.data / 255.0 | ||
y_train = mnist.target | ||
n_classes = np.unique(y_train).size | ||
|
||
# model | ||
print("building model ...") | ||
model = npdl.Model() | ||
model.add(npdl.layers.Dense(n_out=500, n_in=784, activation=npdl.activation.ReLU())) | ||
model.add(npdl.layers.Dense(n_out=n_classes, activation=npdl.activation.Softmax())) | ||
model.compile(loss=npdl.objectives.SCCE(), optimizer=npdl.optimizers.SGD(lr=0.001)) | ||
|
||
# train | ||
print("train model ... ") | ||
model.fit(X_train, npdl.utils.data.one_hot(y_train), max_iter=max_iter, validation_split=0.1) | ||
|
||
|
||
if __name__ == '__main__': | ||
main(150) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
|
||
import os | ||
import numpy as np | ||
from sklearn.datasets import fetch_mldata | ||
|
||
import npdl | ||
|
||
|
||
def main(max_iter): | ||
seed = 100 | ||
nb_data = 1000 | ||
|
||
print("loading data ...") | ||
mnist = fetch_mldata('MNIST original', data_home=os.path.join(os.path.dirname(__file__), './data')) | ||
X_train = mnist.data.reshape((-1, 1, 28, 28)) / 255.0 | ||
np.random.seed(seed) | ||
X_train = np.random.permutation(X_train)[:nb_data] | ||
y_train = mnist.target | ||
np.random.seed(seed) | ||
y_train = np.random.permutation(y_train)[:nb_data] | ||
n_classes = np.unique(y_train).size | ||
|
||
print("building model ...") | ||
net = npdl.Model() | ||
net.add(npdl.layers.Convolution(1, (3, 3), input_shape=(None, 1, 28, 28))) | ||
net.add(npdl.layers.MeanPooling((2, 2))) | ||
net.add(npdl.layers.Flatten()) | ||
net.add(npdl.layers.Softmax(n_out=n_classes)) | ||
net.compile() | ||
|
||
print("train model ... ") | ||
net.fit(X_train, npdl.utils.data.one_hot(y_train), max_iter=max_iter, validation_split=0.1) | ||
|
||
|
||
if __name__ == '__main__': | ||
main(10) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,5 @@ | |
from .model import Model | ||
|
||
|
||
|
||
__version__ = '0.1.0' | ||
__version__ = "0.1.0" | ||
|
Oops, something went wrong.