Skip to content

Instantly share code, notes, and snippets.

View taromakino's full-sized avatar

Taro Makino taromakino

View GitHub Profile
@mpatacchiola
mpatacchiola / tinyimagenet_validation_preprocessing.py
Last active June 28, 2019 09:47
This script moves the images from the `val/images` folder to the `val/class_id` folder. This is useful if you want to load the dataset with torchvision ImageFolder class. Run the script from the `tiny-imagenet-200` folder. The dataset can be downloaded from https://tiny-imagenet.herokuapp.com
import shutil
import os
for i, line in enumerate(map(lambda s: s.strip(), open("./val/val_annotations.txt"))):
name, wnid = line.split("\t")[0:2]
origin_path_file = "./val/images/" + name
destination_path = "./val/" + wnid
destination_path_file = "./val/" + wnid + "/" + name
if not os.path.exists(destination_path): os.makedirs(destination_path)
shutil.move(origin_path_file, destination_path_file)
@brentp
brentp / betareg.py
Last active September 17, 2024 14:48
beta regression in statsmodels
# -*- coding: utf-8 -*-
u"""
Beta regression for modeling rates and proportions.
References
----------
Grün, Bettina, Ioannis Kosmidis, and Achim Zeileis. Extended beta regression
in R: Shaken, stirred, mixed, and partitioned. No. 2011-22. Working Papers in
Economics and Statistics, 2011.