SlideShare ist ein Scribd-Unternehmen logo
1 von 22
1
2
•
•
    •
    •




        3
•
•

•
•




    4
•
•
    •
    •
•




        5
6
•
•
    •
    •
    •
•
•



        7
R CMD INSTALL 'package filename'
                                   8
9
> small.ints = to.dfs(1:10)
> out = mapreduce(input = small.ints, map = function(k,v) keyval(k, k^2))
> res = from.dfs(out)
> colres <- do.call('rbind', lapply(res,"[[",2))
> t(colres)
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    4    9   16    25  36   49   64   81   100




> groups = to.dfs(rbinom(32, n = 50, prob = 0.4))
> out = mapreduce(input = groups, reduce = function(k,vv) keyval(k, length(vv)))
> res = from.dfs(out)
> colres <- do.call('rbind', lapply(res,"[[",2))
> t(colres)
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
[1,]    2    7    3    1    1   12    2    8     8    1     4     1



                                                                                   10
>  wordcount = function(input, output = NULL, pattern = " ") {
+    mapreduce(input = input,
+              output = output,
+              textinputformat = rawtextinputformat,
+              map = function(k ,v) {
+                 lapply(strsplit(x = v, split = pattern) [[1]],
+                        function(w) keyval(w,1))
+              },
+              reduce = function(k, vv) {
+                 keyval(k, sum(unlist(vv)))
+              },
+              combine = T)
+  }
>  out <- wordcount(input="/user/hidekazu/the_social_network.txt")
>  results <- from.dfs(out)
>  results <- data.frame(word=unlist(lapply(results,"[[",1)),
                          count=unlist(lapply(results,"[[",2)))
> results <- (results[order(results$count, decreasing=TRUE), ])
> head(results)
      word count
6313 the 1101
2381     a   700                                                     11
26     and   637
12
kmeans.iter =
  function(points, distfun, ncenters = length(centers), centers = NULL) {
    from.dfs(
              mapreduce(input = points,
                        map = if (is.null(centers)) {
                           function(k,v)keyval(sample(1:ncenters,1),v)
                        } else {
                           function(k,v) {
                             distances = lapply(centers,
                               function(c) distfun(c,v))
                             keyval(centers[[which.min(distances)]],v)
                           }
                        },
                        reduce = function(k,vv) keyval(NULL,
                                                apply(do.call(rbind, vv), 2, mean)))
              )
  }




                                                                                   13
kmeans =
    function(points, ncenters, iterations = 10,
             distfun =
             function(a,b) norm(as.matrix(a-b), type = 'F')) {
      newCenters = kmeans.iter(points, distfun = distfun, ncenters = ncenters)
      for(i in 1:iterations) {
        newCenters = lapply(values(newCenters), unlist)
        newCenters = kmeans.iter(points, distfun, centers=newCenters)
      }
      newCenters
    }




clustdata = lapply(1:10000,
                   function(i) keyval(i, c(rnorm(1, mean = i%%3, sd = 0.01),
                                           rnorm(1, mean = i%%4, sd = 0.01))))
to.dfs(clustdata, "/tmp/clustdata")
kmeans ("/tmp/clustdata", 12)


                                                                                 14
15
15
16
> model <- kmeans(iris[, 1:4], 3, nstart=10)
> modelfilename <- "my_smart_unique_name"
> modelfile <- hdfs.file(modelfilename, "w")
> hdfs.write(model, modelfile)
[1] TRUE
> hdfs.close(modelfile)
[1] TRUE




> modelfile = hdfs.file(modelfilename, "r")
> m <- hdfs.read(modelfile)
Warning message:
In function (h) : Closed unused DFS stream: my_smart_unique_name
> model <- unserialize(m)
> hdfs.close(modelfile)
[1] TRUE
> model


                                                                   17
18
•




    •




        19
•




    20
•
    •
    •
    •
•




        21

Weitere ähnliche Inhalte

Was ist angesagt? (20)

ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions
 
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
 
C++ TUTORIAL 6
C++ TUTORIAL 6C++ TUTORIAL 6
C++ TUTORIAL 6
 
ECMAScript 6 major changes
ECMAScript 6 major changesECMAScript 6 major changes
ECMAScript 6 major changes
 
Python hmm
Python hmmPython hmm
Python hmm
 
C++ TUTORIAL 7
C++ TUTORIAL 7C++ TUTORIAL 7
C++ TUTORIAL 7
 
Om (Cont.)
Om (Cont.)Om (Cont.)
Om (Cont.)
 
