程式語言
This presentation is the property of its rightful owner.
Sponsored Links
1 / 23

程式語言 PowerPoint PPT Presentation


  • 134 Views
  • Uploaded on
  • Presentation posted in: General

程式語言. Subtractive Clustering. Repeat while any point ( x i ) is left to be assigned to a cluster Use Eq. (1) to get the potential of x i Find the point with the highest potential and choose it as the kth cluster center

Download Presentation

程式語言

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


5560554

程式語言


Subtractive clustering

Subtractive Clustering

  • Repeat while any point (xi) is left to be assigned to a cluster

    • Use Eq. (1) to get the potential of xi

    • Find the point with the highest potential and choose it as the kth cluster center

    • Form the kth cluster by assigning N points closest to the centroid (Euclidean distance)

    • Remove the chosen N points

(1)

2


Create random data

Create Random Data

  • $mean_x[1] = 1;$sdev_x[1] = 0.1;$mean_x[2] = -1;$sdev_x[2] = 0.15;$mean_x[3] = 1;$sdev_x[3] = 0.1;$mean_x[4] = -1;$sdev_x[4] = 0.15;$mean_y[1] = 1;$sdev_y[1] = 0.1;$mean_y[2] = 1;$sdev_y[2] = 0.15;$mean_y[3] = -1;$sdev_y[3] = 0.1;$mean_y[4] = -1;$sdev_y[4] = 0.15;


Create random data1

Create Random Data

  • @[email protected]=();open OUTFILE, ">xy.txt" or die "Cannot open gene_list.txt!\n ($!)";for ($i=1;$i<=4;$i++){for ($j=1;$j<=80;$j++) {$x_tmp = gaussian_rand() * $sdev_x[$i] + $mean_x[$i];$y_tmp = gaussian_rand() * $sdev_y[$i] + $mean_y[$i]; printf(OUTFILE "%.2f \t %.2f \n", $x_tmp, $y_tmp); }}


Create random data2

Create Random Data

  • for ($j=1;$j<=20;$j++){$x_tmp = rand(2);$y_tmp = rand(2); printf(OUTFILE "%.2f \t %.2f \n", $x_tmp, $y_tmp);}


Random data graph

Random Data Graph


Subtractive clustering1

Subtractive Clustering

  • Repeat while any point (xi) is left to be assigned to a cluster

    • Use Eq. (1) to get the potential of xi

    • Find the point with the highest potential and choose it as the kth cluster center

    • Form the kth cluster by assigning N points closest to the centroid (Euclidean distance)

    • Remove the chosen N points

(1)

7


Center

Center

  • open (FILE1,“xy.txt”) || die “open error!” ; #FILE1¬Oradom dateopen FILE2, “>aixes.txt”or die “Cannot open gene_list.txt!\n ($!)”;@aa = <FILE1>;chomp (@aa);[email protected]_one和y_one載random date的x,y

  • for ($z=0; $z<=$#aa; $z++){ $bb = $aa[$z]; $bb =~ /(\S+)\s+(\S+)/; @x_one[$z] =$1; @y_one[$z] =$2;}


Center1

Center

#計算出每點與各點的potient, [email protected]

  • while ($n <4){ @sum = 0, $bb = 0 ;for ($i=0; $i<=$#x_one ;$i++) {for ($j=1; $j<=$#x_one; $j++) { $bb = exp ( -(($x_one[$i]-$x_one[$j])**2 + ($y_one[$i] - $y_one[$j])**2 ));

    @sum[$i] += $bb; } }


Subtractive clustering2

Subtractive Clustering

  • Repeat while any point (xi) is left to be assigned to a cluster

    • Use Eq. (1) to get the potential of xi

    • Find the point with the highest potential and choose it as the kth cluster center

    • Form the kth cluster by assigning N points closest to the centroid (Euclidean distance)

    • Remove the chosen N points

(1)

10


Subtractive clustering3

Subtractive Clustering

  • Repeat while any point (xi) is left to be assigned to a cluster

    • Use Eq. (1) to get the potential of xi

    • Find the point with the highest potential and choose it as the kth cluster center

    • Form the kth cluster by assigning N points closest to the centroid (Euclidean distance)

    • Remove the chosen N points

(1)

11


Center2

Center

比較各點的potient, 找出最高值為cluster center $mix = $sum[0], $num = 0;for($k=1; $k<=$#x_one ; $k++){if ( $sum[$k] > $mix ) { $mix = $sum[$k]; $num = $k ; }} print $x_one[$num]." , ".$y_one[$num]."\n";

printf(FILE2 "%s : %.2f , %.2f %s \n","cluster center", $x_one[$num], $y_one[$num], $m);


5560554

  • Find cluster center!


Subtractive clustering4

Subtractive Clustering

  • Repeat while any point (xi) is left to be assigned to a cluster

    • Use Eq. (1) to get the potential of xi

    • Find the point with the highest potential and choose it as the kth cluster center

    • Form the kth cluster by assigning N points closest to the centroid (Euclidean distance)

    • Remove the chosen N points

(1)

14


Subtractive clustering5

Subtractive Clustering

  • Repeat while any point (xi) is left to be assigned to a cluster

    • Use Eq. (1) to get the potential of xi

    • Find the point with the highest potential and choose it as the kth cluster center

    • Form the kth cluster by assigning N points closest to the centroid (Euclidean distance)

    • Remove the chosen N points

(1)

15


Center3

Center

  • [email protected]

    @dis =();for ($c=0; $c<$#x_one;$c++) {

    if ($c != $num) {$dis[$c] = ( ($x_one[$num] - $x_one[$c])**2 + ($y_one[$num] - $y_one[$c])**2 )**0.5 ;

    }

    }


Center4

center

  • [email protected] @sort = (); @sort = sort {$a <=> $b} @dis ;


Center5

center

  • 把cluster center附近的點

    @del = ();for ($d=0; $d<=90;$d++) {for ($c=0; $c<=$#dis;$c++) {if ($sort[$d] == $dis[$c]) { print OUTFILE “$x_one[$c] \t $y_one[$c] \t $m \n”); @del[$d] = $c; } } }


Subtractive clustering6

Subtractive Clustering

  • Repeat while any point (xi) is left to be assigned to a cluster

    • Use Eq. (1) to get the potential of xi

    • Find the point with the highest potential and choose it as the kth cluster center

    • Form the kth cluster by assigning N points closest to the centroid (Euclidean distance)

    • Remove the chosen N points

(1)

19


Subtractive clustering7

Subtractive Clustering

  • Repeat while any point (xi) is left to be assigned to a cluster

    • Use Eq. (1) to get the potential of xi

    • Find the point with the highest potential and choose it as the kth cluster center

    • Form the kth cluster by assigning N points closest to the centroid (Euclidean distance)

    • Remove the chosen N points

(1)

20


Center6

Center

  • foreach (@del) { $x_one[$_] = shift; $y_one[$_] = shift; }for ($f=0, $g=0 ;$f<=$#x_one;$f++){if ($x_one[$f] != "" and $y_one[$f] != "") { $x_one[$g] = $x_one[$f] ; $y_one[$g] = $y_one[$f] ; $g++; }}


Center7

Center

  • for($e=0; $e<90; $e++){pop @x_one;pop @y_one;} $n++; $m++;}


Final subtractive clustering graph

Final Subtractive Clustering Graph


  • Login