Skip to content

Instantly share code, notes, and snippets.

View jlertle's full-sized avatar

Jason Lee Ertle jlertle

  • Saint Petersburg, FL, US
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jlertle
jlertle / different-ssh-deploy-keys-multiple-private-repos-github-go-mod.md How to use different ssh deploy keys for multiple private github repositories with Golang Modules (go mod)

How to use different ssh deploy keys for multiple private github repositories with Go Modules

Let's assume you are using Go Modules and have a go.mod file that contains multiple private repos each with a different ssh key. How can you get go mod download to do the right thing -- i.e. use ssh key A with private repo A and ssh key B with private repo B?

Ok, here we go!

Let's assume you have some github.com user with multiple private repos:

https://github.com/someuser/private-repo-1

@jlertle
jlertle / keras_prob_dnn.py
Created March 25, 2021 08:31 — forked from sergeyprokudin/keras_prob_dnn.py
Simple Keras DNN with probabilistic Gaussian output (mean + variance)
import numpy as np
from keras.layers import Input, Dense
from keras.models import Model, Sequential
def dnn(n_inputs, n_outputs, n_hidden_layers=3, hlayer_size=128, probabilistic=True):
"""Defines simple DNN model
"""
x_input = Input(shape=[n_inputs])
@jlertle
jlertle / gauss_neg_loglikelihood_keras.py
Created March 25, 2021 08:31 — forked from sergeyprokudin/gauss_neg_loglikelihood_keras.py
Multivariate Gaussian Negative LogLikelihood Loss Keras
import keras.backend as K
import numpy as np
def gaussian_nll(ytrue, ypreds):
"""Keras implmementation of multivariate Gaussian negative loglikelihood loss function.
This implementation implies diagonal covariance matrix.
Parameters
----------
@jlertle
jlertle / tf2_tracing_estimators.md
Created October 18, 2020 19:12 — forked from saravanabalagi/tf2_tracing_estimators.md
Profiling Tensorflow Estimator in tf2

Based on Summary Trace API,

device_name = tf.test.gpu_device_name()
if not tf.test.is_gpu_available():
    raise SystemError('GPU device not found')
print('Found GPU at: {}'.format(device_name))
os.makedirs(os.path.join(args.exp_dir, 'plugins/profile'), exist_ok=True)
tf.summary.trace_on(graph=True, profiler=True)
tracing_params = params.copy()
@jlertle
jlertle / SNSTopic.py
Created February 6, 2020 22:36 — forked from stuartmyles/SNSTopic.py
A complete example of how to use Amazon Web Services Simple Notification Services from Python. This code uses the boto library https://github.com/boto/boto to create a topic, wait for a confirmation and then send a success message. Simply plug in your AWS access and secret keys, plus your email and mobile phone number.
# An example of how to use AWS SNS with Python's boto
# By Stuart Myles @smyles
# http://aws.amazon.com/sns/
# https://github.com/boto/boto
#
# Inspired by parts of the Ruby SWF SNS tutorial http://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-sns-tutorial-implementing-activities-poller.html
# And the Python SNS code in http://blog.coredumped.org/2010/04/amazon-announces-simple-notification.html and http://awsadvent.tumblr.com/post/37531769345/simple-notification-service-sns
import boto.sns as sns
import json
@jlertle
jlertle / Install
Last active February 3, 2020 17:34 — forked from ines/Install
Streamlit + spaCy
pip install streamlit
pip install spacy
python -m spacy download en_core_web_sm
python -m spacy download en_core_web_md
python -m spacy download en_core_web_lg
python -m spacy download de_core_news_sm
@jlertle
jlertle / ndcg_recsys.py
Created January 13, 2020 20:08 — forked from kell18/ndcg_recsys.py
NDCG for recommender systems
from math import log
import unittest
def dcg_at_k(scores):
assert scores
return scores[0] + sum(sc / log(ind, 2) for sc, ind in zip(scores[1:], range(2, len(scores)+1)))
def ndcg_at_k(predicted_scores, user_scores):
assert len(predicted_scores) == len(user_scores)
@jlertle
jlertle / rank_metrics.py
Created January 13, 2020 20:07 — forked from bwhite/rank_metrics.py
Ranking Metrics
"""Information Retrieval metrics
Useful Resources:
http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt
http://www.nii.ac.jp/TechReports/05-014E.pdf
http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf
http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf
Learning to Rank for Information Retrieval (Tie-Yan Liu)
"""
import numpy as np