Skip to content

Instantly share code, notes, and snippets.

Making Reasonal

Utkarsh Upadhyay musically-ut

Making Reasonal
View GitHub Profile
musically-ut /
Last active Jul 7, 2017 — forked from jnothman/bench_semi_supervised_n_iter
Benchmarking `sklearn.semi_supervised` `n_iter_` as a function of model and data characteristics
import numpy as np
from sklearn import datasets
from sklearn.semi_supervised import LabelPropagation, LabelSpreading
###for n_samples in [20, 200, 2000, 20000]:
### X, y = datasets.make_classification(n_samples=n_samples, n_classes=3, n_informative=3)
for (X, y) in [datasets.load_iris(return_X_y=True)]:
for model in [LabelPropagation(max_iter=1000),
musically-ut /
Created Mar 16, 2017
Setting up a new server by copying config files from local computer.
set -e
set -u
set -o pipefail
if [ -z $1 ]
echo "Usage: $0 [user@]servername"
exit 1
musically-ut /
Last active Apr 1, 2019
Poor man's parallel execution on servers
#!/usr/bin/env bash
set -e
for N in {1..5}
for M in {0.1,1,2,5,10};
# Replace ./ with your program to run it in parallel
./ -N $N -M $M > output/stdout_N${N}_M${M}.txt &
View 4 dots

4 dots puzzle

Initial position: There are 4 dots arranged as a square on a grid.

Move: The dots can be moved by reflecting them through any other three dots. So to move a point, draw a line segment from that dot to another dot, extend it to twice its length and move the first dot to the place where it terminates.

Question: Is it possible to transform the square into another square of a larger size?

musically-ut /
Last active Aug 14, 2016
Pre-commit hook to avoid committing lines with '#NO-GIT"
git diff --cached --name-only | \
xargs egrep -i --color --with-filename -n "$PAT" && echo "Found '"$PAT"' in code about to be committed. Rejecting commit." && exit 1
# Exit with error code zero if all went well.
exit 0
View randomized_methods.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
musically-ut / nngraph_plot_in_itorch.lua
Last active Apr 5, 2016
How to show an nnGraph plot in iTorch
View nngraph_plot_in_itorch.lua
require 'graph';
require 'os';
function displayGraph(g, forward)
local imgFile = os.tmpname() .. '.png'
local dag = g.fg
if forward == false then
dag =
View Plotting_clustering_timeseries.R
for(j in 1:max(clustering$cluster))
x <- 1:12
d <- d[clustering$cluster == j,]
plot.default(x = NA, xlim = c(1, 12),
ylim = c(min(y), max(y)), xlab = "Time", ylab = "Expression changes",
main = paste("Cluster", j), axes = FALSE)
View Example code.R
function (eset, cl, mfrow = c(1, 1), colo, min.mem = 0, time.labels,
new.window = TRUE)
clusterindex <- cl[[3]]
memship <- cl[[4]]
memship[memship < min.mem] <- -1
colorindex <- integer(dim(exprs(eset))[[1]])
if (missing(colo)) {
colo <- c("#FF8F00", "#FFA700", "#FFBF00", "#FFD700",
"#FFEF00", "#F7FF00", "#DFFF00", "#C7FF00", "#AFFF00",
musically-ut /
Last active Nov 2, 2015
Scripts to convert sqlite

Scripts to convert datasets from unruly forms to SQLite

The script reads files which have one JSON block per new line to be inserted in a database. This has become a rather common dataformat which is easy to incrementally parse. The arguments to the scripts are self explanatory.

Example execution: python --gzip aggressive_dedup.json.gz amazon.sqlite reviews

For a more upto date scripts, see: Networks-Leraning/datasets2sqlite.

You can’t perform that action at this time.