Plot3D Package and Example in R.-Data visualizat,on
Plot3D Package and Example in R.-Data visualizat,onPlot3D Package and Example in R.-Data visualizat,on
Plot3D Package and Example in R.-Data visualizat,on
 
Effector: we need to go deeper
Effector: we need to go deeperEffector: we need to go deeper
Effector: we need to go deeper
 
C++ TUTORIAL 10
C++ TUTORIAL 10C++ TUTORIAL 10
C++ TUTORIAL 10
 
Angular Refactoring in Real World
Angular Refactoring in Real WorldAngular Refactoring in Real World
Angular Refactoring in Real World
 
Hacking the Internet of Things for Fun & Profit
Hacking the Internet of Things for Fun & ProfitHacking the Internet of Things for Fun & Profit
Hacking the Internet of Things for Fun & Profit
 
dplyr
dplyrdplyr
dplyr
 
Camping
CampingCamping
Camping
 
C++ TUTORIAL 3
C++ TUTORIAL 3C++ TUTORIAL 3
C++ TUTORIAL 3
 
C++ TUTORIAL 9
C++ TUTORIAL 9C++ TUTORIAL 9
C++ TUTORIAL 9
 
Vcs9
Vcs9Vcs9
Vcs9
 
Clojure to Slang
Clojure to SlangClojure to Slang
Clojure to Slang
 
Metaprogramming
MetaprogrammingMetaprogramming
Metaprogramming
 
Go: It's Not Just For Google
Go: It's Not Just For GoogleGo: It's Not Just For Google
Go: It's Not Just For Google
 

Andere mochten auch

Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...
Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...
Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...Aleš Vidmar
 
Social Media Success in International Student Recruitment
Social Media Success in International Student RecruitmentSocial Media Success in International Student Recruitment
Social Media Success in International Student RecruitmentMarty Bennett
 
SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14
SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14
SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14Statistisk sentralbyrå
 
MvSM: 7) Co tam dávat - tvorba obsahu pro sociální média
MvSM: 7) Co tam dávat - tvorba obsahu pro sociální médiaMvSM: 7) Co tam dávat - tvorba obsahu pro sociální média
MvSM: 7) Co tam dávat - tvorba obsahu pro sociální médiaMatez Jindra
 
Funcionario, ¿qué le pides tú a la administración electrónica?
Funcionario, ¿qué le pides tú a la administración electrónica?Funcionario, ¿qué le pides tú a la administración electrónica?
Funcionario, ¿qué le pides tú a la administración electrónica?Alberto Ortiz de Zarate
 
Márkaépítés a fogyasztói kontroll korában 2.0
Márkaépítés a fogyasztói kontroll korában 2.0Márkaépítés a fogyasztói kontroll korában 2.0
Márkaépítés a fogyasztói kontroll korában 2.0Isobar Budapest
 
Advanced php
Advanced phpAdvanced php
Advanced phphamfu
 
Buyer Persona - Key to B2B online marketing success
Buyer Persona - Key to B2B online marketing successBuyer Persona - Key to B2B online marketing success
Buyer Persona - Key to B2B online marketing successShimonBen
 
Design persuasivo: alcuni esempi
Design persuasivo: alcuni esempiDesign persuasivo: alcuni esempi
Design persuasivo: alcuni esempiAlberto Mucignat
 
Balonmán touro
Balonmán touroBalonmán touro
Balonmán tourodavidares1
 
Enquête Doctipharma : Les français et la vente de médicaments sur internet
Enquête Doctipharma : Les français et la vente de médicaments sur internet Enquête Doctipharma : Les français et la vente de médicaments sur internet
Enquête Doctipharma : Les français et la vente de médicaments sur internet Doctipharma
 
Baby Love -Wildlife
Baby Love -WildlifeBaby Love -Wildlife
Baby Love -WildlifeMakala D.
 
Subsidio i.1 demanda actual
Subsidio i.1 demanda actualSubsidio i.1 demanda actual
Subsidio i.1 demanda actualUpaep Online
 
Valsts pārvaldes institūciju pasūtīto pētījumu koordinācijas sistēma
Valsts pārvaldes institūciju pasūtīto pētījumu koordinācijas sistēmaValsts pārvaldes institūciju pasūtīto pētījumu koordinācijas sistēma
Valsts pārvaldes institūciju pasūtīto pētījumu koordinācijas sistēmaPārresoru kordinācijas centrs (PKC)
 

Andere mochten auch (20)

