Skip to content

Instantly share code, notes, and snippets.

View nipunbatra's full-sized avatar

Nipun Batra nipunbatra

View GitHub Profile
@joshwentz
joshwentz / energyplus.sh
Last active December 20, 2015 23:48
install energyplus onto an ubuntu 12.04 linux server
#Open Terminal & move to where you want to install
#Install git: sudo apt-get install git-core
#git clone https://gist.github.com/6214690.git
#cd 6214690/
#sh energyplus.sh
#Download EnergyPlus
sudo wget http://developer.nrel.gov/downloads/buildings/energyplus/builds/EnergyPlus-7.2.0.006-Linux-64.tar.gz
sudo tar xzf EnergyPlus-7.2.0.006-Linux-64.tar.gz
find EnergyPlus-7-2-0-006/bin/ -type f -perm -o+rx;
@silgon
silgon / frequency_prediction.py
Last active February 16, 2018 22:56
Frequency Prediction
# code to solve https://stackoverflow.com/q/47932589/2237916
import numpy as np
import tflearn
from random import shuffle
# parameters
n_input=100
n_train=2000
n_test = 500
# generate data
@mblondel
mblondel / nmf_cd.py
Last active June 12, 2019 20:00
NMF by coordinate descent
"""
NMF by coordinate descent, designed for sparse data (without missing values)
"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# License: BSD 3 clause
import numpy as np
import scipy.sparse as sp
import numba
@jakevdp
jakevdp / PythonCpp.ipynb
Last active January 8, 2020 03:44
Hack to make Python look like C++
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@panisson
panisson / ncp.py
Last active June 9, 2020 01:44
Nonnegative Tensor Factorization, based on the Matlab source code available at Jingu Kim's home page: https://sites.google.com/site/jingukim/home#ntfcode Requires the installation of Numpy and Scikit-Tensor (https://github.com/mnick/scikit-tensor). For examples, see main() function.
# Copyright (C) 2013 Istituto per l'Interscambio Scientifico I.S.I.
# You can contact us by email (isi@isi.it) or write to:
# ISI Foundation, Via Alassio 11/c, 10126 Torino, Italy.
#
# This work is licensed under a Creative Commons 4.0
# Attribution-NonCommercial-ShareAlike License
# You may obtain a copy of the License at
# http://creativecommons.org/licenses/by-nc-sa/4.0/
#
# This program was written by Andre Panisson <panisson@gmail.com> at
@elsonidoq
elsonidoq / gist:4230222
Created December 7, 2012 02:21
Python implementation of mutual information for continuous variables
from math import log
log2= lambda x:log(x,2)
from scipy import histogram, digitize, stats, mean, std
from collections import defaultdict
def mutual_information(x,y):
return entropy(y) - conditional_entropy(x,y)
def conditional_entropy(x, y):
"""
@fonnesbeck
fonnesbeck / hmm.py
Created March 25, 2010 00:01
Hidden Markov model in PyMC
import numpy as np
import pymc
import pdb
def unconditionalProbability(Ptrans):
"""Compute the unconditional probability for the states of a
Markov chain."""
m = Ptrans.shape[0]
@tgarc
tgarc / example_usage
Last active March 25, 2022 13:44
Jekyll IPython notebook converter
ipython nbconvert --to markdown <notebook>.ipynb --config jekyll.py
@spro
spro / pytorch-simple-rnn.py
Last active April 25, 2022 10:50
PyTorch RNN training example
import torch
import torch.nn as nn
from torch.nn import functional as F
from torch.autograd import Variable
from torch import optim
import numpy as np
import math, random
# Generating a noisy multi-sin wave
@drewda
drewda / gist:1299198
Created October 19, 2011 18:23
Jenks natural breaks classification
# code from http://danieljlewis.org/files/2010/06/Jenks.pdf
# described at http://danieljlewis.org/2010/06/07/jenks-natural-breaks-algorithm-in-python/
def getJenksBreaks( dataList, numClass ):
dataList.sort()
mat1 = []
for i in range(0,len(dataList)+1):
temp = []
for j in range(0,numClass+1):
temp.append(0)