Skip to content

Instantly share code, notes, and snippets.

View maulberto3's full-sized avatar

Mauricio maulberto3

View GitHub Profile
@bstriner
bstriner / keras_backend_optimizer_example.py
Last active October 13, 2021 01:23
How to use Keras backend and optimizers directly outside of a Keras model
from keras.optimizers import Adam
from keras import backend as K
from keras.datasets import mnist
from keras.utils.np_utils import to_categorical
from keras.metrics import categorical_accuracy
from keras.initializations import glorot_uniform, zero
import numpy as np
# inputs and targets are placeholders
input_dim = 28*28
@zcaceres
zcaceres / Eyeballing-This.md
Last active July 18, 2025 14:52
Understanding Binding and 'this' in Javascript by zach.dev

How to Eyeball Your β€˜This’ Context in Javascript

The early programmer struggles with the Javascript keyword this. But understanding your this context is easier than it seems.

This is all about where a function is invoked. Often, early programmers worry about where the function was declared. Perhaps the function was declared in a specific file or a particular object. Surely this changes it's this!

Nope.

@calclavia
calclavia / keras_pg.py
Created June 6, 2017 18:48
Monte Carlo Policy Gradient in Keras
import gym
import numpy as np
from keras.models import Model
from keras.layers import *
from keras import backend as K
from collections import deque
def one_hot(index, categories):
@ByungSunBae
ByungSunBae / Continuous_A2C_test.py
Created December 28, 2017 15:07
A2C with continuous action space test
import tensorflow as tf
from tensorflow import layers
from tensorflow.contrib.layers import xavier_initializer
import gym
import numpy as np
from collections import deque
from collections import namedtuple

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

def model(data):
alpha = torch.tensor(6.0)
beta = torch.tensor(10.0)
pay_probs = pyro.sample('pay_probs', dist.Beta(alpha, beta).expand(3).independent(1))
normalized_pay_probs = pay_probs / torch.sum(pay_probs)
with pyro.iarange('data_loop', len(data)):
pyro.sample('obs', dist.Categorical(probs=normalized_pay_probs), obs=data)
@mwaskom
mwaskom / palettes.png
Last active September 19, 2025 16:43
Show all seaborn palettes and simulate what they look like with various color vision deficiencies. (The 10-element seaborn palettes will be part of the forthcoming 0.9 release).
palettes.png
@kauffmanes
kauffmanes / install_anaconda.md
Last active November 27, 2025 21:47
Install Anaconda on Windows Subsystem for Linux (WSL)

Thanks everyone for commenting/contributing! I made this in college for a class and I no longer really use the technology. I encourage you all to help each other, but I probably won't be answering questions anymore.

This article is also on my blog, too.

Note: $ denotes the start of a command. Don't actually type this.

Steps to Install Anaconda on Windows Ubuntu Terminal

  1. Install WSL (Ubuntu for Windows - can be found in Windows Store). I recommend the latest version (I'm using 18.04) because there are some bugs they worked out during 14/16 (microsoft/WSL#785)
  2. Go to https://repo.continuum.io/archive to find the list of Anaconda releases
  3. Select the release you want. I have a 64-bit computer, so I chose the latest release ending in x86_64.sh. If I had a 32-bit computer, I'd select the x86.sh version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I chose `Ana
@mandieq
mandieq / selector_heatmap.py
Created September 20, 2018 15:58
Heatmap example - python / dash
import plotly.plotly as py
import plotly.graph_objs as go
import plotly.figure_factory as ff
import plotly.offline as offline
import pandas as pd
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.