Hello, I will receive the coding-related installations at 2 p.m. on November 18th. I have to finish the instructions at 3 p.m. on the same day. It means, you have to finish it in an hour. The coding is pyhton, and the content of this chapter is to call up the file. Is there anyone who can do it? I will attach a file of coding that I have learned so far. Based on the coding attached, you can read the instruments and code them. I’ll give you more file if you accepted

# Category: Python

Milestone 1: Environment Preparation

You are given a seed repo for this project located here – look under the directory 228_semantic_segmentation_of_aerial_imagery_using_unet.

Create a new repo under one Github account of a member of your team.

If you are working on own laptops/desktop: Checkout the code of the seed repo under src/ and incorporate poetry to allow your virtual environment to set up properly.

If you are working in Colab: use pip to install all dependencies bearing in mind that Colab has built in TF/Pytorch installations.

Install NNI. For Colab users: ensure that you have followed the instructions here to allow the UI to be visible.

Milestone 2: Perform Baseline Semantic Segmentation

Run the segmentation and produce plots of (a) 10 segmented images from the validation set (b) training and validation loss vs epochs, (b) Precision and Recall values

Milestone 3 (CS301-101 ONLY): Hyperparameter Optimization

Incorporate the Hyperparameter Optimization (HPO)(SMAC) method in your code and run the code to obtain the best (a) 10 segmented images from the validation set (b) training and validation loss vs epochs, (b) Precision and Recall values

Milestone 4: Model Compression

You are now tasked to do compress your model to fit a computer that may not have accelerator (GPUs) or enough memory to fit the original baseline model. Dont underestimate the impact of model compression – managing inference costs are the ranked consistently Number 1 goal for every enterprise that uses ML/AI.

Read about the seminal paper

Implement Knowledge Distillation (KD)

Run the code to obtain the student’s network (a) 10 segmented images from the validation set (b) training and validation loss vs epochs, (b) Precision and Recall values

(LINK TO THE SEED REPO) https://github.com/bnsreenu/python_for_microscopists

(LINK TO THE DATASET) https://www.kaggle.com/datasets/humansintheloop/semantic-segmentation-of-aerial-imagery

## Please see homework requirements.

I need help troubleshooting my python code. Please see homework requirements. My first function is already complete. Need help with array for third exercise.

Instructions from my teacher **Important note: **We suggest that you use Colab to work on the Jupyter notebook that you will submit as your final project on mangebac:

do on Jupyter notebook.

Overview. This assignment will allow you to practice algorithmic thinking and basic Python programming with several small-scale problems. As you solve each problem, follow the steps of algorithmic thinking as outlined below.

Use this template to complete the assignment.

Step 1: Algorithm Description. Include a step-by-step algorithm accompanied by either a flowchart or a Pseudo code to develop and express your steps that accomplish the given task . Remember, you have to be very explicit and clear to make sure one can actually achieve the task following your directions. Describe the input(s), output(s) and the process of the algorithm.

NOTE: To import a picture, for example, “image.png” to your Jupyter notebook, you can use the following block of code from IPython.display import ImageImage(“my_image.png”)

Step 2: Program Code – Implementation: **Implement the algorithm in Python using the basic structures we covered in class (feel free to use additional ones):

User input

Variables

Operators

Conditional execution

Functions

Modules

Data structures: Lists, strings, tuples, sets, dictionaries

Step 3: Program Testing: **Create a Test Plan with enough test cases that demonstrate your code works as intended. Explain how you used these test cases in your comments.

Step 4: Program Documentation: **Be sure to comment thoroughly so that it is clear that you understand what every line of the code is intended to accomplish.

The Problems

Problem 1. **Write a function to calculate the cost of a trip to a theme park, which includes the cost of the hotel, car rental, and park tickets.

a. Define a function to calculate the cost of the hotel. The function should allow the user to choose one of the room types below and enter the length of their stay. The function then calculates the cost accordingly.

