Editing Machine Learning/Kaggle Social Network Contest/load data
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
= | =Python= | ||
== How to load the network into networkx == | == How to load the network into networkx == | ||
There is a network analysis package for Python called [http://networkx.lanl.gov/ networkx]. This package can be installed using easy_install. | There is a network analysis package for Python called [http://networkx.lanl.gov/ networkx]. This package can be installed using easy_install. | ||
Line 91: | Line 75: | ||
adj_list_lookup = load_adj_list_faster('adj_list.out.csv') | adj_list_lookup = load_adj_list_faster('adj_list.out.csv') | ||
rev_adj_list_lookup = load_adj_list_faster('reverse_adj_list.out.csv') | rev_adj_list_lookup = load_adj_list_faster('reverse_adj_list.out.csv') | ||
</pre> | |||
= R = | |||
== igraph == | |||
The full dataset loaded pretty fast using the R package igraph. With the full data set loaded R is using less than 900MB of RAM. | |||
Grab the package with: | |||
<pre> | |||
install.packages("igraph") | |||
</pre> | |||
Load the data using: | |||
<pre> | |||
data <-as.matrix(read.csv("social_train.csv", header = FALSE)); | |||
dg <- graph.edgelist(data, directed=TRUE) | |||
</pre> | </pre> |