Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Tuor committed Dec 17, 2016
1 parent 5bbf1d6 commit 42fa5cd
Show file tree
Hide file tree
Showing 85 changed files with 2,005 additions and 2,709 deletions.
3 changes: 0 additions & 3 deletions .cache/v/cache/lastfailed

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/antk.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

698 changes: 579 additions & 119 deletions .idea/workspace.xml

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions .ipynb_checkpoints/Untitled-checkpoint.ipynb

This file was deleted.

3 changes: 3 additions & 0 deletions .pypirc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[server-login]
username:tuora
password:Trex1000
Binary file added MNIST_data/t10k-images-idx3-ubyte.gz
Binary file not shown.
Binary file added MNIST_data/t10k-labels-idx1-ubyte.gz
Binary file not shown.
Binary file added MNIST_data/train-images-idx3-ubyte.gz
Binary file not shown.
Binary file added MNIST_data/train-labels-idx1-ubyte.gz
Binary file not shown.
Binary file modified __init__.pyc
Binary file not shown.
22 changes: 0 additions & 22 deletions antk.egg-info/PKG-INFO

This file was deleted.

42 changes: 0 additions & 42 deletions antk.egg-info/SOURCES.txt

This file was deleted.

1 change: 0 additions & 1 deletion antk.egg-info/dependency_links.txt

This file was deleted.

1 change: 0 additions & 1 deletion antk.egg-info/not-zip-safe

This file was deleted.

2 changes: 0 additions & 2 deletions antk.egg-info/requires.txt

This file was deleted.

1 change: 0 additions & 1 deletion antk.egg-info/top_level.txt

This file was deleted.

58 changes: 0 additions & 58 deletions antk/.ipynb_checkpoints/pandas_tutorial-checkpoint.ipynb

This file was deleted.

2 changes: 1 addition & 1 deletion antk/core/generic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_feed_list(batch, placeholderdict, supplement=None, train=1, debug=False)
:param supplement: A dictionary of numpy input matrices with keys corresponding to placeholders in placeholderdict, where the row size of the matrices do not correspond to the number of datapoints. For use with input data intended for `embedding_lookup`_.
:param dropouts: Dropout tensors in graph.
:param dropout_flag: Whether to use Dropout probabilities for feed forward.
:return: A feed dictionary with keys of placeholder tensors and values of numpy matrices, paired by key
:return: A feed dictionary with keys of placeholder tensors and values of numpy matrices
"""
ph, dt = [], []
datadict = batch.features.copy()
Expand Down
Binary file modified antk/core/generic_model.pyc
Binary file not shown.
3 changes: 2 additions & 1 deletion antk/core/node_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def fan_scale(initrange, activation, tensor_in):
initrange *= numpy.sqrt(2.0/float(tensor_in.get_shape().as_list()[1]))
else:
initrange *= (1.0/numpy.sqrt(float(tensor_in.get_shape().as_list()[1])))
return initrange



Expand Down Expand Up @@ -167,7 +168,7 @@ def lookup(dataname=None, data=None, indices=None, distribution='uniform',
:return: tf.nn.embedding_lookup(wghts, indices), wghts, indices
"""

if type(data) is loader.HotIndex:
if type(data) is loader.IndexVector:
if makeplace:
indices = tf.placeholder(tf.int32, [None], name=dataname)
wghts = weights(distribution, [data.dim, shape[1]], initrange=initrange, l2=l2, name=name+'_weights')
Expand Down
Binary file modified antk/core/node_ops.pyc
Binary file not shown.
15 changes: 11 additions & 4 deletions antk/lib/decorate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
import collections
import numpy

def required():
def wrapper(f):
def wrap(self, *args, **kwargs):
return f(self, *args, **kwargs)
return wrap
return wrapper

def flatten(container):
for i in container:
if isinstance(i, (list,tuple)):
Expand Down Expand Up @@ -56,7 +63,7 @@ def node_repr(tensor_node):
return new_function

def act(func):
func = node_op(func)
#func = node_op(func)
@functools.wraps(func)
def new_function(*args, **kwargs):
tensor_out = func(*args, **kwargs)
Expand Down Expand Up @@ -98,7 +105,7 @@ def ph_rep(ph):
return 'Placeholder("%s", shape=%s, dtype=%r)' % (ph.name, ph.get_shape().as_list(), ph.dtype)

def pholder(func):
func = node_op(func)
#func = node_op(func)
@functools.wraps(func)
def new_function(*args, **kwargs):
tensor_out = func(*args, **kwargs)
Expand All @@ -110,7 +117,7 @@ def ph_rep(ph):
return new_function

def variable(func):
func = node_op(func)
#func = node_op(func)
@functools.wraps(func)
def new_function(*args, **kwargs):
tensor_out = func(*args, **kwargs)
Expand Down Expand Up @@ -142,7 +149,7 @@ def loss_repr(loss):

