Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help cross check my work if that was done correctly. see the sample data below and the code i did. If there is a

Please help cross check my work if that was done correctly. see the sample data below and the code i did. If there is a modification kindly anoted it

import pandas as pd import mysecrets import requests from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split

# Load the data from the link data = pd.read_csv('bolttest.csv') data = data.fillna(data.mean()) # Extract the relevant columns and split into training and test sets X = data[["distance", "duration"]] y = data["upfront_price"] X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

# Train a linear regression model model = LinearRegression() model.fit(X_train, y_train)

# Make predictions on the test data predictions = model.predict(X_test)

# Check the difference between the predicted and metered price for prediction, metered_price in zip(predictions, y_test): if abs(prediction - metered_price) > 0.2 * metered_price: # Return the metered price if the difference is too large print(metered_price) else: # Return the predicted price otherwise print(prediction)

Part I: Data Analysis The key aspect of ride-hailing is upfront pricing, which works as the following way: First, it predicts the price for a ride based on predicted distance and time. This price is what you see on the screen of the phone before ordering a ride. Second, if the metered price based on actual distance and time differs a lot from the predicted one, the upfront price switches to the metered price. 'A lot' means more than 20%. For example, suppose you want to make a ride that upfront price predicts a cost of 5 euros. If the metered price is between 4 and 6 euros, you will end up paying 5 euros. You will end up paying something else if the metered price is anything less than 4 or more than 6 euros. No customer likes surprises (especially when it comes to money!), thats why we always strive to improve our upfront pricing precision for our customers smooth journeys. In the attached file you will find a sample data test.csv. Your task is to analyze this data and identify the top 1 to 2 opportunities that can help us improve upfront pricing precision. The expected output

order_id_new order_try_id_new calc_created metered_price upfront_price distance duration gps_confidence entered_by b_state dest_change_number prediction_price_type predicted_distance predicted_duration change_reason_pricing ticket_id_new device_token rider_app_version order_state order_try_state driver_app_version driver_device_uid_new device_name eu_indicator overpaid_ride_ticket fraud_score
22 22 2/2/2020 3:37 4.04 10 2839 700 1 client finished 1 upfront 13384 1091 1376 CI.4.17 finished finished DA.4.37 1596 Xiaomi Redmi 6 1 0 -1383
618 618 2/8/2020 2:26 6.09 3.6 5698 1 client finished 1 upfront 2286 360 2035 CA.5.43 finished finished DA.4.39 1578 Samsung SM-G965F 1 0

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 Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

Explain the impact of organizational culture on employees.

Answered: 1 week ago