A world without islam-graham e. fuller
A world without islam-graham e. fullerA world without islam-graham e. fuller
A world without islam-graham e. fuller
 
Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...
Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...
Povezovanje kemijske panoge in delo z mladimi, KOCKE, Ziga Lampe, Drzava za g...
 
Sig App4
Sig App4Sig App4
Sig App4
 
Social Media Success in International Student Recruitment
Social Media Success in International Student RecruitmentSocial Media Success in International Student Recruitment
Social Media Success in International Student Recruitment
 
SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14
SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14
SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14
 
MvSM: 7) Co tam dávat - tvorba obsahu pro sociální média
MvSM: 7) Co tam dávat - tvorba obsahu pro sociální médiaMvSM: 7) Co tam dávat - tvorba obsahu pro sociální média
MvSM: 7) Co tam dávat - tvorba obsahu pro sociální média
 
Funcionario, ¿qué le pides tú a la administración electrónica?
Funcionario, ¿qué le pides tú a la administración electrónica?Funcionario, ¿qué le pides tú a la administración electrónica?
Funcionario, ¿qué le pides tú a la administración electrónica?
 
Márkaépítés a fogyasztói kontroll korában 2.0
Márkaépítés a fogyasztói kontroll korában 2.0Márkaépítés a fogyasztói kontroll korában 2.0
Márkaépítés a fogyasztói kontroll korában 2.0
 
Lucy redes sociales myspace
Lucy redes sociales myspaceLucy redes sociales myspace
Lucy redes sociales myspace
 
Advanced php
Advanced phpAdvanced php
Advanced php
 
Buyer Persona - Key to B2B online marketing success
Buyer Persona - Key to B2B online marketing successBuyer Persona - Key to B2B online marketing success
Buyer Persona - Key to B2B online marketing success
 
Design persuasivo: alcuni esempi
Design persuasivo: alcuni esempiDesign persuasivo: alcuni esempi
Design persuasivo: alcuni esempi
 
Balonmán touro
Balonmán touroBalonmán touro
Balonmán touro
 
Tesla Croatia
Tesla CroatiaTesla Croatia
Tesla Croatia
 
Enquête Doctipharma : Les français et la vente de médicaments sur internet
Enquête Doctipharma : Les français et la vente de médicaments sur internet Enquête Doctipharma : Les français et la vente de médicaments sur internet
Enquête Doctipharma : Les français et la vente de médicaments sur internet
 
Amnesty International
Amnesty InternationalAmnesty International
Amnesty International
 
Baby Love -Wildlife
Baby Love -WildlifeBaby Love -Wildlife
Baby Love -Wildlife
 
Aseemearth
AseemearthAseemearth
Aseemearth
 
Subsidio i.1 demanda actual
Subsidio i.1 demanda actualSubsidio i.1 demanda actual
Subsidio i.1 demanda actual
 
Valsts pārvaldes institūciju pasūtīto pētījumu koordinācijas sistēma
Valsts pārvaldes institūciju pasūtīto pētījumu koordinācijas sistēmaValsts pārvaldes institūciju pasūtīto pētījumu koordinācijas sistēma
Valsts pārvaldes institūciju pasūtīto pētījumu koordinācijas sistēma
 

Ähnlich wie RHadoop の紹介

Monadologie
MonadologieMonadologie
Monadologieleague
 
Advanced Data Visualization Examples with R-Part II
Advanced Data Visualization Examples with R-Part IIAdvanced Data Visualization Examples with R-Part II
Advanced Data Visualization Examples with R-Part IIDr. Volkan OBAN
 
Python 101 language features and functional programming
Python 101 language features and functional programmingPython 101 language features and functional programming
Python 101 language features and functional programmingLukasz Dynowski
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語ikdysfm
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1Ke Wei Louis
 
Algorithm Design and Analysis - Practical File
Algorithm Design and Analysis - Practical FileAlgorithm Design and Analysis - Practical File
Algorithm Design and Analysis - Practical FileKushagraChadha1
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)MongoSF
 
Rainer Grimm, “Functional Programming in C++11”
Rainer Grimm, “Functional Programming in C++11”Rainer Grimm, “Functional Programming in C++11”
Rainer Grimm, “Functional Programming in C++11”Platonov Sergey
 
intro-to-metaprogramming-in-r.pdf
intro-to-metaprogramming-in-r.pdfintro-to-metaprogramming-in-r.pdf
intro-to-metaprogramming-in-r.pdfK. Matthew Dupree
 
TI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsTI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsEelco Visser
 
