Skip to content

Instantly share code, notes, and snippets.

View devanshuDesai's full-sized avatar

Devanshu Desai devanshuDesai

  • Google
  • Sunnyvale, CA
View GitHub Profile
@devanshuDesai
devanshuDesai / pipeline_dodgers.py
Created November 9, 2019 04:19
An example of a feature engineering + model pipeline I made
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import FunctionTransformer
from sklearn.preprocessing import OneHotEncoder
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import StratifiedKFold
from sklearn.pipeline import Pipeline
from sklearn.decomposition import PCA
from sklearn.linear_model import LogisticRegression
@devanshuDesai
devanshuDesai / mnist_dodgers.py
Last active March 14, 2023 19:13
A neural network written in PyTorch with > 99% accuracy on the MNIST dataset.
import torch
from torch import nn
from tqdm import tqdm_notebook
class CNN(nn.Module):
def __init__(self, input_size, num_classes):
"""
init convolution and activation layers
Args:
input_size: (1,28,28)