Changeset 15 for trunk/CrossPare/src/de/ugoe/cs/cpdp
- Timestamp:
- 08/31/14 19:31:50 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CrossPare/src/de/ugoe/cs/cpdp/training/WekaLocalTraining2.java
r14 r15 53 53 private static Fastmap FMAP; 54 54 private static EuclideanDistance DIST; 55 private static Instances TRAIN; 55 56 56 57 // cluster … … 134 135 Instance clusterInstance = createInstance(traindata, instance); 135 136 136 // build temp dist matrix 137 double[][] distmat = new double[3][3]; 138 137 // build temp dist matrix (2 Pivot per dimension + 1 instance we want to classify) 138 double[][] distmat = new double[2*FMAP.target_dims+1][2*FMAP.target_dims+1]; 139 140 // vector of instances of pivots + 1 (for the instance we want to classify) 141 int[] tmp = new int[FMAP.PA.length+1]; 142 143 Instance tmpi; 144 Instance tmpj; 145 for(int i=0; i < tmp.length; i++) { 146 for(int j=0; j < tmp.length; j++) { 147 if(i==0) { 148 tmpi = instance; 149 }else{ 150 tmpi = TRAIN.get(i); 151 } 152 153 if(j == 0) { 154 tmpj = instance; 155 }else { 156 tmpj = TRAIN.get(j); 157 } 158 159 distmat[i][j] = DIST.distance(tmpi, tmpj); 160 } 161 } 162 163 // this is the projection vector for our instance 164 double[] proj = FMAP.addInstance(distmat); 165 166 167 // jetzt suchen wir den cluster in dem wir uns befinden mit den 2 projektionen 139 168 140 169 141 170 // get distance of this instance to every other instance 142 171 // if the distance is minimal apply the classifier of the current cluster 172 173 int cnumber; 174 Iterator<Integer> clusternumber = ctraindata.keySet().iterator(); 175 while ( clusternumber.hasNext() ) { 176 cnumber = clusternumber.next(); 177 178 for(int i=0; i < ctraindata.get(cnumber).size(); i++) { 179 } 180 } 181 143 182 144 183 /* … … 190 229 //train = Filter.useFilter(train, filter); 191 230 192 231 TRAIN = train; 193 232 // 3. calculate distance matrix (needed for Fastmap because it starts at dimension 1) 194 233 DIST = new EuclideanDistance(train); … … 843 882 } 844 883 884 885 /** 886 * todo 887 */ 888 public boolean isInside(double x, double y) { 889 boolean is_inside_x = false; 890 boolean is_inside_y = false; 891 double[][] our_size = this.getSize(); 892 893 894 if(our_size[0][0] <= x && our_size[0][1] >= x) { 895 is_inside_x = true; 896 } 897 898 if(our_size[1][0] <= y && our_size[1][1] >= y) { 899 is_inside_y = true; 900 } 901 902 903 if(is_inside_y && is_inside_x && this.verbose) { 904 System.out.println(this + " contains: " + x + ", "+ y); 905 } 906 907 return is_inside_x && is_inside_y; 908 } 909 910 845 911 /** 846 912 * Perform Pruning and clustering of the quadtree
Note: See TracChangeset
for help on using the changeset viewer.