Skip to content

Instantly share code, notes, and snippets.

View mannuscript's full-sized avatar

Mannu Malhotra mannuscript

View GitHub Profile
def accuracy_multilabel(pred, ground_truth):
n = len(pred)
score = 0.0
for i in range(0,n):
d = {}
for label in pred[i]:
d[label] = 1
for label in ground_truth[i]:
if label in d:
d[label] = 2
@mannuscript
mannuscript / erlang-calc.cpp
Last active September 21, 2017 16:11
Given load (in erlang) and blocking probability, this script calculates the number of servers required.
#include<iostream>
using namespace std;
int getServersCount(float prob, float load)
{
long double B = 1.0;
int m = 1;
while(true) {
B = 1 + B*m/load;
/* The Single-Server Queue System */
/* External definitions for single-server queue system */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "rand.h" /* header file for random-number generator. */
@mannuscript
mannuscript / Semester2ListParser.js
Created December 31, 2016 06:51
Wrote this script to get a CSV of list of subjects available for Sem-2 (link: http://www.comp.nus.edu.sg/cugresource/soc-sched/#). [Note: Script does not convert html to csv, converted the html table to json using: http://convertjson.com/html-table-to-json.htm]
var arr = [
{
"Module": "BT1101",
"Title": "Introduction to Business Analytics\nModular Credits = 4",
"Sem I,\n 1 Aug - 3 Dec 2016": "OH Hyelim\nGrp 1: Thu 900-1200 RMI-SR1\nExam: 29 NOV 2016 Evening",
"Sem II,\n 9 Jan - 6 May 2017": "-"
},
{
"Module": "BT2101",
"Title": "IT and Decision Making\nModular Credits = 4",