Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function finalizeTrain():void
- {
- var _this_leaf:int = number_of_samples_for_this_leaf;
- var _this_leaf_sz:int = numLeavesPerFern;
- var _number_of_samples_for_class:int = number_of_samples_for_class;
- var _leaves_counters:int = leaves_counters;
- var _leaves_distributions:int = leaves_distributions;
- var np:int = numPoints;
- var nf:int = numFerns;
- var ptr1:int;
- for(var i:int = 0; i < nf; ++i)
- {
- var istep2:int = __cint(i * step2);
- var number_of_samples_for_this_fern:Number = 0.0;
- ptr1 = _this_leaf;
- for(var j:int = 0; j < _this_leaf_sz; ++j)
- {
- var jstep1:int = __cint(j * step1);
- var istep2_jstep1:int = __cint(istep2 + jstep1);
- var tmp:Number = 0.0;
- for(var k:int = 0; k < np; ++k)
- {
- var nsfc:Number = Memory.readInt(__cint(_number_of_samples_for_class + (k<<2)));
- var lcs:Number = Memory.readUnsignedShort(__cint(_leaves_counters + ((istep2_jstep1 + k)<<1)));
- var rat:Number = lcs / nsfc;
- number_of_samples_for_this_fern += rat;
- tmp += rat;
- }
- Memory.writeDouble(tmp, ptr1);
- ptr1 = __cint(ptr1 + 8);
- }
- for(k = 0; k < np; ++k)
- {
- nsfc = Memory.readInt(__cint(_number_of_samples_for_class + (k<<2)));
- tmp = 0.0;
- for(j = 0; j < _this_leaf_sz; ++j)
- {
- istep2_jstep1 = __cint(istep2 + (j * step1) + k);
- lcs = Memory.readUnsignedShort(__cint(_leaves_counters + (istep2_jstep1<<1)));
- tmp += lcs / nsfc;
- }
- ptr1 = _this_leaf;
- for(j = 0; j < _this_leaf_sz; ++j)
- {
- istep2_jstep1 = __cint(istep2 + (j * step1) + k);
- lcs = Memory.readUnsignedShort(__cint(_leaves_counters + (istep2_jstep1<<1)));
- rat = Math.log(
- lcs / nsfc / tmp / (Memory.readDouble(ptr1) / number_of_samples_for_this_fern)
- );
- Memory.writeFloat(rat, __cint(_leaves_distributions + (istep2_jstep1<<2)) );
- //
- ptr1 = __cint(ptr1 + 8);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement