Skip to content

Instantly share code, notes, and snippets.

View s4nyam's full-sized avatar
:octocat:
Do Git! Go Green!✅

s4nyam s4nyam

:octocat:
Do Git! Go Green!✅
View GitHub Profile
@s4nyam
s4nyam / colormaps.txt
Created February 10, 2024 14:54
All Matplotlib ColorMaps using plt.colormaps()
['magma',
'inferno',
'plasma',
'viridis',
'cividis',
'twilight',
'twilight_shifted',
'turbo',
'Blues',
'BrBG',
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.animation import FuncAnimation
def ackley(x, y):
a = 20
b = 0.2
c = 2 * np.pi
term1 = -a * np.exp(-b * np.sqrt((x**2 + y**2) / 2))
@s4nyam
s4nyam / optim-ec.py
Created August 21, 2023 14:12
A simple EC based optimisation for maximising sin(x)cos(y) with fitness landscape
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
def fitness(x, y):
return np.sin(x) * np.cos(y)
mutation_range = 0.02
population = np.array([[np.random.uniform(-5, 5), np.random.uniform(-5, 5)]])
@s4nyam
s4nyam / HexCA.py
Last active June 26, 2023 07:45
Simulate HexCA inspired from Hugo Cisneros Thesis, Plots and save the neighborhood used in HexCA
import pygame
import numpy as np
# Setting parameters
width = 100
height = 100
cell_size = 15
spacing = 2
live_color = (0, 150, 0)
@s4nyam
s4nyam / lone_glider
Created March 29, 2023 12:13
Watch a glider take flight in a 2D world with the power of Python and Matplotlib's animation magic ✨
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from matplotlib.animation import PillowWriter
# Define the initial state of the grid
grid = np.zeros((100, 100))
grid[1, 2] = 1
grid[2, 3] = 1
grid[3, 1:4] = 1
@s4nyam
s4nyam / NorthernLights.py
Created March 24, 2023 00:15
Check out this awesome #Python code using #Pygame to create a stunning #NorthernLights animation with realistic colors! 🌌🎨👨‍💻 #coding #programming
import pygame
import random
# Set up the Pygame window
pygame.init()
screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption("Northern Lights")
# Define some colors
black = (0, 0, 0)
@s4nyam
s4nyam / DeepLearningFaces.md
Created October 16, 2016 07:02 — forked from jdsgomes/DeepLearningFaces.md
Deep Learning for Face Recognition

Deep Learning for Face Recognition (May 2016)

Popular architectures

  • FaceNet (Google)
    • They use a triplet loss with the goal of keeping the L2 intra-class distances low and inter-class distances high
  • DeepID (Hong Kong University)
    • They use verification and identification signals to train the network. Afer each convolutional layer there is an identity layer connected to the supervisory signals in order to train each layer closely (on top of normal backprop)
  • DeepFace (Facebook)
    • Convs followed by locally connected, followed by fully connected
@s4nyam
s4nyam / fr
Created October 16, 2016 07:01 — forked from vishvanand/fr
# import the necessary packages
import argparse
import datetime
import imutils
import time
import cv2
from facerec.feature import Fisherfaces
from facerec.classifier import NearestNeighbor
from facerec.model import PredictableModel