Celery - A Distributed Task Queue
Celery - A Distributed Task QueueCelery - A Distributed Task Queue
Celery - A Distributed Task QueueDuy Do
 
Optimization and Mathematical Programming in R and ROI - R Optimization Infra...
Optimization and Mathematical Programming in R and ROI - R Optimization Infra...Optimization and Mathematical Programming in R and ROI - R Optimization Infra...
Optimization and Mathematical Programming in R and ROI - R Optimization Infra...Dr. Volkan OBAN
 
BUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdfBUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdfkarthikaparthasarath
 

Ähnlich wie RHadoop の紹介 (20)

RHadoop, R meets Hadoop
RHadoop, R meets HadoopRHadoop, R meets Hadoop
RHadoop, R meets Hadoop
 
CLUSTERGRAM
CLUSTERGRAMCLUSTERGRAM
CLUSTERGRAM
 
Jan 2012 HUG: RHadoop
Jan 2012 HUG: RHadoopJan 2012 HUG: RHadoop
Jan 2012 HUG: RHadoop
 
Monadologie
MonadologieMonadologie
Monadologie
 
Advanced Data Visualization Examples with R-Part II
Advanced Data Visualization Examples with R-Part IIAdvanced Data Visualization Examples with R-Part II
Advanced Data Visualization Examples with R-Part II
 
Javascript
JavascriptJavascript
Javascript
 
Python 101 language features and functional programming
Python 101 language features and functional programmingPython 101 language features and functional programming
Python 101 language features and functional programming
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1
 
Scala by Luc Duponcheel
Scala by Luc DuponcheelScala by Luc Duponcheel
Scala by Luc Duponcheel
 
Map, Reduce and Filter in Swift
Map, Reduce and Filter in SwiftMap, Reduce and Filter in Swift
Map, Reduce and Filter in Swift
 
Algorithm Design and Analysis - Practical File
Algorithm Design and Analysis - Practical FileAlgorithm Design and Analysis - Practical File
Algorithm Design and Analysis - Practical File
 
Script jantung copy
Script jantung   copyScript jantung   copy
Script jantung copy
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
 
Rainer Grimm, “Functional Programming in C++11”
Rainer Grimm, “Functional Programming in C++11”Rainer Grimm, “Functional Programming in C++11”
Rainer Grimm, “Functional Programming in C++11”
 
intro-to-metaprogramming-in-r.pdf
intro-to-metaprogramming-in-r.pdfintro-to-metaprogramming-in-r.pdf
intro-to-metaprogramming-in-r.pdf
 
TI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class FunctionsTI1220 Lecture 6: First-class Functions
TI1220 Lecture 6: First-class Functions
 
Celery - A Distributed Task Queue
Celery - A Distributed Task QueueCelery - A Distributed Task Queue
Celery - A Distributed Task Queue
 
Optimization and Mathematical Programming in R and ROI - R Optimization Infra...
Optimization and Mathematical Programming in R and ROI - R Optimization Infra...Optimization and Mathematical Programming in R and ROI - R Optimization Infra...
Optimization and Mathematical Programming in R and ROI - R Optimization Infra...
 
BUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdfBUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdf
 

Mehr von Hidekazu Tanaka

ggplot2 に入門してみた
ggplot2 に入門してみたggplot2 に入門してみた
ggplot2 に入門してみたHidekazu Tanaka
 
データベースのお話
データベースのお話データベースのお話
データベースのお話Hidekazu Tanaka
 
バギングで構築された各決定木
バギングで構築された各決定木バギングで構築された各決定木
バギングで構築された各決定木Hidekazu Tanaka
 
アンサンブル学習
アンサンブル学習アンサンブル学習
アンサンブル学習Hidekazu Tanaka
 
Rで解く最適化問題 線型計画問題編
Rで解く最適化問題   線型計画問題編 Rで解く最適化問題   線型計画問題編
Rで解く最適化問題 線型計画問題編 Hidekazu Tanaka
 
Rによるやさしい統計学 第16章 : 因子分析
Rによるやさしい統計学 第16章 : 因子分析Rによるやさしい統計学 第16章 : 因子分析
Rによるやさしい統計学 第16章 : 因子分析Hidekazu Tanaka
 

Mehr von Hidekazu Tanaka (10)

ggplot2 に入門してみた
ggplot2 に入門してみたggplot2 に入門してみた
ggplot2 に入門してみた
 
データベースのお話
データベースのお話データベースのお話
データベースのお話
 
フォントのお話
フォントのお話フォントのお話
フォントのお話
 
