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. Subtract each value by min value then divide by range.

Write a Python program that loads the input data file and produces the following normalizations. Subtract each value by min value then divide by range. As a starting point modify the Normalization Method 2.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 811image text in transcribed

import math f = open('numeric.sm.data', 'r') print f OOONOWN maximum = 0 minimum = 9999999 11 # get maximum, minimum for input in f: maximum = max(int(input), maximum) minimum = min(int(input), minimum) f.close() 12 print('maximum + str(maximum) print('minimum ' + str(minimum) 16 19 # re-open the file to read in the values f = open('numeric.sm.data', 'r') print f 22 for input in f: # method 2: Subtract each value by min value then divide by range m2 = float(int(input) - minimum) / float(maximum - minimum) print repr(input.strip(' ').rjust(5), repr(m2).rjust(5) f.close() 27

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899