This file contains hidden or 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
| import numpy as np | |
| import cPickle as pickle | |
| import joblib | |
| from moseq.train import ARHMM, train_model | |
| from moseq.train.util import whiten_all | |
| from collections import OrderedDict | |
| from syllables import analysis | |
| # Load the data | |
| with open("/data/efs/drugs/alldoses/dataset.pkl","r") as f: |
This file contains hidden or 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
| def f(x): | |
| assert x != 0, 'Do not pass zero!' | |
| return x * x |
This file contains hidden or 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
| def f(n): | |
| z = [] | |
| # We ask you to tell us the element dtype of the list | |
| autograph.set_element_type(z, tf.int32) | |
| for i in range(n): | |
| z.append(i) | |
| # when you're done with the list, stack it | |
| # (this is just like np.stack) | |
| return autograph.stack(z) |
This file contains hidden or 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
| def f(n): | |
| if n >= 0: | |
| while n < 5: | |
| n += 1 | |
| print(n) | |
| return n |
This file contains hidden or 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
| def collatz(a): | |
| counter = 0 | |
| while a != 1: | |
| if a % 2 == 0: | |
| a = a // 2 | |
| else: | |
| a = 3 * a + 1 | |
| counter = counter + 1 | |
| return counter |
This file contains hidden or 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
| with tf.Graph().as_default(): | |
| x_tensor = tf.constant(9.0) | |
| # The converted function works like a regular op: tensors in, tensors out. | |
| huber_loss_tensor = huber_loss(x_tensor) | |
| with tf.Session() as sess: | |
| print('TensorFlow result: %2.2f\n' % sess.run(huber_loss_tensor)) |
This file contains hidden or 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
| def tf__huber_loss(a): | |
| with tf.name_scope('huber_loss'): | |
| def if_true(): | |
| with tf.name_scope('if_true'): | |
| loss = a * a / 2 | |
| return loss, | |
| def if_false(): | |
| with tf.name_scope('if_false'): |
This file contains hidden or 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
| @autograph.convert() | |
| def huber_loss(a): | |
| if tf.abs(a) <= delta: | |
| loss = a * a / 2 | |
| else: | |
| loss = delta * (tf.abs(a) - delta / 2) | |
| return loss |
This file contains hidden or 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
| def huber_loss(a): | |
| if tf.abs(a) <= delta: | |
| loss = a * a / 2 | |
| else: | |
| loss = delta * (tf.abs(a) - delta / 2) | |
| return loss |
This file contains hidden or 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
| config defaultToCurrentScreen false | |
| # Shows app icons and background apps, spreads icons in the same place. | |
| config windowHintsShowIcons true | |
| config windowHintsIgnoreHiddenWindows false | |
| config windowHintsSpread true | |
| config nudgePercentOf screenSize | |
| config resizePercentOf screenSize | |
| bind e:cmd;alt hint QWERASDFZXCV # use whatever keys you want |
NewerOlder