Note: Great refresher/glossary on probability/statistics and related topics here
| Notation | Definition |
|---|---|
| X | Random variable |
| P(X) | Probability distribution over random variable X |
| X ~ P(X) | Random variable X follows (~) the probability distribution P(X) * |
| """ | |
| Convert .gitignore to .dockerignore: quick and dirty. | |
| This is a quick and dirty script to convert this: | |
| `__pycache__/` | |
| Into this: | |
| ``` | |
| __pycache__ | |
| */__pycache__ |
| /** | |
| * Lodash mixins for combinatorics | |
| * by: wassname & visangela | |
| * url: https://gist.github.com/wassname/a882ac3981c8e18d2556/edit | |
| * lodash contrib issue: https://github.com/node4good/lodash-contrib/issues/47 | |
| * lic: same as lodash | |
| * Inspired by python itertools: https://docs.python.org/2.7/library/itertools.html | |
| * | |
| * Usage: | |
| * permutations([0,1,2],2) // [[0,1],[0,2],[1,0],[1,2],[2,0],[2,1]] |
| /** | |
| * eslint.recommended (annotated) | |
| * ================ | |
| * Annotated defaults based on eslint.recommended | |
| * | |
| * @author: wassname | |
| * @license: MIT | |
| * @website https://gist.github.com/wassname/4693303388396c5f074b10865a969b43 | |
| * @date 2017-11-13T23:08 | |
| * @eslint-version: 4.11.0 |
| class RunningStats: | |
| """Computes running mean and standard deviation | |
| Adapted from: | |
| * | |
| <http://stackoverflow.com/questions/1174984/how-to-efficiently-\ | |
| calculate-a-running-standard-deviation> | |
| * <http://mathcentral.uregina.ca/QQ/database/QQ.09.02/carlos1.html> | |
| """ | |
| def __init__(self): |
| """ | |
| A weighted version of categorical_crossentropy for keras (2.0.6). This lets you apply a weight to unbalanced classes. | |
| @url: https://gist.github.com/wassname/ce364fddfc8a025bfab4348cf5de852d | |
| @author: wassname | |
| """ | |
| from keras import backend as K | |
| def weighted_categorical_crossentropy(weights): | |
| """ | |
| A weighted version of keras.objectives.categorical_crossentropy | |
| """ | |
| Examples: | |
| with figure_grid(5, 3) as grid: | |
| grid.next() | |
| # plot something | |
| grid.next() | |
| # plot something | |
| # ...etc | |
| """ | |
| A keras attention layer that wraps RNN layers. | |
| Based on tensorflows [attention_decoder](https://github.com/tensorflow/tensorflow/blob/c8a45a8e236776bed1d14fd71f3b6755bd63cc58/tensorflow/python/ops/seq2seq.py#L506) | |
| and [Grammar as a Foreign Language](https://arxiv.org/abs/1412.7449). | |
| date: 20161101 | |
| author: wassname | |
| url: https://gist.github.com/wassname/5292f95000e409e239b9dc973295327a | |
| """ |
Note: Great refresher/glossary on probability/statistics and related topics here
| Notation | Definition |
|---|---|
| X | Random variable |
| P(X) | Probability distribution over random variable X |
| X ~ P(X) | Random variable X follows (~) the probability distribution P(X) * |
| """ | |
| Url: https://gist.github.com/wassname/1393c4a57cfcbf03641dbc31886123b8 | |
| """ | |
| import unicodedata | |
| import string | |
| valid_filename_chars = "-_.() %s%s" % (string.ascii_letters, string.digits) | |
| char_limit = 255 | |
| def clean_filename(filename, whitelist=valid_filename_chars, replace=' '): |