Skip to content

Instantly share code, notes, and snippets.

View SHi-ON's full-sized avatar
🎯
focused

Shawyan SHi-ON

🎯
focused
View GitHub Profile
@miwong
miwong / mnist_tutorial_jsma.md
Created September 21, 2018 20:07
CleverHans Tutorial - MNIST with JSMA

MNIST tutorial: crafting adversarial examples with the Jacobian-based saliency map attack

This tutorial explains how to use CleverHans together with a TensorFlow model to craft adversarial examples, using the Jacobian-based saliency map approach. This attack is described in details by the following paper. We assume basic knowledge of TensorFlow. If you need help getting CleverHans installed before getting started, you may find our MNIST tutorial on the fast gradient sign method to be useful.

@recamshak
recamshak / sparse_memmap_dbscan.py
Last active August 2, 2022 17:21
sklearn DBSCAN with O(n) memory budget
from sklearn.datasets import make_blobs
from sklearn.cluster import dbscan
from sklearn.cluster._dbscan_inner import dbscan_inner
from sklearn.metrics import pairwise_distances_chunked
from scipy.sparse import csr_matrix
import numpy as np
# dataset
n = 50000
ds, _ = make_blobs(n, 100, 50)
@Mlawrence95
Mlawrence95 / confusion_matrix.py
Last active March 26, 2024 10:25
Python: create a confusion matrix across two columns in a Pandas dataframe having only categorical data
import pandas as pd
def confusion_matrix(df: pd.DataFrame, col1: str, col2: str):
"""
Given a dataframe with at least
two categorical columns, create a
confusion matrix of the count of the columns
cross-counts
use like:
@zrruziev
zrruziev / NUMA node problem.md
Last active May 8, 2024 07:44
Fixing "successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero" problem

What is NUMA (Non-Uniformed Memory Access)

Non-Uniform Memory Access (NUMA) is one of the computer memory design methods used in multiprocessor systems, and the time to access the memory varies depending on the relative position between the memory and the processor. In the NUMA architecture, when a processor accesses its local memory, it is faster than when it accesses the remote memory. Remote memory refers to memory that is connected to another processor, and local memory refers to memory that is connected to its own processor. In other words, it is a technology to increase memory access efficiency while using multiple processors on one motherboard. When a specific processor runs out of memory, it monopolizes the bus by itself, so other processors have to play. , and designate 'access only here', and call it a NUMA node.

1. Check Nodes

lspci | grep -i nvidia
  
01:00.0 VGA compatible controller: NVIDIA Corporation TU106 [GeForce RTX 2060 12GB] (rev a1)