Commit 39a66792 authored by Megha Khosla's avatar Megha Khosla

Updated Docuemntation

parent 7571aa56
......@@ -49,8 +49,9 @@ int main(int argc, char **argv)
if ((i = ArgPos((char *)"-errorLog", argc, argv)) > 0) strcpy(error_log, argv[i + 1]);
if ((i = ArgPos((char *)"-inputvertex", argc, argv)) > 0) in_vertex = atoi(argv[i + 1]);
if ((i = ArgPos((char *)"-joint", argc, argv)) > 0) joint = atoi(argv[i + 1]);
if ((i = ArgPos((char *)"-initSrc", argc, argv)) > 0) strcpy(init_src, argv[i + 1]);
if ((i = ArgPos((char *)"-initDst", argc, argv)) > 0) strcpy(init_dst, argv[i + 1]);
// Arguments used for Non Random Initialization of Embeddings
//if ((i = ArgPos((char *)"-initSrc", argc, argv)) > 0) strcpy(init_src, argv[i + 1]);
// if ((i = ArgPos((char *)"-initDst", argc, argv)) > 0) strcpy(init_dst, argv[i + 1]);
if ((i = ArgPos((char *)"-weighted", argc, argv)) > 0) weighted = atoi(argv[i+1]);
total_samples *= 1000000;
......
#include "NERD.h"
int walkSize = 3, in_vertex =0,joint=0;
real error =0.0;
//real error =0.0;
char init_src[MAX_STRING];char init_dst[MAX_STRING];
......@@ -29,9 +29,10 @@ void InitVector() {
for (b = 0; b < dim; b++) for (a = 0; a < num_vertices; a++)
// emb_context[a * dim + b] = (rand() / (real) RAND_MAX - 0.5) / dim;
emb_context[a*dim+b]=0;
OverwriteVector();
// OverwriteVector();
}
// For NOn Random Initialization of Embeddings
void OverwriteVector()
{
int num_vertices, dim, a, b;
......@@ -326,7 +327,7 @@ void Update(real *vec_u, real *vec_v, real *vec_error, int label) {
for (int c = 0; c != dim; c++) {
// printf("\n updating contexts");
vec_v[c] += g * vec_u[c];
error=g;
// error=g;
}
}
......@@ -340,8 +341,8 @@ void *TrainHINGEThread(void *id) {
unsigned long long seed = (long long) id;
real* errorList= new real[total_samples/10000];
fill(errorList,errorList+ (total_samples/10000),0);
// real* errorList= new real[total_samples/10000];
// fill(errorList,errorList+ (total_samples/10000),0);
while (1) {
......@@ -352,9 +353,9 @@ void *TrainHINGEThread(void *id) {
current_sample_count += count - last_count;
last_count = count;
errorList[i]= error;
// errorList[i]= error;
i++;
printf("%cRho: %f Progress: %.3lf%% Error: %lf", 13, rho, (real) current_sample_count / (real) (total_samples + 1) * 100,error);
printf("%cRho: %f Progress: %.3lf%% ", 13, rho, (real) current_sample_count / (real) (total_samples + 1) * 100);
fflush(stdout);
rho = init_rho * (1 - current_sample_count / (real) (total_samples + 1));
if (rho < init_rho * 0.0001) rho = init_rho * 0.0001;
......@@ -392,8 +393,8 @@ void *TrainHINGEThread(void *id) {
}
WriteError(errorList);
delete []errorList;
// WriteError(errorList);
// delete []errorList;
pthread_exit(NULL);
}
......
......@@ -6,8 +6,7 @@ To Compile and Link : g++ -lgsl -lgslcblas -lm -pthread *.cpp -o NERD
The algorithm expects a directed weighted edgelist. If your graph is unweighted, please add 1 as weight for all edges. For undirected graphs, please add 2 edges ( in both directions) corresponding to each edge.
Example command for training : ./NERD -train edgelist.txt -output1 hub.txt -output2 auth.txt -binary 0 -size 128-walkSize 5 -negative 5 -samples 10 -rho 0.025 -threads 20 -joint 1 -inputvertex 0 -errorLog log_file_name
-initSrc "sourceEmbeddingFile" -initDst "destEmbeddingFile"
Example command for training : ./NERD -train edgelist.txt -output1 hub.txt -output2 auth.txt -binary 0 -size 128-walkSize 5 -negative 5 -samples 10 -rho 0.025 -threads 20 -joint 1 -inputvertex 0
Parameters for training:
......@@ -36,8 +35,4 @@ Parameters for training:
-inputvertex : if set 0 Use the first vertex in the walk sample as the input word otherwise use the middle vertex in the sample walk (default is 0)
-initSrc "sourceEmbeddingFile" : Uses "sourceEmbeddingFile" to initialize source (hub) embeddings
-initDst "destinationEmbeddingFile" : Uses "destinationEmbeddingFile" to initialize destination(auth) embeddings
-errorLog : Report error after every 10,000the sample in the file "log_file_name"
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment