You are given the daily temperature reading of P towns and the daily temperature reading of New York City (NYC) for N days. For the given data, write a function that returns a set of five towns that are jointly as predictive as possible of the daily temperate of NYC. Note that the exact solution to this problem requires an exhaustive search that can be computationally challenging. We expect you to write an approximate solution that is as fast, or maybe faster, than your solution to Question 2.
You are given the daily temperature reading of P towns and the daily temperature reading of New York City (NYC) for N days. For the given data, write a function that returns a set of five towns that are jointly as predictive as possible of the daily temperate of NYC. Note that the exact solution to this problem requires an exhaustive search that can be computationally challenging. We expect you to write an approximate solution that is as fast, or maybe faster, than your solution to Question 2.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
ANSWER MUST BE IN PYTHON3. METHOD HEADER BELOW.
#!/bin/python3
import math
import os
import random
import re
import sys
import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression
def read_dataframe():
# Return a pandas dataframe from stdin
return pd.read_csv(sys.stdin)
def read_matrix():
# Return column names and data as a matrix
df = read_dataframe()
return list(df.columns), df.values
def read_list():
# Return column names and data as a list of lists
# Each element in the list corresponds to columns in the data
col_names, val = read_matrix()
return col_names, val.T.tolist()
#
# Complete the 'main' function below.
#
# The function is expected to return a STRING.
#
def main():
# Write your code here
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
result = main()
fptr.write(result + '\n')
fptr.close()
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education