Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Python program that loads the input data file and produces the following normalizations. (x-(max+min/2))/((max-min)/2). As a starting point modify the Normalization Method 4.py

Write a Python program that loads the input data file and produces the following normalizations. (x-(max+min/2))/((max-min)/2). As a starting point modify the Normalization Method 4.py program to create a numeric normalization for the numeric.data file. Output the normalized values to a file

numeric.data file

320 874 625 524 56 452 972 517 566 271 116 130 903 859 421 427 89 531 871 836 797 677 448 707 345 857 793 392 195 86 230 720 81 665 708 434 122 55 950 633 149 47 570 346 445 634 483 431 977 78 666 816 731 619 637 732 52 991 813 760 562 493 199 588 354 504 316 461 674 69 868 594 267 116 801 4 598 713 878 558 130 703 813 712 277 884 313 691 83 841 477 906 838 569 972 354 113 586 61 633 119 387 691 572 846 743 920 282 801 90 390 717 526 44 557 789 133 11 128 774 796 916 113 653 882 681 632 813 46 686 710 996 597 288 396 173 161 206 698 506 760 777 232 787 111 306 626 707 314 485 122 537 688 824 247 331 379 403 253 5 93 774 321 205 641 352 715 920 829 902 75 326 424 333 647 985 839 712 176 698 650 296 978 464 45 268 724 990 680 131 783 408 961 244 711 887 144 535 667 822 204 266 183 521 751 688 916 201 967 109 724 164 405 290 805 763 6 662 260 166 75 312 914 408 552 714 579 179 60 395 475 56 327 152 708 841 352 252 278 686 203 65 192 840 834 35 278 251 129 355 589 449 7 570 398 950 178 194 777 2 814 779 76 582 210 432 425 19 206 438 752 128 820 253 545 492 382 773 346 318 976 242 455 459 818 778 269 346 902 877 47 840 166 255 601 773 292 461 618 129 264 325 703 409 941 165 226 604 454 151 692 100 405 655 5 551 849 856 218 366 527 247 247 798 101 211 110 987 614 689 763 523 878 619 507 983 700 448 764 965 194 527 499 427 509 443 315 456 765 630 112 702 627 103 781 386 949 584 422 153 133 616 224 53 975 733 851 880 707 143 498 88 354 206 761 197 446 120 309 958 843 157 176 9 135 603 7 700 746 880 811 844 842 147 135 275 788 469 851 676 811 955 394 809 183 53 933 309 916 800 992 288 807 237 703 623 173 440 686 924 923 108 933 551 810 552 108 521 498 488 739 605 27 259 516 162 143 30 83 615 142 369 911 302 975 442 413 279 892 88 776 914 132 72 488 773 831 145 781 959 37 564 454 449 696 487 818 946 682 451 779 570 996 197 108 13 240 56 465 488 435 927 247 298 811 659 576 242 820 657 404 397 454 557 32 781 831 670 25 279 937 347 154 482 928 725 917 323 296 216 601 413 253 790 978 31 181 185 629 470 325 81 500 405 673 822 864 168 237 608 863 501 891 566 915 889 161 353 71 362 140 635 848 195 296 396 828 975 432 79 554 413 484 281 543 299 309 771 663 14 518 440 18 687 636 581 946 784 788 556 69 431 255 421 766 61 191 4 722 700 204 870 285 93 197 368 47 844 234 17 811 98 3 643 641 245 129 149 974 754 87 237 881 999 144 970 240 56 293 376 67 571 509 468 245 697 779 521 212 167 442 35 955 786 848 224 784 241 556 678 726 392 824 646 761 181 985 614 760 377 249 289 480 498 816 46 183 790 334 301 589 587 491 487 819 845 618 638 732 475 566 45 497 846 142 279 178 465 556 454 257 355 284 961 996 503 865 647 830 538 272 964 624 579 693 612 804 590 809 228 602 905 421 776 933 926 124 920 339 857 10 762 221 161 974 415 678 537 64 54 979 621 423 736 483 472 64 36 625 720 299 614 208 718 483 931 867 880 215 44 699 992 488 647 705 34 548 985 753 834 886 631 527 618 997 38 400 486 279 572 845 830 193 641 698 116 20 104 710 715 143 415 5 355 108 827 611 933 42 894 366 21 137 854 775 153 34 274 424 517 747 935 740 840 317 541 446 914 766 518 635 932 574 257 804 764 417 520 547 629 55 494 533 168 115 758 139 631 624 862 653 628 897 406 913 992 164 156 970 672 637 479 469 568 764 85 408 19 59 494 70 669 750 504 608 325 230 819 148 118 929 449 68 563 2 12 18 903 412 577 169 994 174 393 213 603 245 689 937 69 230 557 490 66 751 404 889 307 626 182 776 507 331 916 287 668 623 697 202 586 818 926 962 726 355 611 861 225 153 680 637 257 690 182 82 57 866 123 53 234 440 441 237 120 188 122 815 685 379 850 151 960 771 694 668 988 646 71 397 7 728 459 817 352 740 993 866 171 480 570 594 302 3 493 800 707 212 249 753 532 725 825 281 263 298 242 872 26 65 276 722 758 331 33 908 619 581 130 477 242 429 303 168 629 548 341 363 512 106 603 905 441 640 569 722 711 386 144 906 442 134 870 377 653 685 299 331 147 951 850 412 520 929 966 981 267 426 453 566 371 398 552 592 313 622 381 735 576 848 196 139 313 340 861 385 588 941 514 630 249 998 222 810 386 894 216 852 796 522 588 613 819 981 900 205 690 274 868 778 228 195 259 987 641 657 692 529 249 348 536 470 111 718 538 213 380 324 96 888 4 680 398 639 340 552 512 801 773 519 400 327 484 504 624 969 380 410 37 913 994 622 142 154 942 746 496 240 641 381 209 572 878 611 93 290 491 600 389 629 778 527 80 641 42 691 173 270 280 102 6 863 447 504 226 685 317 204 312 387 105 994 776 836 531 752 266 687 804 930 166 511 465 27 199 671 765 717 813 499 266 377 636 995 50 923 950 909 453 602 688 648 927 100 615 696 702 380 108 596 359 605 224 879 394 542 808 884 395 306 538 77 127 551 942 343 821 748 557 314 525 180 258 875 500 593 129 554 702 33 656 37 546 346 211 906 65 140 77 667 619 378 766 368 207 487 251 497 967 135 9 509 757 846 518 794 565 590 466 336 221 991 843 238 230 730 162 72 623 121 592 29 164 149 656 534 880 73 351 295 864 999 660 528 793 405 937 56 333 504 168 239 60 160 889 303 7 308 864 485 213 205 353 259 891 910 923 218 63 702 968 496 592 930 501 804 394 987 87 176 77 714 402 574 613 399 355 872 371 418 918 190 576 464 153 774 87 483 837 913 736 864 231 168 61 59 55 988 371 659 580 891 875 19 985 389 134 936 251 685 727 102 100 865 275 897 56 778 978 335 136 185 475 318image text in transcribed

import math f = open('numeric.sm.data', 'r') print f maximum = 0 minimum = 9999999 # get maximum, minimum for input in f: maximum = max(int(input), maximum) minimum = min(int(input), minimum) f.close() print('maximum' + str(maximum)), print('minimum + str(minimum) # re-open the file to read in the values f = open('numeric.sm.data', 'r') print f for input in f: # method 4: (x-(max+min/2))/((max-min)/2) m4 = float(int(input)-(float(maximum + minimum) / 2.0)/(float(maximum - minimum) / 2.0) print repr(input.strip(' ')).rjust(5), repr(m4).rjust(5) f.close()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions

Question

List the steps in the succession management process.

Answered: 1 week ago