Skip to content

Commit

Permalink
Description updated, membership made optional
Browse files Browse the repository at this point in the history
  • Loading branch information
luav committed Feb 12, 2017
1 parent 1f96eee commit e128ffe
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 68 deletions.
38 changes: 22 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,38 @@ AR = ar
LD = g++
WINDRES = windres

INC = -Iinclude -Iautogen
INC = -Iautogen -Iinclude
CFLAGS = -Wnon-virtual-dtor -Winit-self -Wcast-align -Wundef -Wfloat-equal -Wunreachable-code -Wmissing-include-dirs -Weffc++ -Wzero-as-null-pointer-constant -std=c++14 -fexceptions
RESINC =
LIBDIR =
LIB =
LIB = -lstdc++fs
LDFLAGS =

INC_DEBUG = $(INC)
CFLAGS_DEBUG = $(CFLAGS) -Wredundant-decls -Winline -Wswitch-default -Wmain -Wall -g -DDEBUG
CFLAGS_DEBUG = $(CFLAGS) -Wredundant-decls -Winline -Wswitch-default -Wmain -Wall -g -DDEBUG -DHEAVY_VALIDATION=2 -DTRACE=2
RESINC_DEBUG = $(RESINC)
RCFLAGS_DEBUG = $(RCFLAGS)
LIBDIR_DEBUG = $(LIBDIR)
LIB_DEBUG = $(LIB)
LDFLAGS_DEBUG = $(LDFLAGS)
OBJDIR_DEBUG = obj/Debug
DEP_DEBUG =
OUT_DEBUG = bin/Debug/onmi
OUT_DEBUG = bin/Debug/resmerge

INC_RELEASE = $(INC)
CFLAGS_RELEASE = $(CFLAGS) -march=core2 -fomit-frame-pointer -O3
CFLAGS_RELEASE = $(CFLAGS) -march=core2 -fomit-frame-pointer -O3 -DHEAVY_VALIDATION=1 -DTRACE=1
RESINC_RELEASE = $(RESINC)
RCFLAGS_RELEASE = $(RCFLAGS)
LIBDIR_RELEASE = $(LIBDIR)
LIB_RELEASE = $(LIB)
LDFLAGS_RELEASE = $(LDFLAGS) -s
OBJDIR_RELEASE = obj/Release
DEP_RELEASE =
OUT_RELEASE = bin/Release/onmi
OUT_RELEASE = bin/Release/resmerge

OBJ_DEBUG = $(OBJDIR_DEBUG)/autogen/cmdline.o $(OBJDIR_DEBUG)/onmi.o
OBJ_DEBUG = $(OBJDIR_DEBUG)/autogen/cmdline.o $(OBJDIR_DEBUG)/src/fileio.o $(OBJDIR_DEBUG)/src/main.o

OBJ_RELEASE = $(OBJDIR_RELEASE)/autogen/cmdline.o $(OBJDIR_RELEASE)/onmi.o
OBJ_RELEASE = $(OBJDIR_RELEASE)/autogen/cmdline.o $(OBJDIR_RELEASE)/src/fileio.o $(OBJDIR_RELEASE)/src/main.o

all: debug release

Expand All @@ -51,7 +51,7 @@ clean: clean_debug clean_release
before_debug:
test -d bin/Debug || mkdir -p bin/Debug
test -d $(OBJDIR_DEBUG)/autogen || mkdir -p $(OBJDIR_DEBUG)/autogen
test -d $(OBJDIR_DEBUG) || mkdir -p $(OBJDIR_DEBUG)
test -d $(OBJDIR_DEBUG)/src || mkdir -p $(OBJDIR_DEBUG)/src

after_debug:

Expand All @@ -63,19 +63,22 @@ out_debug: before_debug $(OBJ_DEBUG) $(DEP_DEBUG)
$(OBJDIR_DEBUG)/autogen/cmdline.o: autogen/cmdline.c
$(CC) $(CFLAGS_DEBUG) $(INC_DEBUG) -c autogen/cmdline.c -o $(OBJDIR_DEBUG)/autogen/cmdline.o

