Skip to content

Commit 926466c

Browse files
committed
Merge branch '2.2-dev'
# Conflicts: # requirements.txt # setup.py # tutorials/wikiqa/dssm.ipynb
2 parents 2c46ad4 + b16e661 commit 926466c

File tree

85 files changed

+5367
-274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+5367
-274
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tutorials/* linguist-vendored

.travis.yml

+17-16
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,22 @@ cache: pip
55
sudo: true
66

77
env:
8-
global:
9-
- PYTHONPATH=$PYTHONPATH:$TRAVIS_BUILD_DIR/tests:$TRAVIS_BUILD_DIR/matchzoo
8+
global:
9+
- PYTHONPATH=$PYTHONPATH:$TRAVIS_BUILD_DIR/tests:$TRAVIS_BUILD_DIR/matchzoo
1010

1111
matrix:
12-
allow_failures:
13-
- os: osx
14-
include:
15-
- os: linux
16-
dist: trusty
17-
python: 3.6
18-
- os: osx
19-
language: generic
20-
env: PYTHON_VERSION=3.6
21-
- os: osx
22-
language: generic
23-
env: PYTHON_VERSION=3.7
12+
allow_failures:
13+
- os: osx
14+
include:
15+
- os: linux
16+
dist: trusty
17+
python: 3.6
18+
- os: osx
19+
osx_image: xcode10.2
20+
language: shell
2421

2522
install:
23+
- pip3 install -U pip
2624
- pip3 install -r requirements.txt
2725
- python3 -m nltk.downloader punkt
2826
- python3 -m nltk.downloader wordnet
@@ -31,7 +29,10 @@ install:
3129
script:
3230
- stty cols 80
3331
- export COLUMNS=80
34-
- make test
32+
- if [ "$TRAVIS_EVENT_TYPE" == "pull_request" ]; then make push; fi
33+
- if [ "$TRAVIS_EVENT_TYPE" == "push" ]; then make push; fi
34+
- if [ "$TRAVIS_EVENT_TYPE" == "cron" ]; then make cron; fi
35+
3536

3637
after_success:
37-
- codecov
38+
- codecov

Makefile

+56-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,70 @@
1+
# Usages:
2+
#
3+
# to install matchzoo dependencies:
4+
# $ make init
5+
#
6+
# to run all matchzoo tests, recommended for big PRs and new versions:
7+
# $ make test
8+
#
9+
# there are three kinds of tests:
10+
#
11+
# 1. "quick" tests
12+
# - run in seconds
13+
# - include all unit tests without marks and all doctests
14+
# - for rapid prototyping
15+
# - CI run this for all PRs
16+
#
17+
# 2. "slow" tests
18+
# - run in minutes
19+
# - include all unit tests marked "slow"
20+
# - CI run this for all PRs
21+
#
22+
# 3. "cron" tests
23+
# - run in minutes
24+
# - involves underministic behavoirs (e.g. network connection)
25+
# - include all unit tests marked "cron"
26+
# - CI run this on a daily basis
27+
#
28+
# to run quick tests, excluding time consuming tests and crons:
29+
# $ make quick
30+
#
31+
# to run slow tests, excluding normal tests and crons:
32+
# $ make slow
33+
#
34+
# to run crons:
35+
# $ make cron
36+
#
37+
# to run all tests:
38+
# $ make test
39+
#
40+
# to run CI push/PR tests:
41+
# $ make push
42+
#
43+
# to run docstring style check:
44+
# $ make flake
45+
146
init:
247
pip install -r requirements.txt
348

4-
TEST_ARGS = --doctest-modules --doctest-continue-on-failure --cov matchzoo/ --cov-report term-missing --cov-report html --cov-config .coveragerc matchzoo/ tests/ -W ignore::DeprecationWarning
49+
TEST_ARGS = -v --full-trace -l --doctest-modules --doctest-continue-on-failure --cov matchzoo/ --cov-report term-missing --cov-report html --cov-config .coveragerc matchzoo/ tests/ -W ignore::DeprecationWarning --ignore=matchzoo/contrib
550
FLAKE_ARGS = ./matchzoo --exclude=__init__.py,matchzoo/contrib
651

752
test:
853
pytest $(TEST_ARGS)
954
flake8 $(FLAKE_ARGS)
1055

56+
push:
57+
pytest -m 'not cron' $(TEST_ARGS) ${ARGS}
58+
flake8 $(FLAKE_ARGS)
59+
1160
quick:
12-
pytest -m 'not slow' $(TEST_ARGS)
61+
pytest -m 'not slow and not cron' $(TEST_ARGS) ${ARGS}
1362

1463
slow:
15-
pytest -m 'slow' $(TEST_ARGS)
64+
pytest -m 'slow and not cron' $(TEST_ARGS) ${ARGS}
65+
66+
cron:
67+
pytest -m 'cron' $(TEST_ARGS) ${ARGS}
1668

1769
flake:
18-
flake8 $(FLAKE_ARGS)
70+
flake8 $(FLAKE_ARGS) ${ARGS}

README.md

+3-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
> MatchZoo 是一个通用的文本匹配工具包,它旨在方便大家快速的实现、比较、以及分享最新的深度文本匹配模型。
99
1010
[![Python 3.6](https://img.shields.io/badge/python-3.6%20%7C%203.7-blue.svg)](https://www.python.org/downloads/release/python-360/)
11-
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/NTMC-Community/community)
1211
[![Pypi Downloads](https://img.shields.io/pypi/dm/matchzoo.svg?label=pypi)](https://pypi.org/project/MatchZoo/)
1312
[![Documentation Status](https://readthedocs.org/projects/matchzoo/badge/?version=master)](https://matchzoo.readthedocs.io/en/master/?badge=master)
1413
[![Build Status](https://travis-ci.org/NTMC-Community/MatchZoo.svg?branch=master)](https://travis-ci.org/NTMC-Community/MatchZoo/)
@@ -68,7 +67,6 @@ import matchzoo as mz
6867

6968
train_pack = mz.datasets.wiki_qa.load_data('train', task='ranking')
7069
valid_pack = mz.datasets.wiki_qa.load_data('dev', task='ranking')
71-
predict_pack = mz.datasets.wiki_qa.load_data('test', task='ranking')
7270
```
7371

7472
Preprocess your input data in three lines of code, keep track parameters to be passed into the model.
@@ -85,7 +83,6 @@ Make use of MatchZoo customized loss functions and evaluation metrics:
8583
ranking_task = mz.tasks.Ranking(loss=mz.losses.RankCrossEntropyLoss(num_neg=4))
8684
ranking_task.metrics = [
8785
mz.metrics.NormalizedDiscountedCumulativeGain(k=3),
88-
mz.metrics.NormalizedDiscountedCumulativeGain(k=5),
8986
mz.metrics.MeanAveragePrecision()
9087
]
9188
```
@@ -96,10 +93,6 @@ Initialize the model, fine-tune the hyper-parameters.
9693
model = mz.models.DSSM()
9794
model.params['input_shapes'] = preprocessor.context['input_shapes']
9895
model.params['task'] = ranking_task
99-
model.params['mlp_num_layers'] = 3
100-
model.params['mlp_num_units'] = 300
101-
model.params['mlp_num_fan_out'] = 128
102-
model.params['mlp_activation_func'] = 'relu'
10396
model.guess_and_fill_missing_params()
10497
model.build()
10598
model.compile()
@@ -109,10 +102,8 @@ Generate pair-wise training data on-the-fly, evaluate model performance using cu
109102

110103
```python
111104
train_generator = mz.PairDataGenerator(train_processed, num_dup=1, num_neg=4, batch_size=64, shuffle=True)
112-
113105
valid_x, valid_y = valid_processed.unpack()
114-
evaluate = mz.callbacks.EvaluateAllMetrics(model, x=valid_x, y=valid_y, batch_size=len(pred_x))
115-
106+
evaluate = mz.callbacks.EvaluateAllMetrics(model, x=valid_x, y=valid_y, batch_size=len(valid_x))
116107
history = model.fit_generator(train_generator, epochs=20, callbacks=[evaluate], workers=5, use_multiprocessing=False)
117108
```
118109

@@ -127,7 +118,7 @@ If you're interested in the cutting-edge research progress, please take a look a
127118

128119
## Install
129120

130-
MatchZoo is dependent on [Keras](https://github.com/keras-team/keras), please install one of its backend engines: TensorFlow, Theano, or CNTK. We recommend the TensorFlow backend. Two ways to install MatchZoo:
121+
MatchZoo is dependent on [Keras](https://github.com/keras-team/keras) and [Tensorflow](https://github.com/tensorflow/tensorflow). Two ways to install MatchZoo:
131122

132123
**Install MatchZoo from Pypi:**
133124

@@ -144,7 +135,7 @@ python setup.py install
144135
```
145136

146137

147-
## Models:
138+
## Models
148139

149140
1. [DRMM](https://github.com/NTMC-Community/MatchZoo/tree/master/matchzoo/models/drmm.py): this model is an implementation of <a href="http://www.bigdatalab.ac.cn/~gjf/papers/2016/CIKM2016a_guo.pdf">A Deep Relevance Matching Model for Ad-hoc Retrieval</a>.
150141

docs/Readme.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ pip install -r requirements.txt
1616
# Enter docs folder.
1717
cd docs
1818
# Use sphinx autodoc to generate rst.
19-
sphinx-apidoc -o source/ ../matchzoo/
19+
# usage: sphinx-apidoc [OPTIONS] -o <OUTPUT_PATH> <MODULE_PATH> [EXCLUDE_PATTERN,...]
20+
sphinx-apidoc -o source/ ../matchzoo/ ../matchzoo/contrib
2021
# Generate html from rst
2122
make clean
2223
make html

docs/source/conf.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@
2020
sys.path.insert(0, os.path.abspath('../../matchzoo/data_generator'))
2121
sys.path.insert(0, os.path.abspath('../../matchzoo/data_pack'))
2222
sys.path.insert(0, os.path.abspath('../../matchzoo/datasets'))
23+
sys.path.insert(0, os.path.abspath('../../matchzoo/embedding'))
2324
sys.path.insert(0, os.path.abspath('../../matchzoo/engine'))
2425
sys.path.insert(0, os.path.abspath('../../matchzoo/layers'))
2526
sys.path.insert(0, os.path.abspath('../../matchzoo/losses'))
26-
sys.path.insert(0, os.path.abspath('../../matchzoo/models'))
2727
sys.path.insert(0, os.path.abspath('../../matchzoo/metrics'))
28+
sys.path.insert(0, os.path.abspath('../../matchzoo/models'))
2829
sys.path.insert(0, os.path.abspath('../../matchzoo/preprocessors'))
29-
sys.path.insert(0, os.path.abspath('../../matchzoo/processor_units'))
30-
sys.path.insert(0, os.path.abspath('../../matchzoo/utils'))
3130
sys.path.insert(0, os.path.abspath('../../matchzoo/tasks'))
31+
sys.path.insert(0, os.path.abspath('../../matchzoo/utils'))
32+
3233

3334
# -- Project information -----------------------------------------------------
3435

@@ -39,7 +40,7 @@
3940
# The short X.Y version
4041
version = ''
4142
# The full version, including alpha/beta/rc tags
42-
release = '2.0'
43+
release = '2.1'
4344

4445

4546
# -- General configuration ---------------------------------------------------
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
matchzoo.auto.preparer package
2+
==============================
3+
4+
Submodules
5+
----------
6+
7+
matchzoo.auto.preparer.prepare module
8+
-------------------------------------
9+
10+
.. automodule:: matchzoo.auto.preparer.prepare
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
matchzoo.auto.preparer.preparer module
16+
--------------------------------------
17+
18+
.. automodule:: matchzoo.auto.preparer.preparer
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
24+
Module contents
25+
---------------
26+
27+
.. automodule:: matchzoo.auto.preparer
28+
:members:
29+
:undoc-members:
30+
:show-inheritance:

docs/source/matchzoo.auto.rst

+5-17
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
matchzoo.auto package
22
=====================
33

4-
Submodules
5-
----------
4+
Subpackages
5+
-----------
66

7-
matchzoo.auto.prepare module
8-
----------------------------
9-
10-
.. automodule:: matchzoo.auto.prepare
11-
:members:
12-
:undoc-members:
13-
:show-inheritance:
14-
15-
matchzoo.auto.tune module
16-
-------------------------
17-
18-
.. automodule:: matchzoo.auto.tune
19-
:members:
20-
:undoc-members:
21-
:show-inheritance:
7+
.. toctree::
228

9+
matchzoo.auto.preparer
10+
matchzoo.auto.tuner
2311

2412
Module contents
2513
---------------
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
matchzoo.auto.tuner.callbacks package
2+
=====================================
3+
4+
Submodules
5+
----------
6+
7+
matchzoo.auto.tuner.callbacks.callback module
8+
---------------------------------------------
9+
10+
.. automodule:: matchzoo.auto.tuner.callbacks.callback
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
matchzoo.auto.tuner.callbacks.lambda\_callback module
16+
-----------------------------------------------------
17+
18+
.. automodule:: matchzoo.auto.tuner.callbacks.lambda_callback
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
matchzoo.auto.tuner.callbacks.load\_embedding\_matrix module
24+
------------------------------------------------------------
25+
26+
.. automodule:: matchzoo.auto.tuner.callbacks.load_embedding_matrix
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:
30+
31+
matchzoo.auto.tuner.callbacks.save\_model module
32+
------------------------------------------------
33+
34+
.. automodule:: matchzoo.auto.tuner.callbacks.save_model
35+
:members:
36+
:undoc-members:
37+
:show-inheritance:
38+
39+
40+
Module contents
41+
---------------
42+
43+
.. automodule:: matchzoo.auto.tuner.callbacks
44+
:members:
45+
:undoc-members:
46+
:show-inheritance:

docs/source/matchzoo.auto.tuner.rst

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
matchzoo.auto.tuner package
2+
===========================
3+
4+
Subpackages
5+
-----------
6+
7+
.. toctree::
8+
9+
matchzoo.auto.tuner.callbacks
10+
11+
Submodules
12+
----------
13+
14+
matchzoo.auto.tuner.tune module
15+
-------------------------------
16+
17+
.. automodule:: matchzoo.auto.tuner.tune
18+
:members:
19+
:undoc-members:
20+
:show-inheritance:
21+
22+
matchzoo.auto.tuner.tuner module
23+
--------------------------------
24+
25+
.. automodule:: matchzoo.auto.tuner.tuner
26+
:members:
27+
:undoc-members:
28+
:show-inheritance:
29+
30+
31+
Module contents
32+
---------------
33+
34+
.. automodule:: matchzoo.auto.tuner
35+
:members:
36+
:undoc-members:
37+
:show-inheritance:

0 commit comments

Comments
 (0)