Skip to content

Instantly share code, notes, and snippets.

@cewee
cewee / gist:356b941a4006a502a67f68213f1a76b5
Created August 20, 2018 17:24
Docker py-faster-rcnn and caffe with cuda8
FROM nvidia/cuda:8.0-cudnn6-devel-ubuntu16.04
ENV PACKAGES_ROOT=/opt
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
wget \
libatlas-base-dev \
@andrewjong
andrewjong / pytorch_image_folder_with_file_paths.py
Last active February 27, 2024 09:24
PyTorch Image File Paths With Dataset Dataloader
import torch
from torchvision import datasets
class ImageFolderWithPaths(datasets.ImageFolder):
"""Custom dataset that includes image file paths. Extends
torchvision.datasets.ImageFolder
"""
# override the __getitem__ method. this is the method that dataloader calls
def __getitem__(self, index):
@bshishov
bshishov / forecasting_metrics.py
Last active April 20, 2024 04:29
Python Numpy functions for most common forecasting metrics
import numpy as np
EPSILON = 1e-10
def _error(actual: np.ndarray, predicted: np.ndarray):
""" Simple error """
return actual - predicted
@acmiyaguchi
acmiyaguchi / faster-rcnn-caffe-master.md
Last active March 16, 2020 14:58
py-faster-rcnn on Ubuntu 17.10 and Cuda 9.0
@wookietreiber
wookietreiber / README.md
Last active December 20, 2022 14:00
R - Command Line Interface (CLI) and RStudio - template

R - Interactive Sessions and Command Line Interface

This is a template for R projects that should work both on the command line as well as in an interactive session.

Template Files

The template is made up of three files:

  1. foo.r
@Arkoniak
Arkoniak / mxnet_loss_linear.jl
Last active January 17, 2017 11:47
Custom loss function in Julia MXNet, linear regression
using MXNet
import MXNet.mx: _update_single_output, reset!, get
using Distributions
#####################################
# Custom evaluation metric
# It just summarize predictions, because in the case of custom
# loss layer, ANN output equals to loss function itself
@0xjac
0xjac / private_fork.md
Last active May 9, 2024 09:46
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@dalejbarr
dalejbarr / L3_stats_homework_5_2016.R
Created November 4, 2016 12:26
script for video walkthrough on using R/RStudio for 3-way ANOVA
## youtube video: https://youtu.be/AJDo9gpkEcg
library("readr")
library("ggplot2")
## read.csv() <- from base R. DON'T USE!
hw5 <- read_csv("homework_5.csv") # from readr
hw5$A <- factor(hw5$A)
hw5$B <- factor(hw5$B)
hw5$C <- factor(hw5$C)
@bgusach
bgusach / multireplace.py
Last active April 23, 2024 18:46
Python string multireplacement
def multireplace(string, replacements, ignore_case=False):
"""
Given a string and a replacement map, it returns the replaced string.
:param str string: string to execute replacements on
:param dict replacements: replacement dictionary {value to find: value to replace}
:param bool ignore_case: whether the match should be case insensitive
:rtype: str
"""
@ottokart
ottokart / nn.py
Last active August 27, 2021 05:52
3-layer neural network example with dropout in 2nd layer
# Tiny example of 3-layer nerual network with dropout in 2nd hidden layer
# Output layer is linear with L2 cost (regression model)
# Hidden layer activation is tanh
import numpy as np
n_epochs = 100
n_samples = 100
n_in = 10
n_hidden = 5