$(OBJDIR_DEBUG)/onmi.o: onmi.cpp
$(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c onmi.cpp -o $(OBJDIR_DEBUG)/onmi.o
$(OBJDIR_DEBUG)/src/fileio.o: src/fileio.cpp
$(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/fileio.cpp -o $(OBJDIR_DEBUG)/src/fileio.o

$(OBJDIR_DEBUG)/src/main.o: src/main.cpp
$(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/main.cpp -o $(OBJDIR_DEBUG)/src/main.o

clean_debug:
rm -f $(OBJ_DEBUG) $(OUT_DEBUG)
rm -rf bin/Debug
rm -rf $(OBJDIR_DEBUG)/autogen
rm -rf $(OBJDIR_DEBUG)
rm -rf $(OBJDIR_DEBUG)/src

before_release:
test -d bin/Release || mkdir -p bin/Release
test -d $(OBJDIR_RELEASE)/autogen || mkdir -p $(OBJDIR_RELEASE)/autogen
test -d $(OBJDIR_RELEASE) || mkdir -p $(OBJDIR_RELEASE)
test -d $(OBJDIR_RELEASE)/src || mkdir -p $(OBJDIR_RELEASE)/src

after_release:

Expand All @@ -87,14 +90,17 @@ out_release: before_release $(OBJ_RELEASE) $(DEP_RELEASE)
$(OBJDIR_RELEASE)/autogen/cmdline.o: autogen/cmdline.c
$(CC) $(CFLAGS_RELEASE) $(INC_RELEASE) -c autogen/cmdline.c -o $(OBJDIR_RELEASE)/autogen/cmdline.o

$(OBJDIR_RELEASE)/onmi.o: onmi.cpp
$(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c onmi.cpp -o $(OBJDIR_RELEASE)/onmi.o
$(OBJDIR_RELEASE)/src/fileio.o: src/fileio.cpp
$(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/fileio.cpp -o $(OBJDIR_RELEASE)/src/fileio.o

$(OBJDIR_RELEASE)/src/main.o: src/main.cpp
$(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/main.cpp -o $(OBJDIR_RELEASE)/src/main.o

clean_release:
rm -f $(OBJ_RELEASE) $(OUT_RELEASE)
rm -rf bin/Release
rm -rf $(OBJDIR_RELEASE)/autogen
rm -rf $(OBJDIR_RELEASE)
rm -rf $(OBJDIR_RELEASE)/src

.PHONY: before_debug after_debug clean_debug before_release after_release clean_release

25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,26 @@ _Applicability Note:_ OvpNMI is extremely fast, but does not suitable to evaluat
Execution Options:
```
$ ./onmi -h
onmi 0.2
onmi 0.3
Compare sets of clusters by their members (nodes) using various measures (NMI,
Omega) and considering overlaps
Usage: onmi [OPTIONS] clsfile1 clsfile2
-h, --help Print help and exit
-V, --version Print version and exit
-s, --sync synchronize the node base, for example to fairly evaluate
against top K selected clusters that are subset of the
original nodes (default=off)
-a, --allnmis output all NMIs (sum-denominator and LFK besides the
max-denominator one) (default=off)
-o, --omega print the Omega measure (can be slow) (default=off)
-t, --textid use text ids of nodes instead of .cnl format (default=off)
-v, --verbose detailed debugging (default=off)
-h, --help Print help and exit
-V, --version Print version and exit
-s, --sync synchronize the node base, for example to fairly
evaluate against the top K selected clusters that
are subset of the original nodes (default=off)
-a, --allnmis output all NMIs (sum-denominator and LFK besides the
max-denominator one) (default=off)
-m, --membership=FLOAT average expected membership of nodes in the clusters,
> 0, typically >= 1 (default=`1')
-o, --omega print the Omega measure (can be slow) (default=off)
-t, --textid use text ids of nodes instead of .cnl format
(default=off)
-v, --verbose detailed debugging (default=off)
```
The input files contain list of clusters (communities, modules). A typical use case is to have
the "true" communities in one file and and those found by your algorithm in the other file.
Expand Down
4 changes: 2 additions & 2 deletions args.ggo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Configuration file for the automatic generation of the ONMI input options parsing

package "onmi"
version "0.2"
version "0.3"

purpose "Compare sets of clusters by their members (nodes) using various measures (NMI, Omega) and considering overlaps"

Expand All @@ -13,7 +13,7 @@ option "omega" o "print the Omega measure (can be slow)" flag off
option "textid" t "use text ids of nodes instead of .cnl format" flag off
option "verbose" v "detailed debugging" flag off

args "--unamed-opts=clusterings" # Allow input files to be unnamed parameters
args "--default-optional --unamed-opts=clusterings" # Set opional opions, allow input files to be unnamed parameters

# Basic structure, see https://www.gnu.org/software/gengetopt/gengetopt.html#Basic-Usage
# package "<packname>"
Expand Down
42 changes: 4 additions & 38 deletions autogen/cmdline.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
File autogenerated by gengetopt version 2.22.6
generated with the following command:
gengetopt --output-dir autogen -i args.ggo --unamed-opts=clusterings
gengetopt --output-dir autogen -i args.ggo --default-optional --unamed-opts=clusterings
The developers of gengetopt consider the fixed text that goes in all
gengetopt output files to be in the public domain:
Expand Down Expand Up @@ -59,8 +59,6 @@ static int
cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
struct cmdline_parser_params *params, const char *additional_error);

static int
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error);

static char *
gengetopt_strdup (const char *s);
Expand Down Expand Up @@ -338,37 +336,9 @@ cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, i
int
cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
{
int result = EXIT_SUCCESS;

if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
result = EXIT_FAILURE;

if (result == EXIT_FAILURE)
{
cmdline_parser_free (args_info);
exit (EXIT_FAILURE);
}

return result;
}

int
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
{
int error_occurred = 0;
FIX_UNUSED (additional_error);

/* checks for required options */
if (! args_info->membership_given)
{
fprintf (stderr, "%s: '--membership' ('-m') option required%s\n", prog_name, (additional_error ? additional_error : ""));
error_occurred = 1;
}


/* checks for dependences among options */

return error_occurred;
FIX_UNUSED (args_info);
FIX_UNUSED (prog_name);
return EXIT_SUCCESS;
}


Expand Down Expand Up @@ -619,10 +589,6 @@ cmdline_parser_internal (



if (check_required)
{
error_occurred += cmdline_parser_required2 (args_info, argv[0], additional_error);
}

cmdline_parser_release (&local_args_info);

Expand Down
2 changes: 1 addition & 1 deletion autogen/cmdline.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern "C" {

#ifndef CMDLINE_PARSER_VERSION
/** @brief the program version */
#define CMDLINE_PARSER_VERSION "0.2"
#define CMDLINE_PARSER_VERSION "0.3"
#endif

/** @brief Where the command line options are stored */
Expand Down

0 comments on commit e128ffe

Please sign in to comment.