anaconda が入っていれば、特に問題にならない
-
事前に必要なモジュールをインストール
$ pip install openpyxl xlrd xlwt
| # 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)) { |
| # 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]] |
| library(tidyverse) | |
| library(ggrepel) | |
| #------------------------- | |
| # データ作成 | |
| #------------------------- | |
| # 円のインデックスとrを指定(r^2が中心からのユークリッド距離) | |
| dist.vec <- c(user1=1, user2=2, user3=3, user4=4) | |
| idx.vec <- names(dist.vec) |
| #---------------------------------------------------------- | |
| # Rによる協調フィルタリングの実装例 | |
| # | |
| # Brainpad技術ブログ:レコメンドつれづれ 1-2付属コード | |
| # | |
| #---------------------------------------------------------- | |
| library(recommenderlab) | |
| #------------------------------------------ |
| """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) |