Standard room: 150$ per night

Deluxe room: 180$ per night

Suite: 220$ per night

b. Define another function to calculate the cost of renting a car.

Rental cars charge

100$ up to 24 hours and 60$ added for each additional day.

c. Define a third function to calculate the cost of parking at the theme park. The cost of parking is 175$ for the first day and 50$ for each additional day.

d. Your final function should calculate the total cost of the theme park trip by calling the three functions above and summing their results.

Problem 2.

Write a function that asks the user to enter their exam scores in their History, Math, Language Arts, and Social Science classes and save the scores in a dictionary.

Example.

{“History”: [56, 75, 25], “Math”: [75, 85, 95, 65], “Language Arts”: [43, 32, 25], “Social Studies”: [90, 100, 95, 80]}

Return the user the two following dictionaries:

Calculate the average score for each class and save it in a new dictionary.

Next convert the average scores into letter grades based on the following scale and save the letter grades in another dictionary.

score > 90: A

75 < score <= 90: B

60 < score <= 75: C

score <= 60: D

Problem 3.

Write a function that accepts positive integers until the user enters “quit” and splits the numbers into three lists: the first one contains all the numbers, the second one contains all even numbers, and the third one contains all odd numbers. The function should return all three lists as well as the minimum and the maximum numbers in each list.

Your function should prompt the user to enter a positive number if they enter a negative value.

Your assignment submission needs to include the following resources:

A .pdf file must be the first resource and it will include all the answers to the questions above, including all the python code you produce. Make sure that you submit a neat, clearly presented, and easy-to-read .pdf. The .pdf should be submitted under the name file “student_name.pdf”.

Your second resource must be a single Jupyter Notebook with extension .ipynb (please see Figure below) and named “student_name.ipynb”. Zip your .pdf and .ipynb files.

***You need to submit two files: (1) pdf file from the first step and (2) the zip file from the second step.

Learning Outcomes

Added

ComputationalTools: Apply the computational terminology and tools appropriately in different quantitative contexts.

AlgorithmicStrategies: Demonstrate the ability to think logically and systematically about problems, breaking them down into a clear, ordered set of concrete steps that could be implemented by a machine.

CompProgramDesign: Generate working programs in a computer language that can solve computational problems; find and fix bugs that appear in them.

QuantCommunication: Communicate with a clear and precise style that is suited to an appropriate audience. Produce code that can be easily read and understood by others.

## Do on jupyter notebook.

Instructions from my teacher **Important note: **We suggest that you use Colab to work on the Jupyter notebook that you will submit as your final project on mangebac:

do on Jupyter notebook.

Overview. This assignment will allow you to practice algorithmic thinking and basic Python programming with several small-scale problems. As you solve each problem, follow the steps of algorithmic thinking as outlined below.

Use this template to complete the assignment.

Step 1: Algorithm Description. Include a step-by-step algorithm accompanied by either a flowchart or a Pseudo code to develop and express your steps that accomplish the given task . Remember, you have to be very explicit and clear to make sure one can actually achieve the task following your directions. Describe the input(s), output(s) and the process of the algorithm.

NOTE: To import a picture, for example, “image.png” to your Jupyter notebook, you can use the following block of code from IPython.display import ImageImage(“my_image.png”)

Step 2: Program Code – Implementation: **Implement the algorithm in Python using the basic structures we covered in class (feel free to use additional ones):

User input

Variables

Operators

Conditional execution

Functions

Modules

Data structures: Lists, strings, tuples, sets, dictionaries

Step 3: Program Testing: **Create a Test Plan with enough test cases that demonstrate your code works as intended. Explain how you used these test cases in your comments.

Step 4: Program Documentation: **Be sure to comment thoroughly so that it is clear that you understand what every line of the code is intended to accomplish.

The Problems

