Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Sudnya Diamos committed Mar 21, 2017
2 parents f0aafe6 + 5ee9f0c commit 855e7ed
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
4 changes: 2 additions & 2 deletions entry/next.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ set -o pipefail

RECORD=$1

# TODO actually eval record and write to answers.txt
echo $RECORD
printf "$RECORD," >> answers.txt
python eval.py . $RECORD >> answers.txt
29 changes: 27 additions & 2 deletions entry/prepare-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,41 @@
set -e
set -o pipefail

cp ../LICENSE LICENSE.txt
mkdir entry && cd entry

## Copy source code files
echo `pwd`
cp ../../LICENSE LICENSE.txt
cp ../setup.sh .
cp ../next.sh .
cp ../AUTHORS.txt .
cp ../dependencies.txt .
for f in 'eval' 'loader' 'network'
do
cp ../../${f}.py .
done

## Copy model files
model_dir=$1
for f in 'config.json' 'loader.pkl' 'model.data-*' 'model.index'
do
cp $model_dir/$f .
done

echo "==== running entry script on validation set ===="
validation=/deep/group/med/alivecor/sample2017/validation

rm -f answers.txt
for r in `cat $validation/RECORDS`; do
echo $r
ln -sf $validation/$r.hea .
ln -sf $validation/$r.mat .
./next.sh $r
rm $r.hea $r.mat
done

## Make zip
cd ..
zip -r entry.zip entry

## Cleanup
# rm -r entry
9 changes: 4 additions & 5 deletions network.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

import numpy as np
import tensorflow as tf
import tensorflow.contrib.layers as tfl

MOMENTUM_INIT = 0.5

Expand All @@ -18,9 +17,9 @@ def init_inference(self, config):
num_filters = layer['num_filters']
kernel_size = layer['kernel_size']
stride = layer['stride']
acts = tfl.convolution2d(acts, num_outputs=num_filters,
kernel_size=[kernel_size, 1],
stride=stride)
acts = tf.contrib.layers.convolution2d(acts, num_outputs=num_filters,
kernel_size=[kernel_size, 1],
stride=stride)

# Activations should emerge from the convolution with shape
# [batch_size, time (subsampled), 1, num_channels]
Expand All @@ -39,7 +38,7 @@ def init_inference(self, config):
# Reduce the time-dimension to make a single prediction
acts = tf.reduce_mean(acts, axis=1)

self.logits = tfl.fully_connected(acts, self.output_dim)
self.logits = tf.contrib.layers.fully_connected(acts, self.output_dim)
self.probs = tf.nn.softmax(self.logits)

def init_loss(self):
Expand Down

0 comments on commit 855e7ed

Please sign in to comment.