Ejemplo n.º 1
0
int main(int argc, char **argv) {
	int i;
	if (argc == 1) {
		printf("Reconstruct the network by using a Breadth-First-Search strategy\n\n");
		printf("Options:\n");
		printf("Parameters for training:\n");
		printf("\t-train <file>\n");
		printf("\t\tReconstruct the network from <file>\n");
		printf("\t-output <file>\n");
		printf("\t\tUse <file> to save the reconstructed network\n");
		printf("\t-depth <int>\n");
		printf("\t\tThe maximum depth in the Breadth-First-Search; default is 0\n");
		printf("\t-threshold <int>\n");
		printf("\t\tFor vertex whose degree is less than <int>, we will expand its neighbors until the degree reaches <iny>\n");
		printf("\nExamples:\n");
		printf("./reconstruct -train net.txt -output net_dense.txt -depth 2 -threshold 1000\n\n");
		return 0;
	}
	if ((i = ArgPos((char *)"-train", argc, argv)) > 0) strcpy(train_file, argv[i + 1]);
	if ((i = ArgPos((char *)"-output", argc, argv)) > 0) strcpy(output_file, argv[i + 1]);
	if ((i = ArgPos((char *)"-depth", argc, argv)) > 0) max_depth = atoi(argv[i + 1]);
	if ((i = ArgPos((char *)"-threshold", argc, argv)) > 0) max_k = atoi(argv[i + 1]);
	vertex = (struct ClassVertex *)calloc(max_num_vertices, sizeof(struct ClassVertex));
	TrainLINE();
	return 0;
}
Ejemplo n.º 2
0
int main(int argc, char **argv) {
  int i;
  if (argc == 1) {
    printf("LINE: Large Information Network Embedding\n\n");
    printf("Options:\n");
    printf("Parameters for training:\n");
    printf("\t-train <file>\n");
    printf("\t\tUse network data from <file> to train the model\n");
    printf("\t-output <file>\n");
    printf("\t\tUse <file> to save the learnt embeddings\n");
    printf("\t-binary <int>\n");
    printf("\t\tSave the learnt embeddings in binary moded; default is 0 (off)\n");
    printf("\t-size <int>\n");
    printf("\t\tSet dimension of vertex embeddings; default is 100\n");
    printf("\t-order <int>\n");
    printf("\t\tThe type of the model; 1 for first order, 2 for second order; default is 2\n");
    printf("\t-negative <int>\n");
    printf("\t\tNumber of negative examples; default is 5\n");
    printf("\t-samples <int>\n");
    printf("\t\tSet the number of training samples as <int>Million; default is 1\n");
    printf("\t-threads <int>\n");
    printf("\t\tUse <int> threads (default 1)\n");
    printf("\t-rho <float>\n");
    printf("\t\tSet the starting learning rate; default is 0.025\n");
    printf("\nExamples:\n");
    printf("./line -train net.txt -output vec.txt -binary 1 -size 200 -order 2 -negative 5 -samples 100 -rho 0.025 -threads 20\n\n");
    return 0;
  }
  if ((i = ArgPos((char *)"-train", argc, argv)) > 0) strcpy(network_file, argv[i + 1]);
  if ((i = ArgPos((char *)"-output", argc, argv)) > 0) strcpy(embedding_file, argv[i + 1]);
  if ((i = ArgPos((char *)"-binary", argc, argv)) > 0) is_binary = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-size", argc, argv)) > 0) dim = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-order", argc, argv)) > 0) order = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-negative", argc, argv)) > 0) num_negative = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-samples", argc, argv)) > 0) total_samples = atoi(argv[i + 1]);
  if ((i = ArgPos((char *)"-rho", argc, argv)) > 0) init_rho = atof(argv[i + 1]);
  if ((i = ArgPos((char *)"-threads", argc, argv)) > 0) num_threads = atoi(argv[i + 1]);
  total_samples *= 1000000;
  rho = init_rho;
  vertex = (struct ClassVertex *)calloc(max_num_vertices, sizeof(struct ClassVertex));
  TrainLINE();
  return 0;
}