Skip to content

Commit

Permalink
additional whitening functions (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhyunglee authored and edublancas committed Nov 16, 2017
1 parent 7346372 commit efe7495
Show file tree
Hide file tree
Showing 43 changed files with 1,006 additions and 707 deletions.
8 changes: 4 additions & 4 deletions examples/config_sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ deconvolution:
lam: 20

neural_network_detector:
filename: detectnet1.ckpt
filename: detect_nn1.ckpt
threshold_spike: 0.5

neural_network_triage:
filename: triagenet1.ckpt
threshold_collision: 0.75
filename: triage_nn1.ckpt
threshold_collision: 0.9

neural_network_autoencoder:
filename: ae_31.ckpt
filename: ae_nn1.ckpt
8 changes: 4 additions & 4 deletions examples/config_sample_complete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,22 @@ neural_network_detector:
# must be a yaml file with the number and size of the filters, the file
# should be named exactly as your model but with yaml extension
# see yass/src/assets/models/ for an example
filename: detectnet1.ckpt
filename: detect_nn1.ckpt
# Threshold for spike event detection
threshold_spike: 0.5


neural_network_triage:
# same rules apply as in neural_network_detector.filename but the
# yaml file should only contain size (not number)
filename: triagenet1.ckpt
filename: triage_nn1.ckpt
# Threshold for clear/collision detection
threshold_collision: 0.75
threshold_collision: 0.9

neural_network_autoencoder:
# same rules apply as in neural_network_detector.filename but no
# yaml file is needed
filename: ae_31.ckpt
filename: ae_nn1.ckpt


############
Expand Down
Binary file removed src/yass/assets/models/ae_31.ckpt.data-00000-of-00001
Binary file not shown.
Binary file removed src/yass/assets/models/ae_31.ckpt.meta
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/yass/assets/models/ae_nn1.ckpt.meta
Binary file not shown.
1 change: 1 addition & 0 deletions src/yass/assets/models/ae_nn1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{n_input: 31, n_features: 3}
Binary file not shown.
Binary file added src/yass/assets/models/detect_nn1.ckpt.index
Binary file not shown.
Binary file added src/yass/assets/models/detect_nn1.ckpt.meta
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
filters: [16, 8]
# temporal filter size
size: 31
# number of neighboring channels
n_neighbors: 7
Binary file not shown.
Binary file removed src/yass/assets/models/detectnet1.ckpt.index
Binary file not shown.
Binary file removed src/yass/assets/models/detectnet1.ckpt.meta
Binary file not shown.
Binary file not shown.
Binary file added src/yass/assets/models/triage_nn1.ckpt.index
Binary file not shown.
Binary file added src/yass/assets/models/triage_nn1.ckpt.meta
Binary file not shown.
6 changes: 6 additions & 0 deletions src/yass/assets/models/triage_nn1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# num. of filters in each layer
filters: [16, 8]
# temporal filter size
size: 31
# number of neighboring channels
n_neighbors: 7
Binary file not shown.
Binary file removed src/yass/assets/models/triagenet1.ckpt.index
Binary file not shown.
Binary file removed src/yass/assets/models/triagenet1.ckpt.meta
Binary file not shown.
1 change: 0 additions & 1 deletion src/yass/assets/models/triagenet1.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions src/yass/augment/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .make import make_training_data
from .util import save_detect_network_params, save_triage_network_params, save_ae_network_params
39 changes: 34 additions & 5 deletions src/yass/augment/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def seq_rep(dumper, data):
CustomYAMLDumper.add_representer(seq_data, map_rep)


def save_detect_network_params(filters, size, output_path):
def save_detect_network_params(filters, size, n_neighbors, output_path):
"""Generate yaml file with parameters for a detect network
Parameters
Expand All @@ -38,28 +38,57 @@ def save_detect_network_params(filters, size, output_path):
size: int
Temporal filter size
n_neighbors: int
Number of neighboring channels
output_path: str
Where to save the file
"""
d = dict(filters=filters, size=size)
d = dict(filters=filters, size=size, n_neighbors=n_neighbors)

with open(output_path, 'w') as f:
yaml.dump(d, f, CustomYAMLDumper)


def save_triage_network_params(size, output_path):
def save_triage_network_params(filters, size, n_neighbors, output_path):
"""Generate yaml file with parameters for a triage network
Parameters
----------
size: list
filters: list
List filters size
size: int
Temporal filter size
n_neighbors: int
Number of neighboring channels
output_path: str
Where to save the file
"""
d = dict(filters=filters, size=size, n_neighbors=n_neighbors)

with open(output_path, 'w') as f:
yaml.dump(d, f, CustomYAMLDumper)

def save_ae_network_params(n_input, n_features, output_path):
"""Generate yaml file with parameters for a ae network
Parameters
----------
n_input: int
Dimension of input
n_features: int
Number of features
output_path: str
Where to save the file
"""
d = dict(size=size)
d = dict(n_input=n_input, n_features=n_features)

with open(output_path, 'w') as f:
yaml.dump(d, f, CustomYAMLDumper)

1 change: 0 additions & 1 deletion src/yass/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import yass
from yass.preprocessing import Preprocessor
from yass.neuralnet import NeuralNetDetector
from yass.mainprocess import Mainprocessor
from yass.deconvolute import Deconvolution

Expand Down
Loading

0 comments on commit efe7495

Please sign in to comment.