Skip to content

Instantly share code, notes, and snippets.

messefor

Block or report user

Report or block messefor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View newenv.sh
#! /bin/bash
env_name=$1
env_dir=venv
python3 -m venv $env_dir
source $env_dir/bin/activate
pip install --upgrade pip
pip install scipy
pip install numpy pandas
@messefor
messefor / subplots_sample.py
Last active Apr 23, 2018
Frequency used subplot coding for me to use.
View subplots_sample.py
"""Frequency used matplotlib subplot."""
import math
import numpy as np
import matplotlib.pyplot as plt
# Apply plot function into all data in Xs dictionary.
def subplots(Xs, plot_func):
# Set subplots location info
@messefor
messefor / keras_data_flow_splitter.py
Last active Feb 16, 2018
Script to split data images for keras data_flow_from method
View keras_data_flow_splitter.py
"""Build keras directory structure for flow_from_dir method"""
import os
import shutil
import numpy as np
from glob import glob
DATA_DIR = 'data/clean'
FILE_EXT_PTN = '*.jpg'
TARGET_DIR = 'data/shrine_temple2'
@messefor
messefor / timer.py
Created Dec 5, 2017
Timer class to measure elapsed time
View timer.py
import time
import pickle
from collections import defaultdict
class Timer:
def __init__(self):
self.time_pool = defaultdict(list)
self.start_dict = {}
@messefor
messefor / imdb_meta_to_csv.py
Last active Apr 23, 2018
Convert IMDB META data(matlab .mat file) to csv.
View imdb_meta_to_csv.py
#! /usr/bin/env python
"""
Convert IMDB META data(matlab .mat) to csv.
IMDB-WIKI – 500k+ face images with age and gender labels
- https://data.vision.ee.ethz.ch/cvl/rrothe/imdb-wiki/
- https://stackoverflow.com/questions/13965740/converting-matlabs-datenum-format-to-python
"""
from datetime import datetime, timedelta
@messefor
messefor / face_detect.py
Created Nov 25, 2017
Detect face in image and save cropped.
View face_detect.py
#! /usr/bin/env python
"""
Detect face and save cropped images.
http://vaaaaaanquish.hatenablog.com/entry/2016/08/15/193636
http://dlib.net/face_detector.py.html
"""
import cv2
import os
import glob
@messefor
messefor / mpl_bar_exaple_with_ratio.py
Created Sep 9, 2017
Example of matplotlib barplot with accumulative ratio on 2nd axis.
View mpl_bar_exaple_with_ratio.py
"""Example of matplotlib barplot with accumulative ratio on 2nd axis."""
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
# Plot with seaborn darkgrid style
% matplotlib inline
sns.set(style="darkgrid", palette="muted", color_codes=True)
@messefor
messefor / hist_cum_twin_grid.py
Last active Nov 7, 2018
Example to show how to plot histogram with accumulate ratio. Plot multiple histograms using seaborn.FacetGrid().
View hist_cum_twin_grid.py
"""Example to show how to plot histogram with accumulate ratio.
Plot multiple histogram using seaborn.FacetGrid()
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
% matplotlib inline
@messefor
messefor / hist_cum_twin.py
Created Sep 5, 2017
Histogram with cumulative ratio
View hist_cum_twin.py
"""Example to show how to plot histogram with accumulate ratio."""
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# % matplotlib inline
sns.set(style="darkgrid", palette="muted", color_codes=True)
# Toy data
np.random.seed(0)
@messefor
messefor / ubcf_for_blog.R
Last active May 19, 2017
レコメンドつれづれ 1-2 Rによるユーザベース協調フィルタリングの実装例
View ubcf_for_blog.R
#----------------------------------------------------------
# Rによる協調フィルタリングの実装例
#
# Brainpad技術ブログ:レコメンドつれづれ 1-2付属コード
#
#----------------------------------------------------------
library(recommenderlab)
#------------------------------------------
You can’t perform that action at this time.