Skip to content

Instantly share code, notes, and snippets.

View f0nzie's full-sized avatar

Alfonso R. Reyes f0nzie

  • Oil Gains Analytics
  • Houston, Texas
View GitHub Profile
### A Pluto.jl notebook ###
# v0.19.9
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
@f0nzie
f0nzie / clickButton.jl
Last active August 11, 2024 15:45
Button events for Pluto.jl
### A Pluto.jl notebook ###
# v0.19.9
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
@f0nzie
f0nzie / sigmoid_derivative.py
Last active March 10, 2023 23:15
Compute the gradient (also called the slope or derivative) of the sigmoid function with respect to its input x. You can store the output of the sigmoid function into variables and then use it to calculate the gradient.
def sigmoid_derivative(x):
"""
Compute the gradient (also called the slope or derivative) of the sigmoid function with respect to its input x.
You can store the output of the sigmoid function into variables and then use it to calculate the gradient.
Arguments:
x -- A scalar or numpy array
Return:
ds -- Your computed gradient.
@f0nzie
f0nzie / normalize_rows.py
Created September 7, 2017 00:30
Normalize rows of a matrix by dividing rows by the normal of the matrix
def normalizeRows(x):
"""
Implement a function that normalizes each row of the matrix x (to have unit length).
Argument:
x -- A numpy matrix of shape (n, m)
Returns:
x -- The normalized (by row) numpy matrix. You are allowed to modify x.
"""
@f0nzie
f0nzie / PyTorch_linear_regression.Rmd
Created June 11, 2019 04:41
PyTorch - Linear Regression in Python
# One chunk - Linear Regression in Python
Source: https://medium.com/dsnet/linear-regression-with-pytorch-3dde91d60b50
Notebook: https://jvn.io/aakashns/e556978bda9343f3b30b3a9fd2a25012
```{r}
library(reticulate)
use_condaenv("pytorch37")
py_config()
#!/home/msfz751/.pyenv/shims/python3
# #!/usr/bin/env python
# change to location of your preferred virtual environment
# Source:
# https://itectec.com/ubuntu/ubuntu-taking-screenshot-of-a-specific-area-from-the-command-line/
import subprocess
import os
import sys
@f0nzie
f0nzie / rmarch.ipynb
Created December 12, 2019 17:42
rmarch.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@f0nzie
f0nzie / backward-pytorch.ipynb
Created December 11, 2019 22:39
backward pytorch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@f0nzie
f0nzie / .Rprofile
Last active July 16, 2019 01:10
.Rprofile for notebooks under ./work/notebooks
find_rsuite_root <- function(key = "PARAMETERS") rprojroot::find_root(key)
source(file.path(find_rsuite_root(), 'R', 'set_env.R'), chdir = TRUE)
.libPaths(c(normalizePath(sbox_path), normalizePath(lib_path), .libPaths()))
@f0nzie
f0nzie / mnist_digits_rstats.Rmd
Last active July 16, 2019 01:08
code in R for mnist_digits_rstats.Rmd
# Digits recognition on PNG images. R code
1. Added utility functions
2. Introspection on dim=2. Extra layers on tensor
3. Converting code from Python to R
## Objectives
1. Read PNG images instead of MNIST standard dataset.
2. Save the model
3. Read an unseen digit as PNG file using the saved model