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 bias_variance_degree.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View check_if_installed_and_load.R
# sample of checking package installed and load all.
required.pckg <-
c(
'dummies',
'tidyverse',
'glmnet'
)
not.installed <- !(required.pckg %in% installed.packages()[,'Package'])
if (any(not.installed)) {
@messefor
messefor / convert_datatype_in_df.R
Last active Nov 6, 2016
how to convert each column data type in data.frame
View convert_datatype_in_df.R
# set function with which convert data into named vector
col.type.f <- c(vane=as.factor,
prefecture=as.factor,
date=as.Date,
time=as.factor,
ts=as.POSIXct)
# convert data type
for (col in names(col.type.f)) {
f.conv <- col.type.f[col][[1]]
@messefor
messefor / excel_pandas.md
Last active Dec 4, 2016
Excel Bookからデータをpandasに読み込むメモ
View excel_pandas.md

pandas Excel Bookからデータ読み込み

anaconda が入っていれば、特に問題にならない

  • 事前に必要なモジュールをインストール

    $ pip install openpyxl xlrd xlwt
@messefor
messefor / 161204_matplotlib_jpfont.md
Last active Dec 4, 2016
matplotlib 日本語設定のときに使うコマンド
View 161204_matplotlib_jpfont.md

matplotlib 日本語フォント

日本語設定のときに使うコマンド

# 設定ファイルの場所確認
matplotlib.matplotlib_fname()
#> C:\Users\daisuke.oda\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\mpl-data\matplotlibrc

# システムフォントファイル一覧
@messefor
messefor / ggplot2_multi_circle.R
Created Jan 11, 2017
ggplot2で同心円状に複数円を描いて、ポイントもプロットする
View ggplot2_multi_circle.R
library(tidyverse)
library(ggrepel)
#-------------------------
# データ作成
#-------------------------
# 円のインデックスとrを指定(r^2が中心からのユークリッド距離)
dist.vec <- c(user1=1, user2=2, user3=3, user4=4)
idx.vec <- names(dist.vec)
View broadcast_in_R.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@messefor
messefor / subplot_with_pandas.ipynb
Created Feb 11, 2017
pandas.DataFrame.plotとsubplotを使って、複数グラフを柔軟にプロットする
View subplot_with_pandas.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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)
#------------------------------------------
@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)
You can’t perform that action at this time.