フォントのお話
フォントのお話フォントのお話
フォントのお話
 
バギングで構築された各決定木
バギングで構築された各決定木バギングで構築された各決定木
バギングで構築された各決定木
 
アンサンブル学習
アンサンブル学習アンサンブル学習
アンサンブル学習
 
Rの紹介
Rの紹介Rの紹介
Rの紹介
 
Rで解く最適化問題 線型計画問題編
Rで解く最適化問題   線型計画問題編 Rで解く最適化問題   線型計画問題編
Rで解く最適化問題 線型計画問題編
 
RでMapreduce
RでMapreduceRでMapreduce
RでMapreduce
 
Rによるやさしい統計学 第16章 : 因子分析
Rによるやさしい統計学 第16章 : 因子分析Rによるやさしい統計学 第16章 : 因子分析
Rによるやさしい統計学 第16章 : 因子分析
 

Kürzlich hochgeladen

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

RHadoop の紹介

  • 1. 1
  • 2. 2
  • 3. • • • • 3
  • 5. • • • • • 5
  • 6. 6
  • 7. • • • • • • • 7
  • 8. R CMD INSTALL 'package filename' 8
  • 9. 9
  • 10. > small.ints = to.dfs(1:10) > out = mapreduce(input = small.ints, map = function(k,v) keyval(k, k^2)) > res = from.dfs(out) > colres <- do.call('rbind', lapply(res,"[[",2)) > t(colres) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 1 4 9 16 25 36 49 64 81 100 > groups = to.dfs(rbinom(32, n = 50, prob = 0.4)) > out = mapreduce(input = groups, reduce = function(k,vv) keyval(k, length(vv))) > res = from.dfs(out) > colres <- do.call('rbind', lapply(res,"[[",2)) > t(colres) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [1,] 2 7 3 1 1 12 2 8 8 1 4 1 10
  • 11. > wordcount = function(input, output = NULL, pattern = " ") { + mapreduce(input = input, + output = output, + textinputformat = rawtextinputformat, + map = function(k ,v) { + lapply(strsplit(x = v, split = pattern) [[1]], + function(w) keyval(w,1)) + }, + reduce = function(k, vv) { + keyval(k, sum(unlist(vv))) + }, + combine = T) + } > out <- wordcount(input="/user/hidekazu/the_social_network.txt") > results <- from.dfs(out) > results <- data.frame(word=unlist(lapply(results,"[[",1)), count=unlist(lapply(results,"[[",2))) > results <- (results[order(results$count, decreasing=TRUE), ]) > head(results) word count 6313 the 1101 2381 a 700 11 26 and 637
  • 12. 12
  • 13. kmeans.iter = function(points, distfun, ncenters = length(centers), centers = NULL) { from.dfs( mapreduce(input = points, map = if (is.null(centers)) { function(k,v)keyval(sample(1:ncenters,1),v) } else { function(k,v) { distances = lapply(centers, function(c) distfun(c,v)) keyval(centers[[which.min(distances)]],v) } }, reduce = function(k,vv) keyval(NULL, apply(do.call(rbind, vv), 2, mean))) ) } 13
  • 14. kmeans = function(points, ncenters, iterations = 10, distfun = function(a,b) norm(as.matrix(a-b), type = 'F')) { newCenters = kmeans.iter(points, distfun = distfun, ncenters = ncenters) for(i in 1:iterations) { newCenters = lapply(values(newCenters), unlist) newCenters = kmeans.iter(points, distfun, centers=newCenters) } newCenters } clustdata = lapply(1:10000, function(i) keyval(i, c(rnorm(1, mean = i%%3, sd = 0.01), rnorm(1, mean = i%%4, sd = 0.01)))) to.dfs(clustdata, "/tmp/clustdata") kmeans ("/tmp/clustdata", 12) 14
  • 15. 15
  • 16. 15
  • 17. 16
  • 18. > model <- kmeans(iris[, 1:4], 3, nstart=10) > modelfilename <- "my_smart_unique_name" > modelfile <- hdfs.file(modelfilename, "w") > hdfs.write(model, modelfile) [1] TRUE > hdfs.close(modelfile) [1] TRUE > modelfile = hdfs.file(modelfilename, "r") > m <- hdfs.read(modelfile) Warning message: In function (h) : Closed unused DFS stream: my_smart_unique_name > model <- unserialize(m) > hdfs.close(modelfile) [1] TRUE > model 17
  • 19. 18
  • 20. • 19
  • 21. 20
  • 22. • • • • 21

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n