Skip to content

Instantly share code, notes, and snippets.

@shaypal5
shaypal5 / confusion_matrix_pretty_print.py
Last active May 13, 2024 13:04
Pretty print a confusion matrix with seaborn
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
def print_confusion_matrix(confusion_matrix, class_names, figsize = (10,7), fontsize=14):
"""Prints a confusion matrix, as returned by sklearn.metrics.confusion_matrix, as a heatmap.
Note that due to returning the created figure object, when this funciton is called in a
notebook the figure willl be printed twice. To prevent this, either append ; to your
function call, or modify the function by commenting out the return expression.
@arundasan91
arundasan91 / CaffeInstallation.md
Created April 2, 2016 22:16
Caffe Installation Tutorial for beginners

Caffe

Freshly brewed !

With the availability of huge amount of data for research and powerfull machines to run your code on, Machine Learning and Neural Networks is gaining their foot again and impacting us more than ever in our everyday lives. With huge players like Google opensourcing part of their Machine Learning systems like the TensorFlow software library for numerical computation, there are many options for someone interested in starting off with Machine Learning/Neural Nets to choose from. Caffe, a deep learning framework developed by the Berkeley Vision and Learning Center (BVLC) and its contributors, comes to the play with a fresh cup of coffee.

Installation Instructions (Ubuntu 14 Trusty)

The following section is divided in to two parts. Caffe's documentation suggest

@edgarriba
edgarriba / relative_pose.cpp
Last active October 27, 2021 03:02
relative pose with opengv
// Returns the camera matrix given the focal and the image itself
// img The reference to the image
// f The focal length in pixels of the camera
cv::Mat getCameraMatrix(const cv::Mat& img, const float f) {
const int cx = img.cols / 2;
const int cy = img.rows / 2;
return (cv::Mat_<float>(3, 3) << f, 0, cx, 0, f, cy, 0, 0, 1);
}
// Convert a set of points to bearing
@ehamberg
ehamberg / scatterv.c
Last active January 26, 2025 04:41
MPI_Scatterv example
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define SIZE 4
int main(int argc, char *argv[])
{
int rank, size; // for storing this process' rank, and the number of processes