Problem 1. **Write a function to calculate the cost of a trip to a theme park, which includes the cost of the hotel, car rental, and park tickets.

a. Define a function to calculate the cost of the hotel. The function should allow the user to choose one of the room types below and enter the length of their stay. The function then calculates the cost accordingly.

Standard room: 150$ per night

Deluxe room: 180$ per night

Suite: 220$ per night

b. Define another function to calculate the cost of renting a car.

Rental cars charge

100$ up to 24 hours and 60$ added for each additional day.

c. Define a third function to calculate the cost of parking at the theme park. The cost of parking is 175$ for the first day and 50$ for each additional day.

d. Your final function should calculate the total cost of the theme park trip by calling the three functions above and summing their results.

Problem 2.

Write a function that asks the user to enter their exam scores in their History, Math, Language Arts, and Social Science classes and save the scores in a dictionary.

Example.

{“History”: [56, 75, 25], “Math”: [75, 85, 95, 65], “Language Arts”: [43, 32, 25], “Social Studies”: [90, 100, 95, 80]}

Return the user the two following dictionaries:

Calculate the average score for each class and save it in a new dictionary.

Next convert the average scores into letter grades based on the following scale and save the letter grades in another dictionary.

score > 90: A

75 < score <= 90: B

60 < score <= 75: C

score <= 60: D

Problem 3.

Write a function that accepts positive integers until the user enters “quit” and splits the numbers into three lists: the first one contains all the numbers, the second one contains all even numbers, and the third one contains all odd numbers. The function should return all three lists as well as the minimum and the maximum numbers in each list.

Your function should prompt the user to enter a positive number if they enter a negative value.

Your assignment submission needs to include the following resources:

A .pdf file must be the first resource and it will include all the answers to the questions above, including all the python code you produce. Make sure that you submit a neat, clearly presented, and easy-to-read .pdf. The .pdf should be submitted under the name file “student_name.pdf”.

Your second resource must be a single Jupyter Notebook with extension .ipynb (please see Figure below) and named “student_name.ipynb”. Zip your .pdf and .ipynb files.

***You need to submit two files: (1) pdf file from the first step and (2) the zip file from the second step.

Learning Outcomes

Added

ComputationalTools: Apply the computational terminology and tools appropriately in different quantitative contexts.

AlgorithmicStrategies: Demonstrate the ability to think logically and systematically about problems, breaking them down into a clear, ordered set of concrete steps that could be implemented by a machine.

CompProgramDesign: Generate working programs in a computer language that can solve computational problems; find and fix bugs that appear in them.

QuantCommunication: Communicate with a clear and precise style that is suited to an appropriate audience. Produce code that can be easily read and understood by others.

## ., p[1] = c1, and p[0] = c0.

In this problem, you are asked to implement polynomials

using a list. A polynomial is an expression of the form

c0 + c1x + c2x2 + c3x3 + . . . + cnxn

where c0, c1, . . . , cn are real numbers. Each of cixi is called a term of the polynomial, and ci

is called the coefficient of the term with exponent i. Note that c0 is simply the coefficient of

the term with exponent 0. The maximum exponent with a non-zero coefficient is called the

degree of the polynomial. For example, 6×14 + 9×11 −12×3 + 42 is a polynomial of degree 14.

The polynomial −12×6 + 5×5 −20×4 + 8×2 −12x + 9 has degree 6. The following are some

standard operations on polynomials:

3

Scaling a polynomial: Given a polynomial p(x) = cnxn+cn−1xn−1+. . .+c1x+c0 and a real

value s, scaling p(x) by s gives the polynomial s ·p(x) obtained by scaling the coefficient

of every term in p(x) by the factor s. For example, if p(x) = 6×14 + 9×11 −12×3 + 42,

then 2p(x) = 12×14 + 18×11 −24×3 + 84.

Sum of two polynomials: The sum of two polynomials p1(x) and p2(x), denoted by p1(x)+

