Cuisine

> wdir <- "C:/Users/vlado/DL/data/hyper/cooking/cat-edge-Cooking"
> setwd(wdir)
> C <- read.csv("hyperedge-label-identities.txt",header=FALSE)
> head(C)
          V1
1     korean
2    russian
3 vietnamese
4   filipino
5  brazilian
6     indian
> N <- read.csv("node-labels.txt",header=FALSE)
> head(N)
            V1
1 ginger paste
2     sea salt
3   shortbread
4    chocolate
5  puffed rice
6      harissa
> T <- read.csv("hyperedge-labels.txt",header=FALSE)
> head(T)
  V1
1 16
2  9
3  4
4  6
5  6
6 19
> L <- readLines("hyperedges.txt")
> head(L)
[1] "5930\t3243\t3671\t252\t2291\t1910\t4243\t2095\t5046"                                                                
[2] "1979\t1810\t4799\t5176\t3494\t836\t4905\t5565\t2454\t3689\t5990"                                                    
[3] "4905\t2291\t4799\t2387\t2440\t5635\t6530\t3311\t3013\t4578\t4335\t5965"                                             
> length(L)
[1] 39774
> length(T$V1)
[1] 39774
> as.integer(unlist(strsplit(L[1],"\t")))
[1] 5930 3243 3671  252 2291 1910 4243 2095 5046
> m <- length(T$V1)
> lab <- paste("e",1:m,sep="")
> H <- data.frame(ID=lab,T=T$V1,E=rep(NA,m))
> dim(H)
[1] 39774     3
> E = vector(mode="list",m)
> for(i in 1:m) E[[i]] <- as.integer(unlist(strsplit(L[i],"\t")))
> H$E <- E
> n <- length(N$V1); V <- data.frame(ID=N$V1)
> info <- list(network="cat-edge-Cooking",
+   title="ARB: cat-edge-Cooking dataset",
+   by="Austin R. Benson",
+   href=c("https://www.cs.cornell.edu/~arb/data/",
+          "https://www.kaggle.com/c/whats-cooking"),
+   creator="V. Batagelj",
+   date=date(),
+   nNodes=n, 
+   nLinks=m,
+   simple=NA )
> data <- list(cuisine=C$V1)
> HN <- list(format="hypernets",info=info,nodes=V,links=H,data=data)
> str(HN)
List of 5
 $ format: chr "hypernets"
 $ info  :List of 9
  ..$ network: chr "cat-edge-Cooking"
  ..$ title  : chr "ARB: cat-edge-Cooking dataset"
  ..$ by     : chr "Austin R. Benson"
  ..$ href   : chr [1:2] "https://www.cs.cornell.edu/~arb/data/" "https://www.kaggle.com/c/whats-cooking"
  ..$ creator: chr "V. Batagelj"
  ..$ date   : chr "Wed Oct 18 04:46:56 2023"
  ..$ nNodes : int 6759
  ..$ nLinks : int 39774
  ..$ simple : logi NA
 $ nodes :'data.frame': 6759 obs. of  1 variable:
  ..$ ID: chr [1:6759] "ginger paste" "sea salt" "shortbread" "chocolate" ...
 $ links :'data.frame': 39774 obs. of  3 variables:
  ..$ ID: chr [1:39774] "e1" "e2" "e3" "e4" ...
  ..$ T : int [1:39774] 16 9 4 6 6 19 17 20 7 20 ...
  ..$ E :List of 39774
  .. ..$ : int [1:9] 5930 3243 3671 252 2291 1910 4243 2095 5046
  .. ..$ : int [1:11] 1979 1810 4799 5176 3494 836 4905 5565 2454 3689 ...
  .. ..$ : int [1:12] 4905 2291 4799 2387 2440 5635 6530 3311 3013 4578 ...
  .. ..$ : int [1:4] 4910 5990 4215 4799
  .. ..$ : int [1:20] 3240 1327 345 4447 678 2524 3689 4335 4799 6428 ...
  .. .. [list output truncated]
 $ data  :List of 1
  ..$ cuisine: chr [1:20] "korean" "russian" "vietnamese" "filipino" ...
> write(toJSON(HN),"Cooking.json")
vlado/work/hn/arb/cook.txt · Last modified: 2023/10/19 02:59 by vlado
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki