eluka 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/.document +5 -0
  2. data/DOCUMENTATION_STANDARDS +39 -0
  3. data/Gemfile +13 -0
  4. data/Gemfile.lock +20 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.rdoc +19 -0
  7. data/Rakefile +69 -0
  8. data/VERSION +1 -0
  9. data/examples/example.rb +59 -0
  10. data/ext/libsvm/COPYRIGHT +31 -0
  11. data/ext/libsvm/FAQ.html +1749 -0
  12. data/ext/libsvm/Makefile +25 -0
  13. data/ext/libsvm/Makefile.win +33 -0
  14. data/ext/libsvm/README +733 -0
  15. data/ext/libsvm/extconf.rb +1 -0
  16. data/ext/libsvm/heart_scale +270 -0
  17. data/ext/libsvm/java/Makefile +25 -0
  18. data/ext/libsvm/java/libsvm.jar +0 -0
  19. data/ext/libsvm/java/libsvm/svm.java +2776 -0
  20. data/ext/libsvm/java/libsvm/svm.m4 +2776 -0
  21. data/ext/libsvm/java/libsvm/svm_model.java +21 -0
  22. data/ext/libsvm/java/libsvm/svm_node.java +6 -0
  23. data/ext/libsvm/java/libsvm/svm_parameter.java +47 -0
  24. data/ext/libsvm/java/libsvm/svm_print_interface.java +5 -0
  25. data/ext/libsvm/java/libsvm/svm_problem.java +7 -0
  26. data/ext/libsvm/java/svm_predict.java +163 -0
  27. data/ext/libsvm/java/svm_scale.java +350 -0
  28. data/ext/libsvm/java/svm_toy.java +471 -0
  29. data/ext/libsvm/java/svm_train.java +318 -0
  30. data/ext/libsvm/java/test_applet.html +1 -0
  31. data/ext/libsvm/python/Makefile +4 -0
  32. data/ext/libsvm/python/README +331 -0
  33. data/ext/libsvm/python/svm.py +259 -0
  34. data/ext/libsvm/python/svmutil.py +242 -0
  35. data/ext/libsvm/svm-predict.c +226 -0
  36. data/ext/libsvm/svm-scale.c +353 -0
  37. data/ext/libsvm/svm-toy/gtk/Makefile +22 -0
  38. data/ext/libsvm/svm-toy/gtk/callbacks.cpp +423 -0
  39. data/ext/libsvm/svm-toy/gtk/callbacks.h +54 -0
  40. data/ext/libsvm/svm-toy/gtk/interface.c +164 -0
  41. data/ext/libsvm/svm-toy/gtk/interface.h +14 -0
  42. data/ext/libsvm/svm-toy/gtk/main.c +23 -0
  43. data/ext/libsvm/svm-toy/gtk/svm-toy.glade +238 -0
  44. data/ext/libsvm/svm-toy/qt/Makefile +17 -0
  45. data/ext/libsvm/svm-toy/qt/svm-toy.cpp +413 -0
  46. data/ext/libsvm/svm-toy/windows/svm-toy.cpp +456 -0
  47. data/ext/libsvm/svm-train.c +376 -0
  48. data/ext/libsvm/svm.cpp +3060 -0
  49. data/ext/libsvm/svm.def +19 -0
  50. data/ext/libsvm/svm.h +105 -0
  51. data/ext/libsvm/svm.o +0 -0
  52. data/ext/libsvm/tools/README +149 -0
  53. data/ext/libsvm/tools/checkdata.py +108 -0
  54. data/ext/libsvm/tools/easy.py +79 -0
  55. data/ext/libsvm/tools/grid.py +359 -0
  56. data/ext/libsvm/tools/subset.py +146 -0
  57. data/ext/libsvm/windows/libsvm.dll +0 -0
  58. data/ext/libsvm/windows/svm-predict.exe +0 -0
  59. data/ext/libsvm/windows/svm-scale.exe +0 -0
  60. data/ext/libsvm/windows/svm-toy.exe +0 -0
  61. data/ext/libsvm/windows/svm-train.exe +0 -0
  62. data/lib/eluka.rb +10 -0
  63. data/lib/eluka/bijection.rb +23 -0
  64. data/lib/eluka/data_point.rb +36 -0
  65. data/lib/eluka/document.rb +47 -0
  66. data/lib/eluka/feature_vector.rb +86 -0
  67. data/lib/eluka/features.rb +31 -0
  68. data/lib/eluka/model.rb +129 -0
  69. data/lib/fselect.rb +321 -0
  70. data/lib/grid.rb +25 -0
  71. data/test/helper.rb +18 -0
  72. data/test/test_eluka.rb +7 -0
  73. metadata +214 -0
