Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5. (1 point) Create a function called ticket_cost. This function computes the cost of a movie ticket. The base cost is $5, but the person

image text in transcribedimage text in transcribed

5. (1 point) Create a function called ticket_cost. This function computes the cost of a movie ticket. The base cost is $5, but the person will receive a discount if the person is a senior citizen ($2 discount) or a student ($1 discount). Make sure that the function asks the user if the person is a senior citizen or if the person is a student. The function must print the cost of the movie ticket based on the information provided. 6. (1 point) Machine Learning Application Logistic regression (LR) is a type of model used to compute the probability that a class or an event is observed. LR is commonly used in machine learning applications. In this problem, we will implement a logistic regression models and then we will apply it. a. A company is interested in determining the probability that a person will rent their e-scooters for a trip from Terrace to UPRM. They have a LR model that computes the probability that a person rents an e-scooter; we will use p to represent this probability. Create a function called Ir_model that implements the following LR model: p 1 1 + e-z where z = Bo + B1X1 + B2X2. The variable x1 represents a person's income and the variable x2 is the price of an e-scooter trip. The Bo, B1, B2, X1, and x2 variables must be represented as the function parameters. The function must return the value of p. b. The model classifies people as renters and non-renters of the company's e-scooters based on each person renting probability (p). The decision rule" is as follows: if the probability p is greater than 0.5, the person is classified as a renter; otherwise, the person is classified as a non-renter. Create a function called classification that implements the decision rule. The function must return the value of a variable called decision. decision is 1 if p is greater than 0.5 (i.e., the person is classified as a renter), and 0 otherwise (i.e., the person is classified as a non-renter). c. Add the Ir_model function and the classification function within function called demand forecast. This function predicts the level of demand for scooters at different price levels. Run the test case for this function. Include in your document the graphical output. The result should be similar to this graph: 10000 8000 6000 Demand (Number of renters) 4000 2000 0 0 4 5 2 3 Trip Prices 5. (1 point) Create a function called ticket_cost. This function computes the cost of a movie ticket. The base cost is $5, but the person will receive a discount if the person is a senior citizen ($2 discount) or a student ($1 discount). Make sure that the function asks the user if the person is a senior citizen or if the person is a student. The function must print the cost of the movie ticket based on the information provided. 6. (1 point) Machine Learning Application Logistic regression (LR) is a type of model used to compute the probability that a class or an event is observed. LR is commonly used in machine learning applications. In this problem, we will implement a logistic regression models and then we will apply it. a. A company is interested in determining the probability that a person will rent their e-scooters for a trip from Terrace to UPRM. They have a LR model that computes the probability that a person rents an e-scooter; we will use p to represent this probability. Create a function called Ir_model that implements the following LR model: p 1 1 + e-z where z = Bo + B1X1 + B2X2. The variable x1 represents a person's income and the variable x2 is the price of an e-scooter trip. The Bo, B1, B2, X1, and x2 variables must be represented as the function parameters. The function must return the value of p. b. The model classifies people as renters and non-renters of the company's e-scooters based on each person renting probability (p). The decision rule" is as follows: if the probability p is greater than 0.5, the person is classified as a renter; otherwise, the person is classified as a non-renter. Create a function called classification that implements the decision rule. The function must return the value of a variable called decision. decision is 1 if p is greater than 0.5 (i.e., the person is classified as a renter), and 0 otherwise (i.e., the person is classified as a non-renter). c. Add the Ir_model function and the classification function within function called demand forecast. This function predicts the level of demand for scooters at different price levels. Run the test case for this function. Include in your document the graphical output. The result should be similar to this graph: 10000 8000 6000 Demand (Number of renters) 4000 2000 0 0 4 5 2 3 Trip Prices

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

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

5. What is the total of all payments made

Answered: 1 week ago