def neural_net(func):
defaults = get_default_args(func)
func = node_op(func)
#func = node_op(func)
@functools.wraps(func)
def new_function(*args, **kwargs):
if 'activation' not in defaults:
Expand Down
Binary file modified antk/lib/decorate.pyc
Binary file not shown.
5 changes: 5 additions & 0 deletions antk/models/configs/res_concat.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
out linear(1, True)
-h1 residual_dnn($layers, activation=$activation, skiplayers=2, bn=$bn, keep_prob=$keep_prob)
--x concat($concat_size)
---huser lookup(dataname='user', initrange=$initrange, shape=[None, $uembed])
---hitem lookup(dataname='item', initrange=$initrange, shape=[None, $iembed])
5 changes: 5 additions & 0 deletions antk/models/configs/res_concat.config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
out linear(1, True)
-h1 dnn($layers, activation='tanhlecun', bn=True, keep_prob=.95)
--x concat(24)
---huser lookup(dataname='user', initrange=$initrange, shape=[None, $embed])
---hitem lookup(dataname='item', initrange=$initrange, shape=[None, $embed])
2 changes: 1 addition & 1 deletion antk/models/dnn_concat_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from antk.core import generic_model

def dnn_concat(data, configfile,
layers=[16, 8],
layers=[16, 8, 8],
activation='tanhlecun',
initrange=1e-3,
bn=True,
Expand Down
Binary file modified antk/models/dnn_concat_model.pyc
Binary file not shown.
57 changes: 57 additions & 0 deletions antk/models/res_concat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import tensorflow as tf
from antk.core import config
from antk.core import generic_model

def dnn_concat(data, configfile,
layers=[16, 8],
activation='tanhlecun',
initrange=1e-3,
bn=True,
keep_prob=.95,
concat_size=24,
uembed=32,
iembed=32,
learnrate=.00001,
verbose=True,
epochs=10,
maxbadcount=20,
mb=2000,
eval_rate=500):

with tf.name_scope('ant_graph'):
ant = config.AntGraph(configfile,
data=data.dev.features,
marker='-',
graph_name='dnn_concat',
variable_bindings={'layers': layers,
'activation': activation,
'initrange': initrange,
'bn': bn,
'keep_prob': keep_prob,
'concat_size': concat_size,
'uembed': uembed,
'iembed': iembed,
})

y = ant.tensor_out
y_ = tf.placeholder("float", [None, None], name='Target')
ant.placeholderdict['ratings'] = y_ # put the new placeholder in the graph for training
with tf.name_scope('objective'):
objective = tf.reduce_sum(tf.square(y_ - y))
with tf.name_scope('dev_rmse'):
dev_rmse = tf.sqrt(tf.div(tf.reduce_sum(tf.square(y - y_)), data.dev.num_examples))
with tf.name_scope('training'):
model = generic_model.Model(objective, ant.placeholderdict,
mb=mb,
learnrate=learnrate,
verbose=verbose,
maxbadcount=maxbadcount,
epochs=epochs,
evaluate=dev_rmse,
predictions=y,
model_name='res_concat',
make_histograms=False,
save=False,
tensorboard=False)
model.train(data.train, dev=data.dev, eval_schedule=eval_rate)
return model
17 changes: 0 additions & 17 deletions docs/_build/doctest/output.txt

This file was deleted.

Binary file removed docs/_build/doctrees/antk.antk.core.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/antk.antk.datascripts.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/antk.antk.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/antk.antk.lib.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/antk.antk.models.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/antk.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/api.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/config.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/generic_model.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/loader.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/models.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/node_ops.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/_build/html/_modules/dnn_concat_model.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ <h1>Source code for dnn_concat_model</h1><div class="highlight"><pre>
<span class="kn">from</span> <span class="nn">antk.core</span> <span class="kn">import</span> <span class="n">generic_model</span>

<div class="viewcode-block" id="dnn_concat"><a class="viewcode-back" href="../models.html#dnn_concat_model.dnn_concat">[docs]</a><span class="k">def</span> <span class="nf">dnn_concat</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">configfile</span><span class="p">,</span>
<span class="n">layers</span><span class="o">=</span><span class="p">[</span><span class="mi">16</span><span class="p">,</span> <span class="mi">8</span><span class="p">],</span>
<span class="n">layers</span><span class="o">=</span><span class="p">[</span><span class="mi">16</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">8</span><span class="p">],</span>
<span class="n">activation</span><span class="o">=</span><span class="s1">&#39;tanhlecun&#39;</span><span class="p">,</span>
<span class="n">initrange</span><span class="o">=</span><span class="mf">1e-3</span><span class="p">,</span>
<span class="n">bn</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/_build/html/_modules/generic_model.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ <h1>Source code for generic_model</h1><div class="highlight"><pre>
<span class="sd"> :param supplement: A dictionary of numpy input matrices with keys corresponding to placeholders in placeholderdict, where the row size of the matrices do not correspond to the number of datapoints. For use with input data intended for `embedding_lookup`_.</span>
<span class="sd"> :param dropouts: Dropout tensors in graph.</span>
<span class="sd"> :param dropout_flag: Whether to use Dropout probabilities for feed forward.</span>
<span class="sd"> :return: A feed dictionary with keys of placeholder tensors and values of numpy matrices, paired by key</span>
<span class="sd"> :return: A feed dictionary with keys of placeholder tensors and values of numpy matrices</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">ph</span><span class="p">,</span> <span class="n">dt</span> <span class="o">=</span> <span class="p">[],</span> <span class="p">[]</span>
<span class="n">datadict</span> <span class="o">=</span> <span class="n">batch</span><span class="o">.</span><span class="n">features</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
Expand Down

0 comments on commit 42fa5cd

Please sign in to comment.