p2(x), is the polynomial obtained by adding the terms of p1(x) and p2(x). For example,

if p1(x) = 6×14 + 9×11 −12×3 + 42 and p2(x) = −12×6 + 5×5 −20×4 + 8×2 −12x + 9, then

p1(x) + p2(x) = 6×14 + 9×11 −12×6 + 5×5 −20×4 −12×3 + 8×2 −12x + 51.

Difference of two polynomials: The difference of two polynomials p1(x) and p2(x) is the

polynomial obtained by subtracting one from the other. Therefore, p1(x) −p2(x) is the

polynomial obtained by subtracting the terms of p2(x) from p1(x).

For example, if p1 and

p2 are as above, then p1(x)−p2(x) = 6×14+9×11+12×6−5×5+20×4−12×3−8×2+12x+33.

Product of two polynomials: The product of two polynomials p1(x) and p2(x), denoted

by p1(x) ·p2(x), is the polynomial obtained by the pair-wise multiplication of terms in

p1(x) and p2(x). For example, if p1(x) = x4 + 4×3 + 4×2 and p2(x) = 2x −1, then

p1(x) ·p2(x) = 2×5 + 7×4 + 4×3 −4×2. This is obtained as follows: (x4 + 4×3 + 4×2)(2x) +

(x4 + 4×3 + 4×2)(−1) = 2×5 + 8×4 + 8×3 −x4 −4×3 −4×2 = 2×5 + 7×4 + 4×3 −4×2.

In this program, you will store a polynomial as a list of real values. The length of the list will

be equal to one more than the degree of the polynomial. The item at index i of the list will

be equal to the coefficient of the term with exponent i in the polynomial. In other words,

polynomial p(x) = cnxn + cn−1xn−1 + . . . + c1x + c0 is stored in a list p of length n + 1, such

that p[n] = cn, p[n-1] = cn−1, . . ., p[1] = c1, and p[0] = c0. For example, the polynomial

6×14 + 9×11 −12×3 + 42 is stored as the following list: [42, 0, 0, -12, 0, 0, 0, 0, 0,

0, 0, 9, 0, 0, 6]. Note that the length of the list is 15.

You are asked to implement the following functions to manipulate polynomials:

1. A function called make poly with a single parameter called termlist, which

is a list of 2-tuples, where each 2-tuple in the list is an (exponent, coefficient) pair

representing a term in the polynomial. The exponent is an integer and the coefficient

is a real number. This function will create a list to store the polynomial (as described

above) and return the list. Note that the 2-tuples in termlist may appear in any order

(that is, do not assume that the terms will appear in increasing or decreasing order of

exponents in termlist). For example, after the following assignment statement

term_list_1 = [(14, 6), (11, 9), (0, 42), (3, -12)]

p1 = make_poly(term_list_1)

p1 should be the list [42, 0, 0, -12, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 6].

2. function called print poly with a single parameter: a polynomial p. Keep

in mind that p is a list. This function prints out the polynomial. The polynomial must be

printed “nicely”. This means that only terms with non-zero coefficients must be printed

out and the terms must be printed from largest exponent to the smallest. Furthermore, if

the coefficient of a term is negative, the – (minus sign) must be embedded in the printed

polynomial. For example, if the polynomial is −12×6 + 5×5 −20×4 + 8×2 −12x + 9, it

should be printed as

-12x^6 + 5x^5 – 20x^4 + 8x^2 – 12x + 9

4

and not as

-12x^6 + 5x^5 + -20x^4 + 0x^3 + 8x^2 + -12x^1 + 9x^0

3. A function called eval poly with two parameters: a polynomial p and a real

number r. The function should evaluate p at x = r and return the result. For example,

if p is the polynomial −12×6 + 5×5 −20×4 + 8×2 −12x + 9, then eval poly(p, 2) should

return -911 (which we obtain by plugging in 2 as the value of x).

