Skip to content

Instantly share code, notes, and snippets.

View Hsankesara's full-sized avatar
🙂
Learning

Heet Sankesara Hsankesara

🙂
Learning
View GitHub Profile
@Hsankesara
Hsankesara / plasticc-eda.ipynb
Created July 12, 2019 18:13
Exploring the Universe: Explored deep insights from The Photometric LSST Astronomical Time-Series data.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Hsankesara
Hsankesara / Image2Vector.py
Last active June 23, 2021 17:23
Implementation of Prototypical Network
class Net(nn.Module):
"""
Image2Vector CNN which takes image of dimension (28x28x3) and return column vector length 64
"""
def sub_block(self, in_channels, out_channels=64, kernel_size=3):
block = torch.nn.Sequential(
torch.nn.Conv2d(kernel_size=kernel_size, in_channels=in_channels, out_channels=out_channels, padding=1),
torch.nn.BatchNorm2d(out_channels),
torch.nn.ReLU(),
torch.nn.MaxPool2d(kernel_size=2)
@Hsankesara
Hsankesara / Sustainable Industry: Rinse Over Run competition.
Created April 9, 2019 17:12
Sustainable Industry: Rinse Over Run competition. Scored 58 rank out of 1200+ participants. link: https://www.drivendata.org/competitions/56/predict-cleaning-time-series/
Sustainable Industry: Rinse Over Run competition. Scored 58 rank out of 1200+ participants. link: https://www.drivendata.org/competitions/56/predict-cleaning-time-series/
@Hsankesara
Hsankesara / array_manipulation.cpp
Created February 13, 2019 18:31
playing with cpp
#include <stdio.h>
using namespace std;
double get_sum(int m, int n, double **array)
{
double sum;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
import torch
from torch import nn
import torch.nn.functional as F
import torch.optim as optim
class UNet(nn.Module):
def contracting_block(self, in_channels, out_channels, kernel_size=3):
block = torch.nn.Sequential(
torch.nn.Conv2d(kernel_size=kernel_size, in_channels=in_channels, out_channels=out_channels),
torch.nn.ReLU(),
@Hsankesara
Hsankesara / kmeans.py
Created January 15, 2019 09:52
K-Means clustering and KNN classifier from scratch in Python3
import math
def euclidean_dist(p1, p2):
return math.sqrt(math.pow(p1[0] - p2[0], 2) + math.pow(p1[1] - p2[1], 2))
def allocate_class(x, means):
classes = {}
for clas in means:
classes[clas] = []
for idx, point in enumerate(x):
min_dist = None
@Hsankesara
Hsankesara / Genpact_Data_Analysis.ipynb
Last active December 16, 2018 21:29
RNN model combined with dense model to predict number of orders in future weeks. For more details go to https://datahack.analyticsvidhya.com/contest/genpact-machine-learning-hackathon/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Hsankesara
Hsankesara / pyDatalog.ipynb
Last active December 13, 2018 16:55
First Order Logic in Kinship Domain
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Hsankesara
Hsankesara / qr_householder.py
Created November 23, 2018 04:48
QR factorization using Householder Transformation
"""
This is the code for QR factorization using Householder Transformation.
This program is made in python 3.5.3 but will be compatible to any python 3.4+ version
We used numpy library for matrix manipulation.
Install numpy using ** pip3 install numpy ** command on terminal.
To run the code write ** python3 qr_householder.py ** on terminal
User has to give dimension of the matrix as input in space separated format and matrix will be generated randomly.
QR factorization can be done for both square and non-square matrices and hence the code supports both.
"""
import numpy as np
@Hsankesara
Hsankesara / checkRegularGrammer.c
Last active November 14, 2018 06:37
Automata Theory codes.
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
typedef struct Translation Translation;
typedef struct State State;
typedef struct Translation
{
struct State *nextState;
char input;