Skip to content

Instantly share code, notes, and snippets.

View dvsseed's full-sized avatar
💭
I may be slow to respond.

曾令燊 dvsseed

💭
I may be slow to respond.
View GitHub Profile
@Chris-hughes10
Chris-hughes10 / timm.ipynb
Last active November 2, 2024 11:34
timm.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
'''
Use shap to build an a explainer.
:parameter
:param model: model instance (after fitting)
:param X_names: list
:param X_instance: array of size n x 1 (n,)
:param X_train: array - if None the model is simple machine learning, if not None then it's a deep learning model
:param task: string - "classification", "regression"
:param top: num - top features to display
:return
'''
Extract info for each layer in a keras model.
'''
def utils_nn_config(model):
lst_layers = []
if "Sequential" in str(model): #-> Sequential doesn't show the input layer
layer = model.layers[0]
lst_layers.append({"name":"input", "in":int(layer.input.shape[-1]), "neurons":0,
"out":int(layer.input.shape[-1]), "activation":None,
"params":0, "bias":0})
@fernandozamoraj
fernandozamoraj / ParsingDemo.cpp
Created September 29, 2021 02:50
ParsingCsvInCPlusPlus
// ParsingCsvDemo.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <vector>
using namespace std;
# Import libraries
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
@wzjoriv
wzjoriv / clustering.py
Last active August 11, 2024 20:47
Nearest Neighbor, K Nearest Neighbor and K Means (NN, KNN, KMeans) implemented only using PyTorch
import torch as th
"""
Author: Josue N Rivera (github.com/wzjoriv)
Date: 7/3/2021
Description: Snippet of various clustering implementations only using PyTorch
Full project repository: https://github.com/wzjoriv/Lign (A graph deep learning framework that works alongside PyTorch)
"""
def random_sample(tensor, k):
@ejmejm
ejmejm / pytorch_tips_yt_follow.ipynb
Created May 9, 2021 09:14
pytorch_tips_yt_follow.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@safijari
safijari / CMakeLists.txt
Created April 1, 2021 20:56
The code relevant to pybind11 video
cmake_minimum_required(VERSION 3.4...3.18)
project(pybindtest)
add_subdirectory(pybind11)
pybind11_add_module(module_name main.cpp)
@TheMuellenator
TheMuellenator / main.py
Last active October 26, 2024 01:06 — forked from angelabauer/main.py
Day 38 Step 5 L335 - Solution
#No Authentication
sheet_response = requests.post(sheet_endpoint, json=sheet_inputs)
#Basic Authentication
sheet_response = requests.post(
sheet_endpoint,
json=sheet_inputs,
auth=(
YOUR USERNAME,
YOUR PASSWORD,