4. A function called scale poly with two parameters: a polynomial p and a real

non-zero value s. The function should return the polynomial sp, that is, the polynomial

obtained by scaling p by s. Keep in mind that you are returning a new polynomial (that

is, this function should not modify p).

5. A function called sum poly with two parameters: a polynomial p1 and a

polynomial p2. The function should return the sum polynomial p1 + p2. Make sure

that the length of the sum polynomial list is exactly equal to its degree plus one. Also,

the function should not modify p1 and p2.

6. A function called diff poly with two parameters: a polynomial p1 and a

polynomial p2. The function should return the difference polynomial p1 – p2. Again,

make sure that the length of the difference polynomial list is exactly equal to its degree

plus one and the function does not modify p1 and p2.

7. A function called mult poly with two parameters: a polynomial p1 and a

polynomial p2. The function should return the product polynomial p1 * p2. Make sure

that the length of the product polynomial list is exactly equal to its degree plus one and

the function does not modify p1 and p2.

8. A function called test polys without any parameters. This function has been writ-

ten for you in a file called hw4problem2.py, available for download on Canvas.

This function is simply a driver function that makes calls to all of the above functions,

thus allowing you to test them. You will insert your implementations of all the above

functions into this module.

Ride-hailing platforms don’t have a constant price like public transportation like subways/buses. The price of a ride depends on factors such as mileage, time, demand, climate conditions and local accessibility.

We have two data sets, one week long, that include travel data from both Uber and Lyft and weather data over the same period. Please try the analysis according to the data content and the actual map location information:

· The relationship between trip length and price

· The relationship between price and climate

· The relationship between itinerary type and price

Summarize the characteristics of these data in time and space. For example, what is the common direction of migration in the morning? What is the common direction of migration in the evening? Are there specific differences between weekday and weekend schedules? Summarize a report and try to give statistics and solutions to optimize operations for drivers.

Ride-hailing platforms don’t have a constant price like public transportation like subways/buses. The price of a ride depends on factors such as mileage, time, demand, climate conditions and local accessibility.

We have two data sets, one week long, that include travel data from both Uber and Lyft and weather data over the same period. Please try the analysis according to the data content and the actual map location information:

· The relationship between trip length and price

· The relationship between price and climate

· The relationship between itinerary type and price

Summarize the characteristics of these data in time and space. For example, what is the common direction of migration in the morning? What is the common direction of migration in the evening? Are there specific differences between weekday and weekend schedules? Summarize a report and try to give statistics and solutions to optimize operations for drivers.

Module 5: Lab Activity – Iterative Programming

Hide Assignment Information

Instructions

Work through the Module 5: Lab Activity (located in this module) and submit the deliverables listed in the document to this assignment submission folder for a grade. This assignment is due by Sunday at 11:59 PM

Data Analytics using Python

Deliverables – for this assignment, you will consider a real world dataset that contains at least 2

categorical and at least 2 continuous features and deliver code and a report that covers the

following:

Exploratory Analysis (10 marks):

–

Describe and discuss the dataset and features using appropriate graphs and tables

– For each continuous variable, describe central and variational measures

– Produce appropriate graphs for the relationship between the features and calculate

correlation coefficients.

Data Preprocessing (10 marks):

–

Convert any categorical variables into dummy variables

– Handle any missing data

–

Outliers

– Explain chebyshev’s rule and use it to find any outliers in the data

– Explain the box plot technique and use it to find any outliers in the data

– Discuss any outliers and decide if you will remove / alter these values and why

–

Explain the rationale for normalization, and use some technique to normalize your data.

– Split the dataset into 80% training and 20% testing and explain why this is necessary for

ML.

Predictive Analysis (20 marks):

– Specify input and output variables

– Fit a suitable regression model to your training dataset

– Interpret the model parameters

– Use your model to predict the output for your test data

– Provide an analysis of the model performance.

The report should also have an introduction and conclusion.