Tokyo.R#73 LT

66708c68af5e618705d495c131f3d6d2?s=47 koriakane
October 20, 2018
260

Tokyo.R#73 LT

10/20開催のTokyo.R #73のLT資料です。

66708c68af5e618705d495c131f3d6d2?s=128

koriakane

October 20, 2018
Tweet

Transcript

  1.      #

  2.  • ( ( ) • ( @ • •

    .
  3. 

  4.  • • 1 •

  5.     

  6. 

  7.  • IL9;J GD • GD!,2K@ *0-=& #Q 3 $<8

    A# • 1.+,4?6FBE$N7 C 5 • '"C M >%$P $,2  P /0).(H:&%$ O 
  8. 

  9. 

  10.     • 56? ;>.402*C   

    • :!;>*B'D  =)(' '&;> % ? &$+ • ,4/0D+A@8 +$ 7" %#'<  E9"1-3 &D&$
  11.      

  12. 

  13.     • nbyimVY Zm_Y o Zm_W Y

    Zp zr eetW • imY ? E H Z • olVgb_v aou eetW • czmo cxrdhTPS PRU PSW • mw fbo. o s h_ b _v kW • ? FH LLL E :E L :? & 4 2 22 = & E • ? FH LLL E :E L :? & AF : : • ? FH LLL E :E L :? &= 7 / O = & E
  14.      

  15. 1 1

  16. 

  17.  • 7.%25 "-+)&'/5 0"# • 3*($4 5 56" !

       • 51 ,51  ! !% "%  
  18.  • # 1 1 T 0 8 • •

  19.  • ) 1 • ) • ( ) 0

  20. •   library(tidyverse) SAWANO <- read_csv("RECOMMEND_sawano.csv") SAWANO %>% group_by(TITLE)

    %>% summarise(weight = sum(WEIGHT), count = n()) %>% arrange(desc(weight, count))
  21. /

  22.  • 1 ) ( rank <- SAWANO %>% group_by(TITLE)

    %>% summarise(weight = sum(WEIGHT), count = n()) %>% arrange(desc(weight, count)) ggplot(rank, aes(x = count)) + geom_histogram(bins = 19, alpha = 0.8) + theme_bw() + guides(fill = "none")
  23.   • mn t J • _dr lso g

    38::8E g f 54 g h • y f _ f n p m b b e chJ • g OR b KK y m a K • D - : 9 C 8B: :CA B E % % % 6 2 . 2 .1 . 2 / 2 2 . 2 . 2 % / 2 % / 2 2 . /D8E 7 2 . 2 2 /0 /0 2 /. . 1
  24.   •  # σʔλΛɺIDºۂ໊ͷmatrixʹ͢Δ SAWANO_mtx <- SAWANO %>%

    select(ID, TITLE, WEIGHT) %>% tidyr::spread(key = TITLE, value = WEIGHT, fill = NA, convert = FALSE, drop = TRUE) SAWANO_mtx <- as.matrix(SAWANO_mtx[,-1]) # ίαΠϯྨࣅ౓Λࢉग़͢Δؔ਺ͷ࡞੒ʢࢀߟαΠτͷؔ਺ͦͷ··ʣ get_dist <- function (v1, v2){ #NAൺ཰Λߟྀͨ͠scaleXΛ࡞Δ na.idx <- is.na(v1) | is.na(v2) v1a <- v1[!na.idx] v2a <- v2[!na.idx] scaleX <- length(v1) / length(v1a) return(v1a %*% v2a / (sqrt(sum(v1a^2))*sqrt(sum(v2a^2)))/scaleX) }
  25. ( ) •  # ίαΠϯྨࣅ౓ͷࢉग़ɻࣗ෼ͷϨίʔυ͸আ֎͢Δɻ cosSongOF <- apply(sawano_mtx[-81,], MARGIN

    = 2, FUN= function(x) get_dist(x,sawano_mtx[-81,"Song of.."])) # ݟ΍͍͢Α͏ʹdata.frameʹ͢Δ cosSongOF <- data.frame(title = as.character(colnames(sawano_mtx)), x = cosSongOF) # ͓͢͢Ίۂ10ۂදࣔ cosSongOF %>% arrange(desc(x)) %>% filter(!is.nan(x)) %>% head(n = 10)
  26.    • 

  27.  

  28.  • 1 0 ( )

  29.  nY T nY e m k nY nY )

    nY m i l nY A Zlah nY CG ( , nY A Zlah nY m i l nY )
  30. 

  31.  • 3") !13")  2' • 3%+.+  #(

    -$ • *,3  04&$ 3/2' 
  32.     • 0

  33.       

  34. •   

  35.   • S1 • • B

  36.  • • a • m i • r x

    • t r
  37. !

  38.