@@ -0,0 +1,164 @@
1
+ /*
2
+ * DO NOT EDIT THIS FILE - it is generated by Glade.
3
+ */
4
+
5
+ #include <sys/types.h>
6
+ #include <sys/stat.h>
7
+ #include <unistd.h>
8
+ #include <string.h>
9
+
10
+ #include <gdk/gdkkeysyms.h>
11
+ #include <gtk/gtk.h>
12
+
13
+ #include "callbacks.h"
14
+ #include "interface.h"
15
+
16
+ GtkWidget*
17
+ create_window (void)
18
+ {
19
+ GtkWidget *window;
20
+ GtkWidget *vbox1;
21
+ extern GtkWidget *draw_main;
22
+ GtkWidget *hbox1;
23
+ GtkWidget *button_change;
24
+ GtkWidget *button_run;
25
+ GtkWidget *button_clear;
26
+ GtkWidget *button_save;
27
+ GtkWidget *button_load;
28
+ extern GtkWidget *entry_option;
29
+
30
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
31
+ gtk_object_set_data (GTK_OBJECT (window), "window", window);
32
+ gtk_window_set_title (GTK_WINDOW (window), "SVM Toy");
33
+
34
+ vbox1 = gtk_vbox_new (FALSE, 0);
35
+ gtk_widget_ref (vbox1);
36
+ gtk_object_set_data_full (GTK_OBJECT (window), "vbox1", vbox1,
37
+ (GtkDestroyNotify) gtk_widget_unref);
38
+ gtk_widget_show (vbox1);
39
+ gtk_container_add (GTK_CONTAINER (window), vbox1);
40
+
41
+ draw_main = gtk_drawing_area_new ();
42
+ gtk_widget_ref (draw_main);
43
+ gtk_object_set_data_full (GTK_OBJECT (window), "draw_main", draw_main,
44
+ (GtkDestroyNotify) gtk_widget_unref);
45
+ gtk_widget_show (draw_main);
46
+ gtk_box_pack_start (GTK_BOX (vbox1), draw_main, TRUE, TRUE, 0);
47
+ gtk_widget_set_usize (draw_main, 500, 500);
48
+ gtk_widget_set_events (draw_main, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
49
+
50
+ hbox1 = gtk_hbox_new (FALSE, 0);
51
+ gtk_widget_ref (hbox1);
52
+ gtk_object_set_data_full (GTK_OBJECT (window), "hbox1", hbox1,
53
+ (GtkDestroyNotify) gtk_widget_unref);
54
+ gtk_widget_show (hbox1);
55
+ gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
56
+
57
+ button_change = gtk_button_new_with_label ("Change");
58
+ gtk_widget_ref (button_change);
59
+ gtk_object_set_data_full (GTK_OBJECT (window), "button_change", button_change,
60
+ (GtkDestroyNotify) gtk_widget_unref);
61
+ gtk_widget_show (button_change);
62
+ gtk_box_pack_start (GTK_BOX (hbox1), button_change, FALSE, FALSE, 0);
63
+
64
+ button_run = gtk_button_new_with_label ("Run");
65
+ gtk_widget_ref (button_run);
66
+ gtk_object_set_data_full (GTK_OBJECT (window), "button_run", button_run,
67
+ (GtkDestroyNotify) gtk_widget_unref);
68
+ gtk_widget_show (button_run);
69
+ gtk_box_pack_start (GTK_BOX (hbox1), button_run, FALSE, FALSE, 0);
70
+
71
+ button_clear = gtk_button_new_with_label ("Clear");
72
+ gtk_widget_ref (button_clear);
73
+ gtk_object_set_data_full (GTK_OBJECT (window), "button_clear", button_clear,
74
+ (GtkDestroyNotify) gtk_widget_unref);
75
+ gtk_widget_show (button_clear);
76
+ gtk_box_pack_start (GTK_BOX (hbox1), button_clear, FALSE, FALSE, 0);
77
+
78
+ button_save = gtk_button_new_with_label ("Save");
79
+ gtk_widget_ref (button_save);
80
+ gtk_object_set_data_full (GTK_OBJECT (window), "button_save", button_save,
81
+ (GtkDestroyNotify) gtk_widget_unref);
82
+ gtk_widget_show (button_save);
83
+ gtk_box_pack_start (GTK_BOX (hbox1), button_save, FALSE, FALSE, 0);
84
+
85
+ button_load = gtk_button_new_with_label ("Load");
86
+ gtk_widget_ref (button_load);
87
+ gtk_object_set_data_full (GTK_OBJECT (window), "button_load", button_load,
88
+ (GtkDestroyNotify) gtk_widget_unref);
89
+ gtk_widget_show (button_load);
90
+ gtk_box_pack_start (GTK_BOX (hbox1), button_load, FALSE, FALSE, 0);
91
+
92
+ entry_option = gtk_entry_new ();
93
+ gtk_widget_ref (entry_option);
94
+ gtk_object_set_data_full (GTK_OBJECT (window), "entry_option", entry_option,
95
+ (GtkDestroyNotify) gtk_widget_unref);
96
+ gtk_widget_show (entry_option);
97
+ gtk_box_pack_start (GTK_BOX (hbox1), entry_option, TRUE, TRUE, 0);
98
+
99
+ gtk_signal_connect (GTK_OBJECT (window), "destroy",
100
+ GTK_SIGNAL_FUNC (on_window1_destroy),
101
+ NULL);
102
+ gtk_signal_connect (GTK_OBJECT (draw_main), "button_press_event",
103
+ GTK_SIGNAL_FUNC (on_draw_main_button_press_event),
104
+ NULL);
105
+ gtk_signal_connect (GTK_OBJECT (draw_main), "expose_event",
106
+ GTK_SIGNAL_FUNC (on_draw_main_expose_event),
107
+ NULL);
108
+ gtk_signal_connect (GTK_OBJECT (button_change), "clicked",
109
+ GTK_SIGNAL_FUNC (on_button_change_clicked),
110
+ NULL);
111
+ gtk_signal_connect (GTK_OBJECT (button_run), "clicked",
112
+ GTK_SIGNAL_FUNC (on_button_run_clicked),
113
+ NULL);
114
+ gtk_signal_connect (GTK_OBJECT (button_clear), "clicked",
115
+ GTK_SIGNAL_FUNC (on_button_clear_clicked),
116
+ NULL);
117
+ gtk_signal_connect (GTK_OBJECT (button_save), "clicked",
118
+ GTK_SIGNAL_FUNC (on_button_save_clicked),
119
+ NULL);
120
+ gtk_signal_connect (GTK_OBJECT (button_load), "clicked",
121
+ GTK_SIGNAL_FUNC (on_button_load_clicked),
122
+ NULL);
123
+ gtk_signal_connect (GTK_OBJECT (entry_option), "activate",
124
+ GTK_SIGNAL_FUNC (on_button_run_clicked),
125
+ NULL);
126
+
127
+ return window;
128
+ }
129
+
130
+ GtkWidget*
131
+ create_fileselection (void)
132
+ {
133
+ GtkWidget *fileselection;
134
+ GtkWidget *filesel_ok;
135
+ GtkWidget *filesel_cancel;
136
+
137
+ fileselection = gtk_file_selection_new ("Select File");
138
+ gtk_object_set_data (GTK_OBJECT (fileselection), "fileselection", fileselection);
139
+ gtk_container_set_border_width (GTK_CONTAINER (fileselection), 10);
140
+ gtk_window_set_modal (GTK_WINDOW (fileselection), TRUE);
141
+
142
+ filesel_ok = GTK_FILE_SELECTION (fileselection)->ok_button;
143
+ gtk_object_set_data (GTK_OBJECT (fileselection), "filesel_ok", filesel_ok);
144
+ gtk_widget_show (filesel_ok);
145
+ GTK_WIDGET_SET_FLAGS (filesel_ok, GTK_CAN_DEFAULT);
146
+
147
+ filesel_cancel = GTK_FILE_SELECTION (fileselection)->cancel_button;
148
+ gtk_object_set_data (GTK_OBJECT (fileselection), "filesel_cancel", filesel_cancel);
149
+ gtk_widget_show (filesel_cancel);
150
+ GTK_WIDGET_SET_FLAGS (filesel_cancel, GTK_CAN_DEFAULT);
151
+
152
+ gtk_signal_connect (GTK_OBJECT (fileselection), "destroy",
153
+ GTK_SIGNAL_FUNC (on_fileselection_destroy),
154
+ NULL);
155
+ gtk_signal_connect (GTK_OBJECT (filesel_ok), "clicked",
156
+ GTK_SIGNAL_FUNC (on_filesel_ok_clicked),
157
+ NULL);
158
+ gtk_signal_connect (GTK_OBJECT (filesel_cancel), "clicked",
159
+ GTK_SIGNAL_FUNC (on_filesel_cancel_clicked),
160
+ NULL);
161
+
162
+ return fileselection;
163
+ }
164
+
@@ -0,0 +1,14 @@
1
+ /*
2
+ * DO NOT EDIT THIS FILE - it is generated by Glade.
3
+ */
4
+
5
+ #ifdef __cplusplus
6
+ extern "C" {
7
+ #endif
8
+
9
+ GtkWidget* create_window (void);
10
+ GtkWidget* create_fileselection (void);
11
+
12
+ #ifdef __cplusplus
13
+ }
14
+ #endif
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Initial main.c file generated by Glade. Edit as required.
3
+ * Glade will not overwrite this file.
4
+ */
5
+
6
+ #include <gtk/gtk.h>
7
+ #include "interface.h"
8
+ void svm_toy_initialize();
9
+
10
+ int main (int argc, char *argv[])
11
+ {
12
+ GtkWidget *window;
13
+
14
+ gtk_set_locale ();
15
+ gtk_init (&argc, &argv);
16
+
17
+ window = create_window ();
18
+ gtk_widget_show (window);
19
+
20
+ svm_toy_initialize();
21
+ gtk_main ();
22
+ return 0;
23
+ }
@@ -0,0 +1,238 @@
1
+ <?xml version="1.0"?>
2
+ <GTK-Interface>
3
+
4
+ <project>
5
+ <name>svm-toy</name>
6
+ <program_name>svm-toy</program_name>
7
+ <directory></directory>
8
+ <source_directory>src</source_directory>
9
+ <pixmaps_directory>pixmaps</pixmaps_directory>
10
+ <language>C</language>
11
+ <gnome_support>False</gnome_support>
12
+ <gettext_support>False</gettext_support>
13
+ <use_widget_names>False</use_widget_names>
14
+ <output_main_file>True</output_main_file>
15
+ <output_support_files>True</output_support_files>
16
+ <output_build_files>True</output_build_files>
17
+ <backup_source_files>False</backup_source_files>
18
+ <main_source_file>interface.c</main_source_file>
19
+ <main_header_file>interface.h</main_header_file>
20
+ <handler_source_file>callbacks.c</handler_source_file>
21
+ <handler_header_file>callbacks.h</handler_header_file>
22
+ <support_source_file>support.c</support_source_file>
23
+ <support_header_file>support.h</support_header_file>
24
+ <translatable_strings_file></translatable_strings_file>
25
+ </project>
26
+
27
+ <widget>
28
+ <class>GtkWindow</class>
29
+ <name>window</name>
30
+ <signal>
31
+ <name>destroy</name>
32
+ <handler>on_window1_destroy</handler>
33
+ <last_modification_time>Sun, 16 Apr 2000 09:47:10 GMT</last_modification_time>
34
+ </signal>
35
+ <title>SVM Toy</title>
36
+ <type>GTK_WINDOW_TOPLEVEL</type>
37
+ <position>GTK_WIN_POS_NONE</position>
38
+ <modal>False</modal>
39
+ <allow_shrink>False</allow_shrink>
40
+ <allow_grow>True</allow_grow>
41
+ <auto_shrink>False</auto_shrink>
42
+
43
+ <widget>
44
+ <class>GtkVBox</class>
45
+ <name>vbox1</name>
46
+ <homogeneous>False</homogeneous>
47
+ <spacing>0</spacing>
48
+
49
+ <widget>
50
+ <class>GtkDrawingArea</class>
51
+ <name>draw_main</name>
52
+ <width>500</width>
53
+ <height>500</height>
54
+ <events>GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK</events>
55
+ <signal>
56
+ <name>button_press_event</name>
57
+ <handler>on_draw_main_button_press_event</handler>
58
+ <last_modification_time>Sun, 16 Apr 2000 13:02:05 GMT</last_modification_time>
59
+ </signal>
60
+ <signal>
61
+ <name>expose_event</name>
62
+ <handler>on_draw_main_expose_event</handler>
63
+ <last_modification_time>Sun, 16 Apr 2000 14:27:05 GMT</last_modification_time>
64
+ </signal>
65
+ <child>
66
+ <padding>0</padding>
67
+ <expand>True</expand>
68
+ <fill>True</fill>
69
+ </child>
70
+ </widget>
71
+
72
+ <widget>
73
+ <class>GtkHBox</class>
74
+ <name>hbox1</name>
75
+ <homogeneous>False</homogeneous>
76
+ <spacing>0</spacing>
77
+ <child>
78
+ <padding>0</padding>
79
+ <expand>False</expand>
80
+ <fill>False</fill>
81
+ </child>
82
+
83
+ <widget>
84
+ <class>GtkButton</class>
85
+ <name>button_change</name>
86
+ <can_focus>True</can_focus>
87
+ <signal>
88
+ <name>clicked</name>
89
+ <handler>on_button_change_clicked</handler>
90
+ <last_modification_time>Sun, 16 Apr 2000 09:40:18 GMT</last_modification_time>
91
+ </signal>
92
+ <label>Change</label>
93
+ <child>
94
+ <padding>0</padding>
95
+ <expand>False</expand>
96
+ <fill>False</fill>
97
+ </child>
98
+ </widget>
99
+
100
+ <widget>
101
+ <class>GtkButton</class>
102
+ <name>button_run</name>
103
+ <can_focus>True</can_focus>
104
+ <signal>
105
+ <name>clicked</name>
106
+ <handler>on_button_run_clicked</handler>
107
+ <last_modification_time>Sun, 16 Apr 2000 09:40:37 GMT</last_modification_time>
108
+ </signal>
109
+ <label>Run</label>
110
+ <child>
111
+ <padding>0</padding>
112
+ <expand>False</expand>
113
+ <fill>False</fill>
114
+ </child>
115
+ </widget>
116
+
117
+ <widget>
118
+ <class>GtkButton</class>
119
+ <name>button_clear</name>
120
+ <can_focus>True</can_focus>
121
+ <signal>
122
+ <name>clicked</name>
123
+ <handler>on_button_clear_clicked</handler>
124
+ <last_modification_time>Sun, 16 Apr 2000 09:40:44 GMT</last_modification_time>
125
+ </signal>
126
+ <label>Clear</label>
127
+ <child>
128
+ <padding>0</padding>
129
+ <expand>False</expand>
130
+ <fill>False</fill>
131
+ </child>
132
+ </widget>
133
+
134
+ <widget>
135
+ <class>GtkButton</class>
136
+ <name>button_save</name>
137
+ <can_focus>True</can_focus>
138
+ <signal>
139
+ <name>clicked</name>
140
+ <handler>on_button_save_clicked</handler>
141
+ <last_modification_time>Fri, 16 Jun 2000 18:23:46 GMT</last_modification_time>
142
+ </signal>
143
+ <label>Save</label>
144
+ <child>
145
+ <padding>0</padding>
146
+ <expand>False</expand>
147
+ <fill>False</fill>
148
+ </child>
149
+ </widget>
150
+
151
+ <widget>
152
+ <class>GtkButton</class>
153
+ <name>button_load</name>
154
+ <can_focus>True</can_focus>
155
+ <signal>
156
+ <name>clicked</name>
157
+ <handler>on_button_load_clicked</handler>
158
+ <last_modification_time>Fri, 16 Jun 2000 18:23:56 GMT</last_modification_time>
159
+ </signal>
160
+ <label>Load</label>
161
+ <child>
162
+ <padding>0</padding>
163
+ <expand>False</expand>
164
+ <fill>False</fill>
165
+ </child>
166
+ </widget>
167
+
168
+ <widget>
169
+ <class>GtkEntry</class>
170
+ <name>entry_option</name>
171
+ <can_focus>True</can_focus>
172
+ <signal>
173
+ <name>activate</name>
174
+ <handler>on_button_run_clicked</handler>
175
+ <last_modification_time>Sun, 16 Apr 2000 09:42:46 GMT</last_modification_time>
176
+ </signal>
177
+ <editable>True</editable>
178
+ <text_visible>True</text_visible>
179
+ <text_max_length>0</text_max_length>
180
+ <text></text>
181
+ <child>
182
+ <padding>0</padding>
183
+ <expand>True</expand>
184
+ <fill>True</fill>
185
+ </child>
186
+ </widget>
187
+ </widget>
188
+ </widget>
189
+ </widget>
190
+
191
+ <widget>
192
+ <class>GtkFileSelection</class>
193
+ <name>fileselection</name>
194
+ <border_width>10</border_width>
195
+ <signal>
196
+ <name>destroy</name>
197
+ <handler>on_fileselection_destroy</handler>
198
+ <last_modification_time>Fri, 16 Jun 2000 18:11:28 GMT</last_modification_time>
199
+ </signal>
200
+ <title>Select File</title>
201
+ <type>GTK_WINDOW_TOPLEVEL</type>
202
+ <position>GTK_WIN_POS_NONE</position>
203
+ <modal>True</modal>
204
+ <allow_shrink>False</allow_shrink>
205
+ <allow_grow>True</allow_grow>
206
+ <auto_shrink>False</auto_shrink>
207
+ <show_file_op_buttons>True</show_file_op_buttons>
208
+
209
+ <widget>
210
+ <class>GtkButton</class>
211
+ <child_name>FileSel:ok_button</child_name>
212
+ <name>filesel_ok</name>
213
+ <can_default>True</can_default>
214
+ <can_focus>True</can_focus>
215
+ <signal>
216
+ <name>clicked</name>
217
+ <handler>on_filesel_ok_clicked</handler>
218
+ <last_modification_time>Fri, 16 Jun 2000 18:09:56 GMT</last_modification_time>
219
+ </signal>
220
+ <label>OK</label>
221
+ </widget>
222
+
223
+ <widget>
224
+ <class>GtkButton</class>
225
+ <child_name>FileSel:cancel_button</child_name>
226
+ <name>filesel_cancel</name>
227
+ <can_default>True</can_default>
228
+ <can_focus>True</can_focus>
229
+ <signal>
230
+ <name>clicked</name>
231
+ <handler>on_filesel_cancel_clicked</handler>
232
+ <last_modification_time>Fri, 16 Jun 2000 18:09:46 GMT</last_modification_time>
233
+ </signal>
234
+ <label>Cancel</label>
235
+ </widget>
236
+ </widget>
237
+
238
+ </GTK-Interface>
@@ -0,0 +1,17 @@
1
+ CXX? = g++
2
+ CFLAGS = -Wall -O3 -I$(INCLUDE) -I$(INCLUDE)/QtGui -lQtGui
3
+ INCLUDE = /usr/include/qt4
4
+ MOC = /usr/bin/moc-qt4
5
+
6
+ svm-toy: svm-toy.cpp svm-toy.moc ../../svm.o
7
+ $(CXX) $(CFLAGS) svm-toy.cpp ../../svm.o -o svm-toy
8
+
9
+ svm-toy.moc: svm-toy.cpp
10
+ $(MOC) svm-toy.cpp -o svm-toy.moc
11
+
12
+ ../../svm.o:
13
+ cd ../..; make svm.o
14
+
15
+ clean:
16
+ rm -f *~ svm-toy svm-toy.moc ../../svm.o
17
+