1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zhuklara [117]
3 years ago
10

Let's model this housing price data! Before we can do this, however, we need to split the data into training and test sets. Reme

mber that the response vector (housing prices) lives in the target attribute. A random seed is set here so that we can deterministically generate the same splitting in the future if we want to test our result again and find potential bugs. Use the train_test_split function to split out 10% of the data for the test set. Call the resulting splits X_train, X_test, Y_train, Y_test.
Engineering
1 answer:
Lilit [14]3 years ago
3 0

The program reads in a dataset into a pandas dataframe, and uses the train_test_split function in the sklearn library to split the data into <em>training and test sets</em>. The code goes thus :

import pandas as pd

<em>#import</em><em> </em><em>the</em><em> </em><em>pandas</em><em> </em><em>dataframe</em><em> </em><em>and</em><em> </em><em>alias</em><em> </em><em>it</em><em> </em><em>as</em><em> </em><em>pd</em>

from sklearn.model_selection import train_test_split

<em>#import</em><em> </em><em>the</em><em> </em><em>train_test_split</em><em> </em><em>function</em><em> </em>

housing_df = pd.read_csv('housing price.csv')

<em>#read</em><em> </em><em>in</em><em> </em><em>the</em><em> </em><em>housing</em><em> </em><em>data</em><em> </em>

features_df = df.iloc[:,1:]

<em>#seperate</em><em> </em><em>the</em><em> </em><em>features</em><em> </em><em>from</em><em> </em><em>the</em><em> </em><em>label</em><em> </em><em>;</em>

target_df = df.iloc[:,0]

<em>#put</em><em> </em><em>the</em><em> </em><em>label</em><em> </em><em>into</em><em> </em><em>a</em><em> </em><em>seperate</em><em> </em><em>dataframe</em><em> </em><em>as</em><em> </em><em>well</em><em>.</em><em> </em>

X_train, X_test, Y_train, Y_test = train_test_split(features_df, target_df, test_size = 0.1, random_state = 1)

<em>#uses</em><em> </em><em>tuple</em><em> </em><em>unpacking</em><em> </em><em>to</em><em> </em><em>randomly</em><em> </em><em>assign</em><em> </em><em>the</em><em> </em><em>data</em><em> </em><em>each</em><em> </em><em>of</em><em> </em><em>the</em><em> </em><em>4</em><em> </em><em>variables</em><em>.</em><em> </em>

<em>#</em><em>Test</em><em> </em><em>size</em><em> </em><em>is</em><em> </em><em>test</em><em> </em><em>percent</em><em> </em><em>of</em><em> </em><em>the</em><em> </em><em>entire</em><em> </em><em>dataset</em><em> </em>

Learn more :brainly.com/question/4257657?referrer=searchResults

You might be interested in
The parts of a feature control frame are the tolerance value, the datum references, and the
Elan Coil [88]

Answer:

d

Explanation:

4 0
3 years ago
Explain what a margin of safety is in driving as well as how it can help minimize risk.
Yakvenalex [24]

Answer:

A safety margin is the space left between your vehicle and the next to provide room, time and visibility at every instant

Explanation:

A safety margin is defined as an allowance given between your vehicle and the next vehicle in front to provide enough room, visibility and time to move in a safe manner to prevent the occurrence of an accident at anytime the frontal vehicle suddenly stops or slows down

Safety margins help minimize risks in the following way

1) A common knowledge of safety margins, improves predictability among road users, thereby minimizing the risk traffic accidents caused due to late communication

2) The use of safety margins helps minimize the risk due to a change in driving conditions such as when the road becomes more slippery from being covered with fluid that is being wetted

3) Safety margin can help prevent the occurrence of an accident between vehicles due to failure of a car system, such as a punctured tire or failed breaking system

4) Safety margin helps to protect road users from the introduction of obstacles on the main roads such as ongoing road construction, broken down vehicles, road blockage by vehicles involved in an accident etc

5) Safety margin help protect road users from being involved in an accident due to the loss of driving focus of the driver of the frontal vehicle

6 0
3 years ago
A steel bolt has a modulus of 207 GPa. It holds two rigid plates together at a high temperature under conditions where the creep
VikaD [51]

Answer:

14.36((14MPa) approximately

Explanation:

In this question, we are asked to calculate the stress tightened in a bolt to a stress of 69MPa.

Please check attachment for complete solution and step by step explanation

7 0
3 years ago
In a website browser address bar, what does “www” stand for?
Ludmilka [50]

Answer:

www stands for world wide web

Explanation:

It will really help you thank you.

3 0
3 years ago
Explain by Research how a basic generator works ? using diagram<br>​
natulia [17]
Correcto no se muy bien de que se trata el tema porque está en inglés.
Sorry
8 0
3 years ago
Other questions:
  • Design a stepped-impedance low-pass filter having a cutoff frequency of 3 GHz and a fifth-order 0.5 dB equal-ripple response. As
    9·1 answer
  • A solid steel shaft has to transmit 100 kW at 160 RPM. Taking allowable shear stress at 70 Mpa, find the suitable diameter of th
    15·1 answer
  • At a festival, spherical balloons with a radius of 140.cm are to be inflated with hot air and released. The air at the festival
    10·1 answer
  • A manager who focuses on the employees who enable a company to do business is human resource management. True True False False
    7·1 answer
  • Would you ever date a transgender person??
    8·2 answers
  • 10. Identify one material we Mine and what we make with that material
    6·1 answer
  • An ideal Diesel Cycle has a compression ratio of 18 and a cutoff ratio of 1.5. Determine the maximum air temperature and the rat
    14·1 answer
  • REVVIVE ME MY MOM WALKED IN MY ROOM AND SCARED THE BAJESUS OUTTA ME
    5·2 answers
  • 15. Whether technology is good or bad depends on how it is used.
    7·2 answers
  • What is the law of physics<br><br><br> 10 points if you tell me the answer and your name
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!