diff --git a/Ejemplo.xlsx b/Ejemplo.xlsx new file mode 100644 index 0000000..355968b Binary files /dev/null and b/Ejemplo.xlsx differ diff --git a/feature0.txt b/feature0.txt new file mode 100644 index 0000000..fbc8eb6 --- /dev/null +++ b/feature0.txt @@ -0,0 +1,152 @@ ++++++++++++++++++++++++ +( 0, 13) -> (4.3, 0) +( 1, 8) -> (4.4, 0) +( 2, 38) -> (4.4, 0) +( 3, 42) -> (4.4, 0) +( 4, 41) -> (4.5, 0) +( 5, 3) -> (4.6, 0) +( 6, 6) -> (4.6, 0) +( 7, 22) -> (4.6, 0) +( 8, 47) -> (4.6, 0) +( 9, 2) -> (4.7, 0) +( 10, 29) -> (4.7, 0) +( 11, 11) -> (4.8, 0) +( 12, 12) -> (4.8, 0) +( 13, 24) -> (4.8, 0) +( 14, 30) -> (4.8, 0) +( 15, 45) -> (4.8, 0) +( 16, 1) -> (4.9, 0) +( 17, 9) -> (4.9, 0) +( 18, 34) -> (4.9, 0) +( 19, 37) -> (4.9, 0) +( 20, 57) -> (4.9, 1) +( 21, 106) -> (4.9, 2) +( 22, 4) -> (5.0, 0) +( 23, 7) -> (5.0, 0) +( 24, 25) -> (5.0, 0) +( 25, 26) -> (5.0, 0) +( 26, 35) -> (5.0, 0) +( 27, 40) -> (5.0, 0) +( 28, 43) -> (5.0, 0) +( 29, 49) -> (5.0, 0) +( 30, 60) -> (5.0, 1) +( 31, 93) -> (5.0, 1) +( 32, 0) -> (5.1, 0) +( 33, 17) -> (5.1, 0) +( 34, 19) -> (5.1, 0) +( 35, 21) -> (5.1, 0) +( 36, 23) -> (5.1, 0) +( 37, 39) -> (5.1, 0) +( 38, 44) -> (5.1, 0) +( 39, 46) -> (5.1, 0) +( 40, 98) -> (5.1, 1) +( 41, 27) -> (5.2, 0) +( 42, 28) -> (5.2, 0) +( 43, 32) -> (5.2, 0) +( 44, 59) -> (5.2, 1) +( 45, 48) -> (5.3, 0) +( 46, 5) -> (5.4, 0) +( 47, 10) -> (5.4, 0) +( 48, 16) -> (5.4, 0) +( 49, 20) -> (5.4, 0) +( 50, 31) -> (5.4, 0) +( 51, 84) -> (5.4, 1) +( 52, 33) -> (5.5, 0) +( 53, 36) -> (5.5, 0) +( 54, 53) -> (5.5, 1) +( 55, 80) -> (5.5, 1) +( 56, 81) -> (5.5, 1) +( 57, 89) -> (5.5, 1) +( 58, 90) -> (5.5, 1) +( 59, 64) -> (5.6, 1) +( 60, 66) -> (5.6, 1) +( 61, 69) -> (5.6, 1) +( 62, 88) -> (5.6, 1) +( 63, 94) -> (5.6, 1) +( 64, 121) -> (5.6, 2) +( 65, 15) -> (5.7, 0) +( 66, 18) -> (5.7, 0) +( 67, 55) -> (5.7, 1) +( 68, 79) -> (5.7, 1) +( 69, 95) -> (5.7, 1) +( 70, 96) -> (5.7, 1) +( 71, 99) -> (5.7, 1) +( 72, 113) -> (5.7, 2) +( 73, 14) -> (5.8, 0) +( 74, 67) -> (5.8, 1) +( 75, 82) -> (5.8, 1) +( 76, 92) -> (5.8, 1) +( 77, 101) -> (5.8, 2) +( 78, 114) -> (5.8, 2) +( 79, 142) -> (5.8, 2) +( 80, 61) -> (5.9, 1) +( 81, 70) -> (5.9, 1) +( 82, 149) -> (5.9, 2) +( 83, 62) -> (6.0, 1) +( 84, 78) -> (6.0, 1) +( 85, 83) -> (6.0, 1) +( 86, 85) -> (6.0, 1) +( 87, 119) -> (6.0, 2) +( 88, 138) -> (6.0, 2) +( 89, 63) -> (6.1, 1) +( 90, 71) -> (6.1, 1) +( 91, 73) -> (6.1, 1) +( 92, 91) -> (6.1, 1) +( 93, 127) -> (6.1, 2) +( 94, 134) -> (6.1, 2) +( 95, 68) -> (6.2, 1) +( 96, 97) -> (6.2, 1) +( 97, 126) -> (6.2, 2) +( 98, 148) -> (6.2, 2) +( 99, 56) -> (6.3, 1) +(100, 72) -> (6.3, 1) +(101, 87) -> (6.3, 1) +(102, 100) -> (6.3, 2) +(103, 103) -> (6.3, 2) +(104, 123) -> (6.3, 2) +(105, 133) -> (6.3, 2) +(106, 136) -> (6.3, 2) +(107, 146) -> (6.3, 2) +(108, 51) -> (6.4, 1) +(109, 74) -> (6.4, 1) +(110, 111) -> (6.4, 2) +(111, 115) -> (6.4, 2) +(112, 128) -> (6.4, 2) +(113, 132) -> (6.4, 2) +(114, 137) -> (6.4, 2) +(115, 54) -> (6.5, 1) +(116, 104) -> (6.5, 2) +(117, 110) -> (6.5, 2) +(118, 116) -> (6.5, 2) +(119, 147) -> (6.5, 2) +(120, 58) -> (6.6, 1) +(121, 75) -> (6.6, 1) +(122, 65) -> (6.7, 1) +(123, 77) -> (6.7, 1) +(124, 86) -> (6.7, 1) +(125, 108) -> (6.7, 2) +(126, 124) -> (6.7, 2) +(127, 140) -> (6.7, 2) +(128, 144) -> (6.7, 2) +(129, 145) -> (6.7, 2) +(130, 76) -> (6.8, 1) +(131, 112) -> (6.8, 2) +(132, 143) -> (6.8, 2) +(133, 52) -> (6.9, 1) +(134, 120) -> (6.9, 2) +(135, 139) -> (6.9, 2) +(136, 141) -> (6.9, 2) +(137, 50) -> (7.0, 1) +(138, 102) -> (7.1, 2) +(139, 109) -> (7.2, 2) +(140, 125) -> (7.2, 2) +(141, 129) -> (7.2, 2) +(142, 107) -> (7.3, 2) +(143, 130) -> (7.4, 2) +(144, 105) -> (7.6, 2) +(145, 117) -> (7.7, 2) +(146, 118) -> (7.7, 2) +(147, 122) -> (7.7, 2) +(148, 135) -> (7.7, 2) +(149, 131) -> (7.9, 2) ++++++++++++++++++++++++ \ No newline at end of file diff --git a/feature0_ant.txt b/feature0_ant.txt new file mode 100644 index 0000000..a1f74b8 --- /dev/null +++ b/feature0_ant.txt @@ -0,0 +1,25 @@ +Cut point: 4.95 //5 -> 0 yPrev= 2* (5, 4.9)=4.95idxPrev106 +Cut point: 5.05 //5.1 -> 0 yPrev= 1* (5.1, 5)=5.05idxPrev93 +Cut point: 5.15 //5.2 -> 0 yPrev= 1* (5.2, 5.1)=5.15idxPrev98 +Cut point: 5.25 //5.3 -> 0 yPrev= 1* (5.3, 5.2)=5.25idxPrev59 +Cut point: 5.45 //5.5 -> 0 yPrev= 1* (5.5, 5.4)=5.45idxPrev84 +Cut point: 5.65 //5.7 -> 0 yPrev= 2* (5.7, 5.6)=5.65idxPrev121 +Cut point: 5.75 //5.8 -> 0 yPrev= 2* (5.8, 5.7)=5.75idxPrev113 +Cut point: 5.85 //5.9 -> 1 yPrev= 2* (5.9, 5.8)=5.85idxPrev142 +Cut point: 5.95 //6 -> 1 yPrev= 2* (6, 5.9)=5.95idxPrev149 +Cut point: 6.05 //6.1 -> 1 yPrev= 2* (6.1, 6)=6.05idxPrev138 +Cut point: 6.15 //6.2 -> 1 yPrev= 2* (6.2, 6.1)=6.15idxPrev134 +Cut point: 6.25 //6.3 -> 1 yPrev= 2* (6.3, 6.2)=6.25idxPrev148 +Cut point: 6.35 //6.4 -> 1 yPrev= 2* (6.4, 6.3)=6.35idxPrev146 +Cut point: 6.45 //6.5 -> 1 yPrev= 2* (6.5, 6.4)=6.45idxPrev137 +Cut point: 6.55 //6.6 -> 1 yPrev= 2* (6.6, 6.5)=6.55idxPrev147 +Cut point: 6.75 //6.8 -> 1 yPrev= 2* (6.8, 6.7)=6.75idxPrev145 +Cut point: 6.85 //6.9 -> 1 yPrev= 2* (6.9, 6.8)=6.85idxPrev143 +Cut point: 6.95 //7 -> 1 yPrev= 2* (7, 6.9)=6.95idxPrev141 +Cut point: 7.05 //7.1 -> 2 yPrev= 1* (7.1, 7)=7.05idxPrev50 +[4.949999809265137, 5.050000190734863, 5.150000095367432, 5.25, 5.449999809265137, +5.650000095367432, 5.75, 5.850000858306885, 5.949999809265137, 6.050000190734863, +6.150000095367432, 6.25, 6.350000858306885, 6.449999809265137, 6.550000190734863, +6.75, 6.850000858306885, 6.949999809265137, 7.050000190734863] + +Cuts calculados en python: [4.85, 5.25, 5.35, 6.25, 6.55, 6.95, 7.05] \ No newline at end of file diff --git a/feature0_new.txt b/feature0_new.txt new file mode 100644 index 0000000..7675db2 --- /dev/null +++ b/feature0_new.txt @@ -0,0 +1,212 @@ +*idx=0 -> (-1, -1) Prev(4.3, 0) Elementos: 149 + Prev(4.3, 0) Pivot(4.3, 0) Cur(4.3, 0) +>idx=1 -> Prev(4.3, 0) Pivot(4.3, 0) Cur(4.4, 0) + Prev(4.3, 0) Pivot(4.4, 0) Cur(4.4, 0) +>idx=2 -> Prev(4.3, 0) Pivot(4.4, 0) Cur(4.4, 0) +>idx=3 -> Prev(4.3, 0) Pivot(4.4, 0) Cur(4.4, 0) +>idx=4 -> Prev(4.3, 0) Pivot(4.4, 0) Cur(4.5, 0) + Prev(4.4, 0) Pivot(4.5, 0) Cur(4.5, 0) +>idx=5 -> Prev(4.4, 0) Pivot(4.5, 0) Cur(4.6, 0) + Prev(4.5, 0) Pivot(4.6, 0) Cur(4.6, 0) +>idx=6 -> Prev(4.5, 0) Pivot(4.6, 0) Cur(4.6, 0) +>idx=7 -> Prev(4.5, 0) Pivot(4.6, 0) Cur(4.6, 0) +>idx=8 -> Prev(4.5, 0) Pivot(4.6, 0) Cur(4.6, 0) +>idx=9 -> Prev(4.5, 0) Pivot(4.6, 0) Cur(4.7, 0) + Prev(4.6, 0) Pivot(4.7, 0) Cur(4.7, 0) +>idx=10 -> Prev(4.6, 0) Pivot(4.7, 0) Cur(4.7, 0) +>idx=11 -> Prev(4.6, 0) Pivot(4.7, 0) Cur(4.8, 0) + Prev(4.7, 0) Pivot(4.8, 0) Cur(4.8, 0) +>idx=12 -> Prev(4.7, 0) Pivot(4.8, 0) Cur(4.8, 0) +>idx=13 -> Prev(4.7, 0) Pivot(4.8, 0) Cur(4.8, 0) +>idx=14 -> Prev(4.7, 0) Pivot(4.8, 0) Cur(4.8, 0) +>idx=15 -> Prev(4.7, 0) Pivot(4.8, 0) Cur(4.8, 0) +>idx=16 -> Prev(4.7, 0) Pivot(4.8, 0) Cur(4.9, 0) + Prev(4.8, 0) Pivot(4.9, 0) Cur(4.9, 0) +>idx=17 -> Prev(4.8, 0) Pivot(4.9, 0) Cur(4.9, 0) +>idx=18 -> Prev(4.8, 0) Pivot(4.9, 0) Cur(4.9, 0) +>idx=19 -> Prev(4.8, 0) Pivot(4.9, 0) Cur(4.9, 0) +>idx=20 -> Prev(4.8, 0) Pivot(4.9, -1) Cur(4.9, 1) +>idx=21 -> Prev(4.8, 0) Pivot(4.9, -1) Cur(4.9, 2) +>idx=22 -> Prev(4.8, 0) Pivot(4.9, -1) Cur(5.0, 0) +Cutpoint idx=22 Cur(5.0, 0) Prev(4.8, 0) Pivot(4.9, -1) = 4.9 + Prev(4.9, -1) Pivot(5.0, 0) Cur(5.0, 0) +>idx=23 -> Prev(4.9, -1) Pivot(5.0, 0) Cur(5.0, 0) +>idx=24 -> Prev(4.9, -1) Pivot(5.0, 0) Cur(5.0, 0) +>idx=25 -> Prev(4.9, -1) Pivot(5.0, 0) Cur(5.0, 0) +>idx=26 -> Prev(4.9, -1) Pivot(5.0, 0) Cur(5.0, 0) +>idx=27 -> Prev(4.9, -1) Pivot(5.0, 0) Cur(5.0, 0) +>idx=28 -> Prev(4.9, -1) Pivot(5.0, 0) Cur(5.0, 0) +>idx=29 -> Prev(4.9, -1) Pivot(5.0, 0) Cur(5.0, 0) +>idx=30 -> Prev(4.9, -1) Pivot(5.0, -1) Cur(5.0, 1) +>idx=31 -> Prev(4.9, -1) Pivot(5.0, -1) Cur(5.0, 1) +>idx=32 -> Prev(4.9, -1) Pivot(5.0, -1) Cur(5.1, 0) +Cutpoint idx=32 Cur(5.1, 0) Prev(4.9, -1) Pivot(5.0, -1) = 5.0 + Prev(5.0, -1) Pivot(5.1, 0) Cur(5.1, 0) +>idx=33 -> Prev(5.0, -1) Pivot(5.1, 0) Cur(5.1, 0) +>idx=34 -> Prev(5.0, -1) Pivot(5.1, 0) Cur(5.1, 0) +>idx=35 -> Prev(5.0, -1) Pivot(5.1, 0) Cur(5.1, 0) +>idx=36 -> Prev(5.0, -1) Pivot(5.1, 0) Cur(5.1, 0) +>idx=37 -> Prev(5.0, -1) Pivot(5.1, 0) Cur(5.1, 0) +>idx=38 -> Prev(5.0, -1) Pivot(5.1, 0) Cur(5.1, 0) +>idx=39 -> Prev(5.0, -1) Pivot(5.1, 0) Cur(5.1, 0) +>idx=40 -> Prev(5.0, -1) Pivot(5.1, -1) Cur(5.1, 1) +>idx=41 -> Prev(5.0, -1) Pivot(5.1, -1) Cur(5.2, 0) +Cutpoint idx=41 Cur(5.2, 0) Prev(5.0, -1) Pivot(5.1, -1) = 5.1 + Prev(5.1, -1) Pivot(5.2, 0) Cur(5.2, 0) +>idx=42 -> Prev(5.1, -1) Pivot(5.2, 0) Cur(5.2, 0) +>idx=43 -> Prev(5.1, -1) Pivot(5.2, 0) Cur(5.2, 0) +>idx=44 -> Prev(5.1, -1) Pivot(5.2, -1) Cur(5.2, 1) +>idx=45 -> Prev(5.1, -1) Pivot(5.2, -1) Cur(5.3, 0) +Cutpoint idx=45 Cur(5.3, 0) Prev(5.1, -1) Pivot(5.2, -1) = 5.2 + Prev(5.2, -1) Pivot(5.3, 0) Cur(5.3, 0) +>idx=46 -> Prev(5.2, -1) Pivot(5.3, 0) Cur(5.4, 0) +Cutpoint idx=46 Cur(5.4, 0) Prev(5.2, -1) Pivot(5.3, 0) = 5.3 + Prev(5.3, 0) Pivot(5.4, 0) Cur(5.4, 0) +>idx=47 -> Prev(5.3, 0) Pivot(5.4, 0) Cur(5.4, 0) +>idx=48 -> Prev(5.3, 0) Pivot(5.4, 0) Cur(5.4, 0) +>idx=49 -> Prev(5.3, 0) Pivot(5.4, 0) Cur(5.4, 0) +>idx=50 -> Prev(5.3, 0) Pivot(5.4, 0) Cur(5.4, 0) +>idx=51 -> Prev(5.3, 0) Pivot(5.4, -1) Cur(5.4, 1) +>idx=52 -> Prev(5.3, 0) Pivot(5.4, -1) Cur(5.5, 0) +Cutpoint idx=52 Cur(5.5, 0) Prev(5.3, 0) Pivot(5.4, -1) = 5.4 + Prev(5.4, -1) Pivot(5.5, 0) Cur(5.5, 0) +>idx=53 -> Prev(5.4, -1) Pivot(5.5, 0) Cur(5.5, 0) +>idx=54 -> Prev(5.4, -1) Pivot(5.5, -1) Cur(5.5, 1) +>idx=55 -> Prev(5.4, -1) Pivot(5.5, -1) Cur(5.5, 1) +>idx=56 -> Prev(5.4, -1) Pivot(5.5, -1) Cur(5.5, 1) +>idx=57 -> Prev(5.4, -1) Pivot(5.5, -1) Cur(5.5, 1) +>idx=58 -> Prev(5.4, -1) Pivot(5.5, -1) Cur(5.5, 1) +>idx=59 -> Prev(5.4, -1) Pivot(5.5, -1) Cur(5.6, 1) +Cutpoint idx=59 Cur(5.6, 1) Prev(5.4, -1) Pivot(5.5, -1) = 5.5 + Prev(5.5, -1) Pivot(5.6, 1) Cur(5.6, 1) +>idx=60 -> Prev(5.5, -1) Pivot(5.6, 1) Cur(5.6, 1) +>idx=61 -> Prev(5.5, -1) Pivot(5.6, 1) Cur(5.6, 1) +>idx=62 -> Prev(5.5, -1) Pivot(5.6, 1) Cur(5.6, 1) +>idx=63 -> Prev(5.5, -1) Pivot(5.6, 1) Cur(5.6, 1) +>idx=64 -> Prev(5.5, -1) Pivot(5.6, -1) Cur(5.6, 2) +>idx=65 -> Prev(5.5, -1) Pivot(5.6, -1) Cur(5.7, 0) +Cutpoint idx=65 Cur(5.7, 0) Prev(5.5, -1) Pivot(5.6, -1) = 5.6 + Prev(5.6, -1) Pivot(5.7, 0) Cur(5.7, 0) +>idx=66 -> Prev(5.6, -1) Pivot(5.7, 0) Cur(5.7, 0) +>idx=67 -> Prev(5.6, -1) Pivot(5.7, -1) Cur(5.7, 1) +>idx=68 -> Prev(5.6, -1) Pivot(5.7, -1) Cur(5.7, 1) +>idx=69 -> Prev(5.6, -1) Pivot(5.7, -1) Cur(5.7, 1) +>idx=70 -> Prev(5.6, -1) Pivot(5.7, -1) Cur(5.7, 1) +>idx=71 -> Prev(5.6, -1) Pivot(5.7, -1) Cur(5.7, 1) +>idx=72 -> Prev(5.6, -1) Pivot(5.7, -1) Cur(5.7, 2) +>idx=73 -> Prev(5.6, -1) Pivot(5.7, -1) Cur(5.8, 0) +Cutpoint idx=73 Cur(5.8, 0) Prev(5.6, -1) Pivot(5.7, -1) = 5.7 + Prev(5.7, -1) Pivot(5.8, 0) Cur(5.8, 0) +>idx=74 -> Prev(5.7, -1) Pivot(5.8, -1) Cur(5.8, 1) +>idx=75 -> Prev(5.7, -1) Pivot(5.8, -1) Cur(5.8, 1) +>idx=76 -> Prev(5.7, -1) Pivot(5.8, -1) Cur(5.8, 1) +>idx=77 -> Prev(5.7, -1) Pivot(5.8, -1) Cur(5.8, 2) +>idx=78 -> Prev(5.7, -1) Pivot(5.8, -1) Cur(5.8, 2) +>idx=79 -> Prev(5.7, -1) Pivot(5.8, -1) Cur(5.8, 2) +>idx=80 -> Prev(5.7, -1) Pivot(5.8, -1) Cur(5.9, 1) +Cutpoint idx=80 Cur(5.9, 1) Prev(5.7, -1) Pivot(5.8, -1) = 5.8 + Prev(5.8, -1) Pivot(5.9, 1) Cur(5.9, 1) +>idx=81 -> Prev(5.8, -1) Pivot(5.9, 1) Cur(5.9, 1) +>idx=82 -> Prev(5.8, -1) Pivot(5.9, -1) Cur(5.9, 2) +>idx=83 -> Prev(5.8, -1) Pivot(5.9, -1) Cur(6.0, 1) +Cutpoint idx=83 Cur(6.0, 1) Prev(5.8, -1) Pivot(5.9, -1) = 5.9 + Prev(5.9, -1) Pivot(6.0, 1) Cur(6.0, 1) +>idx=84 -> Prev(5.9, -1) Pivot(6.0, 1) Cur(6.0, 1) +>idx=85 -> Prev(5.9, -1) Pivot(6.0, 1) Cur(6.0, 1) +>idx=86 -> Prev(5.9, -1) Pivot(6.0, 1) Cur(6.0, 1) +>idx=87 -> Prev(5.9, -1) Pivot(6.0, -1) Cur(6.0, 2) +>idx=88 -> Prev(5.9, -1) Pivot(6.0, -1) Cur(6.0, 2) +>idx=89 -> Prev(5.9, -1) Pivot(6.0, -1) Cur(6.1, 1) +Cutpoint idx=89 Cur(6.1, 1) Prev(5.9, -1) Pivot(6.0, -1) = 6.0 + Prev(6.0, -1) Pivot(6.1, 1) Cur(6.1, 1) +>idx=90 -> Prev(6.0, -1) Pivot(6.1, 1) Cur(6.1, 1) +>idx=91 -> Prev(6.0, -1) Pivot(6.1, 1) Cur(6.1, 1) +>idx=92 -> Prev(6.0, -1) Pivot(6.1, 1) Cur(6.1, 1) +>idx=93 -> Prev(6.0, -1) Pivot(6.1, -1) Cur(6.1, 2) +>idx=94 -> Prev(6.0, -1) Pivot(6.1, -1) Cur(6.1, 2) +>idx=95 -> Prev(6.0, -1) Pivot(6.1, -1) Cur(6.2, 1) +Cutpoint idx=95 Cur(6.2, 1) Prev(6.0, -1) Pivot(6.1, -1) = 6.1 + Prev(6.1, -1) Pivot(6.2, 1) Cur(6.2, 1) +>idx=96 -> Prev(6.1, -1) Pivot(6.2, 1) Cur(6.2, 1) +>idx=97 -> Prev(6.1, -1) Pivot(6.2, -1) Cur(6.2, 2) +>idx=98 -> Prev(6.1, -1) Pivot(6.2, -1) Cur(6.2, 2) +>idx=99 -> Prev(6.1, -1) Pivot(6.2, -1) Cur(6.3, 1) +Cutpoint idx=99 Cur(6.3, 1) Prev(6.1, -1) Pivot(6.2, -1) = 6.2 + Prev(6.2, -1) Pivot(6.3, 1) Cur(6.3, 1) +>idx=100 -> Prev(6.2, -1) Pivot(6.3, 1) Cur(6.3, 1) +>idx=101 -> Prev(6.2, -1) Pivot(6.3, 1) Cur(6.3, 1) +>idx=102 -> Prev(6.2, -1) Pivot(6.3, -1) Cur(6.3, 2) +>idx=103 -> Prev(6.2, -1) Pivot(6.3, -1) Cur(6.3, 2) +>idx=104 -> Prev(6.2, -1) Pivot(6.3, -1) Cur(6.3, 2) +>idx=105 -> Prev(6.2, -1) Pivot(6.3, -1) Cur(6.3, 2) +>idx=106 -> Prev(6.2, -1) Pivot(6.3, -1) Cur(6.3, 2) +>idx=107 -> Prev(6.2, -1) Pivot(6.3, -1) Cur(6.3, 2) +>idx=108 -> Prev(6.2, -1) Pivot(6.3, -1) Cur(6.4, 1) +Cutpoint idx=108 Cur(6.4, 1) Prev(6.2, -1) Pivot(6.3, -1) = 6.3 + Prev(6.3, -1) Pivot(6.4, 1) Cur(6.4, 1) +>idx=109 -> Prev(6.3, -1) Pivot(6.4, 1) Cur(6.4, 1) +>idx=110 -> Prev(6.3, -1) Pivot(6.4, -1) Cur(6.4, 2) +>idx=111 -> Prev(6.3, -1) Pivot(6.4, -1) Cur(6.4, 2) +>idx=112 -> Prev(6.3, -1) Pivot(6.4, -1) Cur(6.4, 2) +>idx=113 -> Prev(6.3, -1) Pivot(6.4, -1) Cur(6.4, 2) +>idx=114 -> Prev(6.3, -1) Pivot(6.4, -1) Cur(6.4, 2) +>idx=115 -> Prev(6.3, -1) Pivot(6.4, -1) Cur(6.5, 1) +Cutpoint idx=115 Cur(6.5, 1) Prev(6.3, -1) Pivot(6.4, -1) = 6.4 + Prev(6.4, -1) Pivot(6.5, 1) Cur(6.5, 1) +>idx=116 -> Prev(6.4, -1) Pivot(6.5, -1) Cur(6.5, 2) +>idx=117 -> Prev(6.4, -1) Pivot(6.5, -1) Cur(6.5, 2) +>idx=118 -> Prev(6.4, -1) Pivot(6.5, -1) Cur(6.5, 2) +>idx=119 -> Prev(6.4, -1) Pivot(6.5, -1) Cur(6.5, 2) +>idx=120 -> Prev(6.4, -1) Pivot(6.5, -1) Cur(6.6, 1) +Cutpoint idx=120 Cur(6.6, 1) Prev(6.4, -1) Pivot(6.5, -1) = 6.5 + Prev(6.5, -1) Pivot(6.6, 1) Cur(6.6, 1) +>idx=121 -> Prev(6.5, -1) Pivot(6.6, 1) Cur(6.6, 1) +>idx=122 -> Prev(6.5, -1) Pivot(6.6, 1) Cur(6.7, 1) +Cutpoint idx=122 Cur(6.7, 1) Prev(6.5, -1) Pivot(6.6, 1) = 6.6 + Prev(6.6, 1) Pivot(6.7, 1) Cur(6.7, 1) +>idx=123 -> Prev(6.6, 1) Pivot(6.7, 1) Cur(6.7, 1) +>idx=124 -> Prev(6.6, 1) Pivot(6.7, 1) Cur(6.7, 1) +>idx=125 -> Prev(6.6, 1) Pivot(6.7, -1) Cur(6.7, 2) +>idx=126 -> Prev(6.6, 1) Pivot(6.7, -1) Cur(6.7, 2) +>idx=127 -> Prev(6.6, 1) Pivot(6.7, -1) Cur(6.7, 2) +>idx=128 -> Prev(6.6, 1) Pivot(6.7, -1) Cur(6.7, 2) +>idx=129 -> Prev(6.6, 1) Pivot(6.7, -1) Cur(6.7, 2) +>idx=130 -> Prev(6.6, 1) Pivot(6.7, -1) Cur(6.8, 1) +Cutpoint idx=130 Cur(6.8, 1) Prev(6.6, 1) Pivot(6.7, -1) = 6.7 + Prev(6.7, -1) Pivot(6.8, 1) Cur(6.8, 1) +>idx=131 -> Prev(6.7, -1) Pivot(6.8, -1) Cur(6.8, 2) +>idx=132 -> Prev(6.7, -1) Pivot(6.8, -1) Cur(6.8, 2) +>idx=133 -> Prev(6.7, -1) Pivot(6.8, -1) Cur(6.9, 1) +Cutpoint idx=133 Cur(6.9, 1) Prev(6.7, -1) Pivot(6.8, -1) = 6.8 + Prev(6.8, -1) Pivot(6.9, 1) Cur(6.9, 1) +>idx=134 -> Prev(6.8, -1) Pivot(6.9, -1) Cur(6.9, 2) +>idx=135 -> Prev(6.8, -1) Pivot(6.9, -1) Cur(6.9, 2) +>idx=136 -> Prev(6.8, -1) Pivot(6.9, -1) Cur(6.9, 2) +>idx=137 -> Prev(6.8, -1) Pivot(6.9, -1) Cur(7.0, 1) +Cutpoint idx=137 Cur(7.0, 1) Prev(6.8, -1) Pivot(6.9, -1) = 6.9 + Prev(6.9, -1) Pivot(7.0, 1) Cur(7.0, 1) +>idx=138 -> Prev(6.9, -1) Pivot(7.0, 1) Cur(7.1, 2) +Cutpoint idx=138 Cur(7.1, 2) Prev(6.9, -1) Pivot(7.0, 1) = 7.0 + Prev(7.0, 1) Pivot(7.1, 2) Cur(7.1, 2) +>idx=139 -> Prev(7.0, 1) Pivot(7.1, 2) Cur(7.2, 2) +Cutpoint idx=139 Cur(7.2, 2) Prev(7.0, 1) Pivot(7.1, 2) = 7.1 + Prev(7.1, 2) Pivot(7.2, 2) Cur(7.2, 2) +>idx=140 -> Prev(7.1, 2) Pivot(7.2, 2) Cur(7.2, 2) +>idx=141 -> Prev(7.1, 2) Pivot(7.2, 2) Cur(7.2, 2) +>idx=142 -> Prev(7.1, 2) Pivot(7.2, 2) Cur(7.3, 2) + Prev(7.2, 2) Pivot(7.3, 2) Cur(7.3, 2) +>idx=143 -> Prev(7.2, 2) Pivot(7.3, 2) Cur(7.4, 2) + Prev(7.3, 2) Pivot(7.4, 2) Cur(7.4, 2) +>idx=144 -> Prev(7.3, 2) Pivot(7.4, 2) Cur(7.6, 2) + Prev(7.4, 2) Pivot(7.6, 2) Cur(7.6, 2) +>idx=145 -> Prev(7.4, 2) Pivot(7.6, 2) Cur(7.7, 2) + Prev(7.6, 2) Pivot(7.7, 2) Cur(7.7, 2) +>idx=146 -> Prev(7.6, 2) Pivot(7.7, 2) Cur(7.7, 2) +>idx=147 -> Prev(7.6, 2) Pivot(7.7, 2) Cur(7.7, 2) +>idx=148 -> Prev(7.6, 2) Pivot(7.7, 2) Cur(7.7, 2) +>idx=149 -> Prev(7.6, 2) Pivot(7.7, 2) Cur(7.9, 2) +[4.900000095367432, 5.0, 5.099999904632568, 5.199999809265137, 5.300000190734863, +5.400000095367432, 5.5, 5.599999904632568, 5.699999809265137, 5.800000190734863, +5.900000095367432, 6.0, 6.099999904632568, 6.199999809265137, 6.300000190734863, +6.400000095367432, 6.5, 6.599999904632568, 6.699999809265137, 6.800000190734863, +6.900000095367432, 7.0, 7.099999904632568] \ No newline at end of file diff --git a/fimdlp/CPPFImdlp.cpp b/fimdlp/CPPFImdlp.cpp index 08f9cc9..96debe1 100644 --- a/fimdlp/CPPFImdlp.cpp +++ b/fimdlp/CPPFImdlp.cpp @@ -1,11 +1,17 @@ #include "CPPFImdlp.h" #include #include +#include #include #include #include "Metrics.h" namespace CPPFImdlp { + std::ostream &operator<<(std::ostream &os, const CutPointBody &cut) + { + os << "(" << cut.start << ", " << cut.end << ") -> (" << cut.fromValue << ", " << cut.toValue << "]"; + return os; + } CPPFImdlp::CPPFImdlp() : debug(false), precision(6) { divider = pow(10, precision); @@ -17,33 +23,52 @@ namespace CPPFImdlp CPPFImdlp::~CPPFImdlp() { } - std::vector CPPFImdlp::cutPoints(std::vector &X, std::vector &y) + void CPPFImdlp::debugPoints(std::vector &X, std::vector &y) { - std::vector cutPts; - std::vector cutIdx; - float xPrev, xCur, xPivot, cutPoint; - int yPrev, yCur, yPivot; - size_t idxPrev, idx, numElements; + std::cout << "+++++++++++++++++++++++" << std::endl; + // for (auto i : sortIndices(X)) std::vector indices = sortIndices(X); - xCur = xPrev = X.at(indices.at(0)); - yCur = yPrev = y.at(indices.at(0)); + for (size_t i = 0; i < indices.size(); i++) + { + printf("(%3lu, %3lu) -> (%3.1f, %d)\n", i, indices[i], X[indices[i]], y[indices[i]]); + } + std::cout << "+++++++++++++++++++++++" << std::endl; + for (auto item : cutPoints(X, y)) + { + std::cout << item << " X[" << item.end << "]=" << X[item.end] << std::endl; + } + } + std::vector CPPFImdlp::cutPoints(std::vector &X, std::vector &y) + { + + std::vector cutPts; + CutPointBody cutPoint; + std::vector cutIdx; + float xPrev, xCur, xPivot; + int yPrev, yCur, yPivot; + size_t idxPrev, idxPivot, idx, numElements, start; + std::vector indices = sortIndices(X); + xCur = xPrev = X[indices[0]]; + yCur = yPrev = y[indices[0]]; numElements = indices.size() - 1; - // idxPrev = indices.at(0); - idx = 0; + idxPrev = indices[0]; + idx = start = 0; + bool firstCutPoint = true; if (debug) printf("*idx=%lu -> (-1, -1) Prev(%3.1f, %d) Elementos: %lu\n", idx, xCur, yCur, numElements); while (idx < numElements) { xPivot = xCur; yPivot = yCur; + idxPivot = indices[idx]; if (debug) printf(" Prev(%3.1f, %d) Pivot(%3.1f, %d) Cur(%3.1f, %d) \n", idx, xPrev, yPrev, xPivot, yPivot, xCur, yCur); // Read the same values and check class changes do { idx++; - xCur = X.at(indices.at(idx)); - yCur = y.at(indices.at(idx)); + xCur = X[indices[idx]]; + yCur = y[indices[idx]]; if (yCur != yPivot && xCur == xPivot) { yPivot = -1; @@ -53,15 +78,33 @@ namespace CPPFImdlp } while (idx < numElements && xCur == xPivot); if (yPivot == -1 || yPrev != yCur) { - cutPoint = (xPrev + xCur) / 2; + cutPoint.start = start; + cutPoint.end = idxPrev; + start = idx; + cutPoint.fromValue = firstCutPoint ? std::numeric_limits::lowest() : cutPts.back().toValue; + cutPoint.toValue = (xPrev + xCur) / 2; + firstCutPoint = false; if (debug) - printf("Cutpoint idx=%lu Cur(%3.1f, %d) Prev(%3.1f, %d) Pivot(%3.1f, %d) = %3.1f \n", idx, xCur, yCur, xPrev, yPrev, xPivot, yPivot, cutPoint); + { + printf("Cutpoint idx=%lu Cur(%3.1f, %d) Prev(%3.1f, %d) Pivot(%3.1f, %d) = (%3.1g, %3.1g] \n", idx, xCur, yCur, xPrev, yPrev, xPivot, yPivot, cutPoint.fromValue, cutPoint.toValue); + } cutPts.push_back(cutPoint); - // cutIdx.push_back(idxPrev); + cutIdx.push_back(idxPrev); } yPrev = yPivot; xPrev = xPivot; - // idxPrev = indices.at(idxPivot); + idxPrev = indices[idxPivot]; + } + if (idxPrev >= numElements) + { + cutPoint.start = start; + cutPoint.end = numElements; + cutPoint.fromValue = firstCutPoint ? std::numeric_limits::lowest() : cutPts.back().toValue; + cutPoint.toValue = std::numeric_limits::max(); + if (debug) + printf("Final Cutpoint idx=%lu Cur(%3.1f, %d) Prev(%3.1f, %d) Pivot(%3.1f, %d) = (%3.1g, %3.1g] \n", idx, xCur, yCur, xPrev, yPrev, xPivot, yPivot, cutPoint.fromValue, cutPoint.toValue); + cutPts.push_back(cutPoint); + cutIdx.push_back(idxPrev); } return cutPts; } diff --git a/fimdlp/CPPFImdlp.h b/fimdlp/CPPFImdlp.h index 413779e..baf5f9a 100644 --- a/fimdlp/CPPFImdlp.h +++ b/fimdlp/CPPFImdlp.h @@ -4,6 +4,11 @@ #include namespace CPPFImdlp { + struct CutPointBody + { + size_t start, end; + float fromValue, toValue; + }; class CPPFImdlp { private: @@ -17,8 +22,9 @@ namespace CPPFImdlp CPPFImdlp(); CPPFImdlp(int, bool debug = false); ~CPPFImdlp(); - std::vector cutPoints(std::vector &, std::vector &); + std::vector cutPoints(std::vector &, std::vector &); std::vector cutPointsAnt(std::vector &, std::vector &); + void debugPoints(std::vector &, std::vector &); }; } #endif \ No newline at end of file diff --git a/fimdlp/Metrics.h b/fimdlp/Metrics.h index c487cc9..3c8f2a8 100644 --- a/fimdlp/Metrics.h +++ b/fimdlp/Metrics.h @@ -1,6 +1,7 @@ #ifndef METRICS_H #define METRICS_H #include +#include namespace CPPFImdlp { class Metrics diff --git a/fimdlp/cfimdlp.pyx b/fimdlp/cfimdlp.pyx index 34fc88c..84d136e 100644 --- a/fimdlp/cfimdlp.pyx +++ b/fimdlp/cfimdlp.pyx @@ -7,8 +7,9 @@ cdef extern from "CPPFImdlp.h" namespace "CPPFImdlp": cdef cppclass CPPFImdlp: CPPFImdlp() except + CPPFImdlp(int, bool) except + - vector[float] cutPoints(vector[float]&, vector[int]&) vector[float] cutPointsAnt(vector[float]&, vector[int]&) + void debugPoints(vector[float]&, vector[int]&) + cdef class CFImdlp: cdef CPPFImdlp *thisptr @@ -16,7 +17,7 @@ cdef class CFImdlp: self.thisptr = new CPPFImdlp(precision, debug) def __dealloc__(self): del self.thisptr - def cut_points(self, X, y): - return self.thisptr.cutPoints(X, y) def cut_points_ant(self, X, y): return self.thisptr.cutPointsAnt(X, y) + def debug_points(self, X, y): + return self.thisptr.debugPoints(X, y) diff --git a/fimdlp/cppfimdlp.cpython-310-darwin.so b/fimdlp/cppfimdlp.cpython-310-darwin.so new file mode 100755 index 0000000..c3d0d83 Binary files /dev/null and b/fimdlp/cppfimdlp.cpython-310-darwin.so differ diff --git a/fimdlp/mdlp.py b/fimdlp/mdlp.py index 70ac5fb..12eb272 100644 --- a/fimdlp/mdlp.py +++ b/fimdlp/mdlp.py @@ -105,8 +105,10 @@ class FImdlp(TransformerMixin, BaseEstimator): print("Cuts calculados en C++") print("Cut points for each feature in Iris dataset:") for i in range(0, self.n_features_): - datax = self.X_[np.argsort(self.X_[:, i]), i] - y_ = self.y_[np.argsort(self.X_[:, i])] + # datax = self.X_[np.argsort(self.X_[:, i]), i] + # y_ = self.y_[np.argsort(self.X_[:, i])] + datax = self.X_[:, i] + y_ = self.y_ Xcutpoints = self.discretizer_.cut_points(datax, y_) print( f"New ({len(Xcutpoints)}):{self.features_[i]:20s}: " diff --git a/sample.py b/sample.py index e13031d..d19dfa3 100644 --- a/sample.py +++ b/sample.py @@ -8,7 +8,15 @@ X = data.data y = data.target features = data.feature_names test = FImdlp() -test.fit(X, y, features=features).transform(X) +test.fit(X, y, features=features) +# test.transform(X) + +test = CFImdlp(debug=False) +# k = test.cut_points(X[:, 0], y) +# print(k) +# k = test.cut_points_ant(X[:, 0], y) +# print(k) +test.debug_points(X[:, 0], y) # X = np.array( # [