thera 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -76,10 +76,12 @@ void DataSet::DataSet::index() {
76
76
  // TODO: this isn't really stratification; categories should be proportionally represented
77
77
  vector<vector<DataSet::Example *> > *DataSet::DataSet::stratify(int number_of_folds) {
78
78
  int examples_per_fold = examples.size() / number_of_folds;
79
+ vector<vector<Example *> > *folds = new vector<vector<Example *> >();
80
+ folds->resize(number_of_folds);
79
81
  Example *example;
80
- vector<vector<Example *> > *folds = new vector<vector<Example *> >(number_of_folds, vector<Example *>(examples_per_fold, NULL));
81
82
 
82
83
  for(int fold = 0; fold < number_of_folds; fold++) {
84
+ (*folds)[fold].resize(examples_per_fold);
83
85
  for(int i = 0; i < examples_per_fold; i++) {
84
86
  (*folds)[fold][i] = examples[fold + (i * number_of_folds)];
85
87
  }
@@ -59,7 +59,7 @@ void DataSet::NumericFeature::index_example(double value, Example *example) {
59
59
 
60
60
  void DataSet::NumericFeature::finalise_indexing(DataSet *data_set) {}
61
61
 
62
- void DataSet::NumericFeature::print(DataSet::DataSet *data_set) {
62
+ void DataSet::NumericFeature::print(DataSet *data_set) {
63
63
  cout << "F" << index << ", " << name << endl;
64
64
  print_counts(&counts);
65
65
  for(int i = 0; i < (data_set->categories_size() + 1); i++) {
data/thera.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.description = "C++ Data Mining Library for Ruby"
10
10
  s.email = "me@willcannings.com"
11
11
  s.authors = ["Will Cannings"]
12
- s.version = '0.0.6'
12
+ s.version = '0.0.7'
13
13
  s.extensions = ["ext/extconf.rb"]
14
14
 
15
15
  s.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thera
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-13 00:00:00.000000000Z
12
+ date: 2011-12-22 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rice
16
- requirement: &70149523474660 !ruby/object:Gem::Requirement
16
+ requirement: &70195705116960 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70149523474660
24
+ version_requirements: *70195705116960
25
25
  description: C++ Data Mining Library for Ruby
26
26
  email: me@willcannings.com
27
27
  executables: []
@@ -36,7 +36,6 @@ files:
36
36
  - LICENSE.txt
37
37
  - README.rdoc
38
38
  - Rakefile
39
- - ext/Makefile
40
39
  - ext/extconf.rb
41
40
  - ext/quarry/quarry_toolkit.cpp
42
41
  - lib/quarry/Makefile.linux
data/ext/Makefile DELETED
@@ -1,225 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- #### Start of system configuration section. ####
5
-
6
- srcdir = quarry
7
- topdir = /Users/will/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1
8
- hdrdir = /Users/will/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1
9
- arch_hdrdir = /Users/will/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/$(arch)
10
- VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
11
-
12
- prefix = $(DESTDIR)/Users/will/.rvm/rubies/ruby-1.9.2-p290
13
-
14
- rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
15
-
16
- exec_prefix = $(prefix)
17
-
18
- vendorhdrdir = $(rubyhdrdir)/vendor_ruby
19
-
20
- sitehdrdir = $(rubyhdrdir)/site_ruby
21
-
22
- rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version)
23
-
24
- vendordir = $(rubylibprefix)/vendor_ruby
25
-
26
- sitedir = $(rubylibprefix)/site_ruby
27
-
28
- ridir = $(datarootdir)/$(RI_BASE_NAME)
29
-
30
- mandir = $(datarootdir)/man
31
-
32
- localedir = $(datarootdir)/locale
33
-
34
- libdir = $(exec_prefix)/lib
35
-
36
- psdir = $(docdir)
37
-
38
- pdfdir = $(docdir)
39
-
40
- dvidir = $(docdir)
41
-
42
- htmldir = $(docdir)
43
-
44
- infodir = $(datarootdir)/info
45
-
46
- docdir = $(datarootdir)/doc/$(PACKAGE)
47
-
48
- oldincludedir = $(DESTDIR)/usr/include
49
-
50
- includedir = $(prefix)/include
51
-
52
- localstatedir = $(prefix)/var
53
-
54
- sharedstatedir = $(prefix)/com
55
-
56
- sysconfdir = $(prefix)/etc
57
-
58
- datadir = $(datarootdir)
59
-
60
- datarootdir = $(prefix)/share
61
-
62
- libexecdir = $(exec_prefix)/libexec
63
-
64
- sbindir = $(exec_prefix)/sbin
65
-
66
- bindir = $(exec_prefix)/bin
67
-
68
- rubylibdir = $(rubylibprefix)/$(ruby_version)
69
-
70
- archdir = $(rubylibdir)/$(arch)
71
-
72
- sitelibdir = $(sitedir)/$(ruby_version)
73
-
74
- sitearchdir = $(sitelibdir)/$(sitearch)
75
-
76
- vendorlibdir = $(vendordir)/$(ruby_version)
77
-
78
- vendorarchdir = $(vendorlibdir)/$(sitearch)
79
-
80
-
81
- CC = /usr/bin/gcc-4.2
82
- CXX = g++
83
- LIBRUBY = $(LIBRUBY_SO)
84
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
85
- LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
86
- LIBRUBYARG_STATIC = -lruby.1.9.1-static
87
- OUTFLAG = -o
88
- COUTFLAG = -o
89
-
90
- RUBY_EXTCONF_H =
91
- cflags = $(optflags) $(debugflags) $(warnflags)
92
- optflags = -O3
93
- debugflags = -ggdb
94
- warnflags = -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long
95
- CFLAGS = -fno-common -x c++
96
- INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) -I./../lib/quarry/src
97
- DEFS =
98
- CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags) -I/Users/will/.rvm/gems/ruby-1.9.2-p290/gems/rice-1.4.3/ruby/lib/include
99
- CXXFLAGS = $(CFLAGS) -Wall -g
100
- ldflags = -L. -L/usr/local/lib -L/Users/will/.rvm/gems/ruby-1.9.2-p290/gems/rice-1.4.3/ruby/lib/lib
101
- dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace
102
- ARCH_FLAG =
103
- DLDFLAGS = $(ldflags) $(dldflags)
104
- LDSHARED = g++ -dynamic -bundle
105
- LDSHAREDXX = $(CXX) -dynamic -bundle
106
- AR = ar
107
- EXEEXT =
108
-
109
- RUBY_BASE_NAME = ruby
110
- RUBY_INSTALL_NAME = ruby
111
- RUBY_SO_NAME = ruby.1.9.1
112
- arch = x86_64-darwin11.1.0
113
- sitearch = $(arch)
114
- ruby_version = 1.9.1
115
- ruby = /Users/will/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
116
- RUBY = $(ruby)
117
- RM = rm -f
118
- RM_RF = $(RUBY) -run -e rm -- -rf
119
- RMDIRS = $(RUBY) -run -e rmdir -- -p
120
- MAKEDIRS = mkdir -p
121
- INSTALL = /usr/bin/install -c
122
- INSTALL_PROG = $(INSTALL) -m 0755
123
- INSTALL_DATA = $(INSTALL) -m 644
124
- COPY = cp
125
-
126
- #### End of system configuration section. ####
127
-
128
- preload =
129
-
130
-
131
- CXX = g++
132
-
133
- libpath = . $(libdir) ./../lib/quarry/obj
134
- LIBPATH = -L. -L$(libdir) -L./../lib/quarry/obj
135
- DEFFILE =
136
-
137
- CLEANFILES = mkmf.log
138
- DISTCLEANFILES =
139
- DISTCLEANDIRS =
140
-
141
- extout =
142
- extout_prefix =
143
- target_prefix =
144
- LOCAL_LIBS =
145
- LIBS = -lquarry -lrice -lruby.1.9.1 -lpthread -ldl -lobjc
146
- SRCS = quarry_toolkit.cpp
147
- OBJS = quarry_toolkit.o
148
- TARGET = quarry_toolkit
149
- DLLIB = $(TARGET).bundle
150
- EXTSTATIC =
151
- STATIC_LIB =
152
-
153
- BINDIR = $(bindir)
154
- RUBYCOMMONDIR = $(sitedir)$(target_prefix)
155
- RUBYLIBDIR = $(sitelibdir)$(target_prefix)
156
- RUBYARCHDIR = $(sitearchdir)$(target_prefix)
157
- HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
158
- ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
159
-
160
- TARGET_SO = $(DLLIB)
161
- CLEANLIBS = $(TARGET).bundle
162
- CLEANOBJS = *.o *.bak
163
-
164
- all: $(DLLIB)
165
- static: $(STATIC_LIB)
166
- .PHONY: all install static install-so install-rb
167
- .PHONY: clean clean-so clean-rb
168
-
169
- clean-rb-default::
170
- clean-rb::
171
- clean-so::
172
- clean: clean-so clean-rb-default clean-rb
173
- @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
174
-
175
- distclean-rb-default::
176
- distclean-rb::
177
- distclean-so::
178
- distclean: clean distclean-so distclean-rb-default distclean-rb
179
- @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
180
- @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
181
- @-$(RMDIRS) $(DISTCLEANDIRS)
182
-
183
- realclean: distclean
184
- install: install-so install-rb
185
-
186
- install-so: $(RUBYARCHDIR)
187
- install-so: $(RUBYARCHDIR)/$(DLLIB)
188
- $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
189
- @-$(MAKEDIRS) $(@D)
190
- $(INSTALL_PROG) $(DLLIB) $(@D)
191
- install-rb: pre-install-rb install-rb-default
192
- install-rb-default: pre-install-rb-default
193
- pre-install-rb: Makefile
194
- pre-install-rb-default: Makefile
195
- $(RUBYARCHDIR):
196
- $(MAKEDIRS) $@
197
-
198
- site-install: site-install-so site-install-rb
199
- site-install-so: install-so
200
- site-install-rb: install-rb
201
-
202
- .SUFFIXES: .c .m .cc .cxx .cpp .C .o
203
-
204
- .cc.o:
205
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
206
-
207
- .cxx.o:
208
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
209
-
210
- .cpp.o:
211
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
212
-
213
- .C.o:
214
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
215
-
216
- .c.o:
217
- $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
218
-
219
- $(DLLIB): $(OBJS) Makefile
220
- @-$(RM) $(@)
221
- $(LDSHAREDXX) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
222
-
223
-
224
-
225
- $(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h