Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is what the program output should look like: Sample Program Output DATA-51100, [semester] [year] NAME: [put your name here] PROGRAMMING ASSIGNMENT #4 Prob(aspiration=std|make=alfa-romero) =

image text in transcribedimage text in transcribed

This is what the program output should look like:

Sample Program Output DATA-51100, [semester] [year] NAME: [put your name here] PROGRAMMING ASSIGNMENT #4

Prob(aspiration=std|make=alfa-romero) = 100.00% Prob(aspiration=turbo|make=alfa-romero) = 0.00% Prob(aspiration=std|make=audi) = 71.43% Prob(aspiration=turbo|make=audi) = 28.57% Prob(aspiration=std|make=bmw) = 100.00% Prob(aspiration=turbo|make=bmw) = 0.00% Prob(aspiration=std|make=chevrolet) = 100.00% Prob(aspiration=turbo|make=chevrolet) = 0.00% Prob(aspiration=std|make=dodge) = 66.67% Prob(aspiration=turbo|make=dodge) = 33.33% Prob(aspiration=std|make=honda) = 100.00% Prob(aspiration=turbo|make=honda) = 0.00% Prob(aspiration=std|make=isuzu) = 100.00% Prob(aspiration=turbo|make=isuzu) = 0.00% Prob(aspiration=std|make=jaguar) = 100.00% Prob(aspiration=turbo|make=jaguar) = 0.00% Prob(aspiration=std|make=mazda) = 100.00% Prob(aspiration=turbo|make=mazda) = 0.00% Prob(aspiration=std|make=mercedes-benz) = 50.00% Prob(aspiration=turbo|make=mercedes-benz) = 50.00% Prob(aspiration=std|make=mercury) = 0.00% Prob(aspiration=turbo|make=mercury) = 100.00% Prob(aspiration=std|make=mitsubishi) = 53.85% Prob(aspiration=turbo|make=mitsubishi) = 46.15% Prob(aspiration=std|make=nissan) = 94.44% Prob(aspiration=turbo|make=nissan) = 5.56% Prob(aspiration=std|make=peugot) = 45.45% Prob(aspiration=turbo|make=peugot) = 54.55% Prob(aspiration=std|make=plymouth) = 71.43% Prob(aspiration=turbo|make=plymouth) = 28.57% Prob(aspiration=std|make=porsche) = 100.00% Prob(aspiration=turbo|make=porsche) = 0.00% Prob(aspiration=std|make=renault) = 100.00% Prob(aspiration=turbo|make=renault) = 0.00% Prob(aspiration=std|make=saab) = 66.67% Prob(aspiration=turbo|make=saab) = 33.33% Prob(aspiration=std|make=subaru) = 83.33% Prob(aspiration=turbo|make=subaru) = 16.67% Prob(aspiration=std|make=toyota) = 96.88% Prob(aspiration=turbo|make=toyota) = 3.12% Prob(aspiration=std|make=volkswagen) = 83.33% Prob(aspiration=turbo|make=volkswagen) = 16.67% Prob(aspiration=std|make=volvo) = 54.55% Prob(aspiration=turbo|make=volvo) = 45.45% Prob(make=alfa-romero) = 1.46% Prob(make=audi) = 3.41% Prob(make=bmw) = 3.90% Prob(make=chevrolet) = 1.46% Prob(make=dodge) = 4.39% Prob(make=honda) = 6.34% Prob(make=isuzu) = 1.95% Prob(make=jaguar) = 1.46% Prob(make=mazda) = 8.29% Prob(make=mercedes-benz) = 3.90% Prob(make=mercury) = 0.49% Prob(make=mitsubishi) = 6.34% Prob(make=nissan) = 8.78% Prob(make=peugot) = 5.37% Prob(make=plymouth) = 3.41% Prob(make=porsche) = 2.44% Prob(make=renault) = 0.98% Prob(make=saab) = 2.93% Prob(make=subaru) = 5.85% Prob(make=toyota) = 15.61% Prob(make=volkswagen) = 5.85% Prob(make=volvo) = 5.37%

