Skip to content

Instantly share code, notes, and snippets.

View svpino's full-sized avatar
🏠
Working from home

Santiago Valdarrama svpino

🏠
Working from home
View GitHub Profile
@svpino
svpino / instructions.md
Last active September 12, 2023 03:39
Installing TensorFlow on Apple Silicon
@svpino
svpino / mnist.py
Created February 24, 2021 01:46
CNN to solve MNIST dataset
import numpy as np
import pandas as pd
import random
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Flatten, Conv2D, Dense, MaxPooling2D
from tensorflow.keras.optimizers import SGD
from tensorflow.keras.utils import to_categorical
@svpino
svpino / convolutions.py
Created February 8, 2021 20:37
Convolutions using OpenCV
import cv2
import numpy as np
from matplotlib import pyplot as plt
image = cv2.imread("building.jpg")
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
horizontal_edges = cv2.filter2D(image, -1, np.array([
[-1, -2, -1],
[ 0, 0, 0],
@svpino
svpino / neural-network-from-scratch.py
Last active July 25, 2023 18:04
An implementation of a neural network from scratch
import numpy as np
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def neural_network(X, y):
learning_rate = 0.1
W1 = np.random.rand(2, 4)
W2 = np.random.rand(4, 1)
@svpino
svpino / on-start.sh
Last active June 23, 2023 11:34
SageMaker Notebook Instance - Lifecycle configuration - New Conda Environment
#!/bin/bash
set -e
sudo -u ec2-user -i <<'EOF'
ENVIRONMENT=python38
VERSION=3.8
conda create -y -n "$ENVIRONMENT" python="$VERSION" tensorflow-gpu numpy opencv pandas pyyaml
@svpino
svpino / profile-picture.ipynb
Created September 4, 2020 20:47
profile-picture.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@svpino
svpino / ai-generated-content.ipynb
Created August 11, 2020 20:20
ai-generated-content.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@svpino
svpino / twitter-unfollow.ipynb
Created August 11, 2020 18:58
twitter-unfollow.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@svpino
svpino / episode01.py
Last active September 2, 2020 06:36
It's different in Python
# Using Python's enumerate built-in function
# Let's assume we want to print every day from the following
# list together with its position in the list (starting at 1.)
days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
""" Solution 1. Works, but Python has a better way """
# We can use a control variable that we increment for every
# value in the list.
@svpino
svpino / multiplying-values-using-neural-networks-keras.ipynb
Last active January 23, 2020 03:12
Multiplying values using a neural network in Keras and TensorFlow 2
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.