This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Original list of numbers. | |
| numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
| # For loop to create a new list where we substitute all multiples of 2 by 0, | |
| # multiples of 3(which are not multiples of 2) by 1 and leave the rest as it is. | |
| modified_numbers = [] | |
| for number in numbers: | |
| if number % 2 == 0: | |
| modified_numbers.append(0) | |
| elif number % 3 == 0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def bb_intersection_over_union(boxA, boxB): | |
| # determine the (x, y)-coordinates of the intersection rectangle | |
| xA = max(boxA[0], boxB[0]) | |
| yA = max(boxA[1], boxB[1]) | |
| xB = min(boxA[2], boxB[2]) | |
| yB = min(boxA[3], boxB[3]) | |
| # compute the area of intersection rectangle | |
| interArea = abs(max((xB - xA, 0)) * max((yB - yA), 0)) | |
| if interArea == 0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy | |
| import GA | |
| """ | |
| The y=target is to maximize this equation ASAP: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # restore_packages.R | |
| # | |
| # installs each package from the stored list of packages | |
| # source: http://hlplab.wordpress.com/2012/06/01/transferring-installed-packages-between-different-installations-of-r/ | |
| load("~/installed_packages.rda") | |
| for (count in 1:length(installedpackages)) { | |
| install.packages(installedpackages[count]) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| the | |
| of | |
| to | |
| and | |
| a | |
| in | |
| is | |
| it | |
| you | |
| that |