3.47 52.4 SIX 1545000 two five five five five 8.5 110 four gas 52 five four gas 101 four rwd sto Six rwd SIK shx gas two 110 Six make fuel-type aspiration num-of-do body-style drive-whet engine-loc: wheel-base length width height curb-weigt engine-typ num-of-cyl engine-size fuel-systen bore alfa-romergas std two convertible rwd front 38.6 168.8 64.1 48.B 2548 dohc four 130 mpfi alfa-romerigas std two convertible rwd front 88.6 168.8 64.1 48.3 2548 dohc four 130 mpfi alfa-romengas std two hatchback rwd front 94.5 171.2 65.5 2823 ohcv 152 mpfi audi gas std four sedan fwd front 99.8 176.6 66.2 54.3 2337 ohc four 109 mpfi audi gas std four sedan 4wd front 99.4 176.6 66.4 54.3 2024 ohc 136 mpfi audi std sedan fwd front 99.8 177.3 66.3 53.1 2507 ohc 136 mpfi audi four sedan fwd front 105.8 192.7 71.4 55.7 2844 ohc 136 mpfi audi gas std wagon fwd front 105.8 192.7 71.4 55.7 2954 ohc 136 mpfi audi turbo four sedan fwd front 105 S 192.7 71.4 55.9 3086 ohc five 131 mpfi audi turbo two hatchback 4wd front 99.5 178.2 67.9 3053 ohc 131 mpfi bmw two sedan rwd front 101.2 176.8 64.8 54.3 2395 ohc 108 mpfi bmw gas std sedan front 101.2 176.8 64.B 54.3 2395 ohc four 108 mpfi bmw gas std two sedan rwd front 1012 176.8 64.B 54.3 2710 ohc SIX 164 mpfi bmw four sedan rwd front 1012 176.8 64.8 54.3 2765 ohc 164 mpfi bmw four sedan front 103.5 189 66.9 55.7 3055 ohc 164 mpfi bmw four sedan rwd front 103.5 66.9 55.7 3230 ohc 209 mpfi bmw sedan rwd front 103.5 193.8 67.9 53.7 3330 ohc SIX 209 mpfi bmw four sedan rwd front 197 70.9 56.3 3505 ohc 209 mpfi chevrolet gas two hatchback fwd front 141.1 60.3 53.2 1458 three 61 2bbl chevrolet gas std two hatchback fwd front 94.5 155.9 63.6 52 1874 ohc four so zbbl chevrolet gas std four sedan fwd front 94.5 158.8 63.6 52 1909 ohc four so zbbl dodge gas two hatchback fwd front 93.7 157.3 63.8 50.B 1875 ohc four so zbbl dodge two hatchback fwd front 93.7 157.3 63.B 50.B 1876 ohc four so zbbl dodge gas turbo two hatchback fwd front 93.7 157.3 63.B 50.B 2128 ohc four sa mpfi dodge gas std four hatchback fwd front 93.7 157.3 63.B 50.6 1967 ohc four 90 2bb! dodge four sedan fwd front 93.7 63.B 50.5 1969 ohc four so zbbl dodge four sedan fwd front 93.7 157.3 63.B 50.6 1989 ohc 90 2bb! dodge gas turbo sedan fwd front 93.7 157.3 63.8 50.6 2191 ohc four 9a mpfi dodge std four wagon fwd front 103.3 174.6 64.5 59.B 2535 ohc four 122 2bbl dodge turbo two hatchback fwd front 95.9 173.2 66.3 2011 ohc four 156 mfi honda two hatchback fwd front 86.6 144.6 63.9 50.B 1713 ohc 92 lbbl honda std two hatchback fwd front 36.6 144.6 63.9 50.B 1819 ohc four 92 lbbl honda std two hatchback fwd front 93.7 150 64 52.6 1837 ohc four 79 lbbl honda gas two hatchback fwd front 93.7 52.6 1940 ohc four 92 lbbl honda std two hatchback fwd front 93.7 150 52.6 1055 oh 1956 ohc 92 lbbl honda gas std four sedan fwd front 96.5 163.4 64 54.5 2010 ohc four 92 lbbl honda as four w200n find front 96.5 157 1 13 H 53 304 th. four 92. 1hbl stroke compressic horsepowe peak-rpm city-mpg 2.68 111 5000 3.47 2.68 111 5000 2.68 3.47 3.19 3.4 102 5500 3.4 115 5500 3.4 110 5500 5500 110 5500 3.13 140 5500 3.13 160 5500 5800 3.5 2.8 5800 3.31 3.19 4250 3.19 121 4250 3.19 121 4250 3.39 182 5400 3.39 5400 3.39 182 5400 5100 3.11 5400 3.11 5400 3.23 9.41 5500 3.23 5500 3.39 7.6 5500 3.23 68 5500 3.23 5500 3.23 5500 3.39 7.6 5500 3.46 88 5000 3.6 3.9 145 5000 3.41 9.6 4800 2.91 9.2 6000 2.91 3.07 10.1 5500 2.91 6000 2.91 3.41 6000 2.91 3.41 9.2 6000 741 Hnn 3.03 9.6 NNNNNNWwwww std gas std 157.3 gas four gas gas 50.2 four 2.91 gas Bas std 150 64 3.41 gas 64 four 92 7.92 Requirements You are to create a program in Python that performs the following: 1. Loads the 'cars.csv file into a pandas DataFrame. 2. For each aspiration type a, computes the conditional probability of that aspiration, given each of the makes: P(aspiration = a model = m) 3. Displays the conditional probabilities to the screen. 4. Computes the probability of each make and outputs to the screen. Additional Requirements 1. The name of your source code file should be Probest.py. All your code should be within a single file. 2. You cannot import any package except for pandas. You need to use the pandas DataFrame object for storing data. You cannot use the groupby function! 3. Your code should follow good coding practices, including good use of whitespace and use of both inline and block comments. 4. You need to use meaningful identifier names that conform to standard naming conventions. 5. At the top of each file, you need to put in a block comment with the following information: your name, date, course name, semester, and assignment name. 3.47 52.4 SIX 1545000 two five five five five 8.5 110 four gas 52 five four gas 101 four rwd sto Six rwd SIK shx gas two 110 Six make fuel-type aspiration num-of-do body-style drive-whet engine-loc: wheel-base length width height curb-weigt engine-typ num-of-cyl engine-size fuel-systen bore alfa-romergas std two convertible rwd front 38.6 168.8 64.1 48.B 2548 dohc four 130 mpfi alfa-romerigas std two convertible rwd front 88.6 168.8 64.1 48.3 2548 dohc four 130 mpfi alfa-romengas std two hatchback rwd front 94.5 171.2 65.5 2823 ohcv 152 mpfi audi gas std four sedan fwd front 99.8 176.6 66.2 54.3 2337 ohc four 109 mpfi audi gas std four sedan 4wd front 99.4 176.6 66.4 54.3 2024 ohc 136 mpfi audi std sedan fwd front 99.8 177.3 66.3 53.1 2507 ohc 136 mpfi audi four sedan fwd front 105.8 192.7 71.4 55.7 2844 ohc 136 mpfi audi gas std wagon fwd front 105.8 192.7 71.4 55.7 2954 ohc 136 mpfi audi turbo four sedan fwd front 105 S 192.7 71.4 55.9 3086 ohc five 131 mpfi audi turbo two hatchback 4wd front 99.5 178.2 67.9 3053 ohc 131 mpfi bmw two sedan rwd front 101.2 176.8 64.8 54.3 2395 ohc 108 mpfi bmw gas std sedan front 101.2 176.8 64.B 54.3 2395 ohc four 108 mpfi bmw gas std two sedan rwd front 1012 176.8 64.B 54.3 2710 ohc SIX 164 mpfi bmw four sedan rwd front 1012 176.8 64.8 54.3 2765 ohc 164 mpfi bmw four sedan front 103.5 189 66.9 55.7 3055 ohc 164 mpfi bmw four sedan rwd front 103.5 66.9 55.7 3230 ohc 209 mpfi bmw sedan rwd front 103.5 193.8 67.9 53.7 3330 ohc SIX 209 mpfi bmw four sedan rwd front 197 70.9 56.3 3505 ohc 209 mpfi chevrolet gas two hatchback fwd front 141.1 60.3 53.2 1458 three 61 2bbl chevrolet gas std two hatchback fwd front 94.5 155.9 63.6 52 1874 ohc four so zbbl chevrolet gas std four sedan fwd front 94.5 158.8 63.6 52 1909 ohc four so zbbl dodge gas two hatchback fwd front 93.7 157.3 63.8 50.B 1875 ohc four so zbbl dodge two hatchback fwd front 93.7 157.3 63.B 50.B 1876 ohc four so zbbl dodge gas turbo two hatchback fwd front 93.7 157.3 63.B 50.B 2128 ohc four sa mpfi dodge gas std four hatchback fwd front 93.7 157.3 63.B 50.6 1967 ohc four 90 2bb! dodge four sedan fwd front 93.7 63.B 50.5 1969 ohc four so zbbl dodge four sedan fwd front 93.7 157.3 63.B 50.6 1989 ohc 90 2bb! dodge gas turbo sedan fwd front 93.7 157.3 63.8 50.6 2191 ohc four 9a mpfi dodge std four wagon fwd front 103.3 174.6 64.5 59.B 2535 ohc four 122 2bbl dodge turbo two hatchback fwd front 95.9 173.2 66.3 2011 ohc four 156 mfi honda two hatchback fwd front 86.6 144.6 63.9 50.B 1713 ohc 92 lbbl honda std two hatchback fwd front 36.6 144.6 63.9 50.B 1819 ohc four 92 lbbl honda std two hatchback fwd front 93.7 150 64 52.6 1837 ohc four 79 lbbl honda gas two hatchback fwd front 93.7 52.6 1940 ohc four 92 lbbl honda std two hatchback fwd front 93.7 150 52.6 1055 oh 1956 ohc 92 lbbl honda gas std four sedan fwd front 96.5 163.4 64 54.5 2010 ohc four 92 lbbl honda as four w200n find front 96.5 157 1 13 H 53 304 th. four 92. 1hbl stroke compressic horsepowe peak-rpm city-mpg 2.68 111 5000 3.47 2.68 111 5000 2.68 3.47 3.19 3.4 102 5500 3.4 115 5500 3.4 110 5500 5500 110 5500 3.13 140 5500 3.13 160 5500 5800 3.5 2.8 5800 3.31 3.19 4250 3.19 121 4250 3.19 121 4250 3.39 182 5400 3.39 5400 3.39 182 5400 5100 3.11 5400 3.11 5400 3.23 9.41 5500 3.23 5500 3.39 7.6 5500 3.23 68 5500 3.23 5500 3.23 5500 3.39 7.6 5500 3.46 88 5000 3.6 3.9 145 5000 3.41 9.6 4800 2.91 9.2 6000 2.91 3.07 10.1 5500 2.91 6000 2.91 3.41 6000 2.91 3.41 9.2 6000 741 Hnn 3.03 9.6 NNNNNNWwwww std gas std 157.3 gas four gas gas 50.2 four 2.91 gas Bas std 150 64 3.41 gas 64 four 92 7.92 Requirements You are to create a program in Python that performs the following: 1. Loads the 'cars.csv file into a pandas DataFrame. 2. For each aspiration type a, computes the conditional probability of that aspiration, given each of the makes: P(aspiration = a model = m) 3. Displays the conditional probabilities to the screen. 4. Computes the probability of each make and outputs to the screen. Additional Requirements 1. The name of your source code file should be Probest.py. All your code should be within a single file. 2. You cannot import any package except for pandas. You need to use the pandas DataFrame object for storing data. You cannot use the groupby function! 3. Your code should follow good coding practices, including good use of whitespace and use of both inline and block comments. 4. You need to use meaningful identifier names that conform to standard naming conventions. 5. At the top of each file, you need to put in a block comment with the following information: your name, date, course name, semester, and assignment name

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

MySQL/PHP Database Applications

Authors: Jay Greenspan, Brad Bulger

1st Edition

ISBN: 978-0764535376

More Books

Students also viewed these Databases questions

Question

Evaluate the importance of the employee handbook.

Answered: 1 week ago

Question

Discuss the steps in the progressive discipline approach.

Answered: 1 week ago