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
Turn the motor around in the circuit. What happens?
kenny6666 [7]

Answer:

It will create a massive drag and pretty much stop the motor.

Explanation:

7 0
3 years ago
A refrigerator operating on the Carnot cycle is used to make ice. Water freezing at 32oF is the cold reservoir. Heat is rejected
Mnenie [13.5K]

Answer:

Explanation:

From the given information:

Water freezing temp. T_L = 32 ^0 \ F

Heat rejected temp T_H = 72 ^0 \ F

Recall that:

The coefficient of performance is:

COP_{ref} = \dfrac{T_L}{T_H - T_L} \\ \\  = \dfrac{32+460}{(72 +460) -(32+460)} \\ \\ =\dfrac{492}{532 -492} \\ \\ = \dfrac{492}{40} \\ \\ COP_{ref} = 12.3

Again:

The efficiency given by COP can be represented by:

COP = \dfrac{Q_L}{W} \\ \\ W = \dfrac{Q_L}{COP} \\ \\ W = \dfrac{2000 \ lbm \times 144 \ Btu/lbm}{12.3} \\ \\ W = 23414.63 \ Btu

Finally; the power input in an hour can be determined by using the formula:

Power= \dfrac{W}{t} \\ \\  Power = \dfrac{23414.63 \ Btu}{ 1 \ hr} \\ \\  Power = \dfrac{23414.634 \times 1055.056 \ J}{1 \times 3600} \\ \\  Power  = 6.86 \ kW

In hp; since 1 kW = 1.34102 hp

6.86kW will be = (6.86 × 1.34102) hp

= 9.199 hp

7 0
3 years ago
What is required when setting up a smart phone as a WIFI hotspot?
emmainna [20.7K]
How to create a personal hot spot on an iPhone?

Go to Settings | Cellular | Personal Hotspot.

Tap the slider next to Allow Others to Join. ...

Your Wi-Fi Password will be shown right underneath the Allow Others to Join option. ...

Now, on another device, such as a laptop, go to the Wi-Fi section and search for nearby networks.
5 0
3 years ago
The Hoover Dam is 221 m tall and 379 m wide. Approximating it as a flat plate, determine the effective resultant force on the da
IrinaVladis [17]

Answer:

2165800 Pa

Explanation:

See it in the pic.

3 0
3 years ago
Mark each one as either Potential or Kinetic Energy?
never [62]
A- kinety
b- potential
3 0
3 years ago
Other questions:
  • A mass of 8000 kg of slightly enriched uranium (2% U-235, 98% U-238) is exposed for 30 days in a reactor operating at (6.18) hea
    5·1 answer
  • Two technicians are discussing solder wire repair. Technician A says that electrical tape can be used to cover the joint. Techni
    10·1 answer
  • In a heat-treating process, a 1-kg metal part, initially at 1075 K, is quenched in a closed tank containing 100 kg of water, ini
    10·1 answer
  • A thick oak wall (rho = 545 kg/m3 , Cp = 2385 J/kgK, and k = 0.17 W/mK) initially at 25°C is suddenly exposed to combustion prod
    11·1 answer
  • Air at 2.5 bar, 400 K is extracted from a main jet engine compressor for cabin cooling. The extracted air enters a heat exchange
    14·2 answers
  • Cite another example of information technology companies pushing the boundaries of privacy issues; apologizing, and then pushing
    9·1 answer
  • Can someone please help me this is urgent!?
    12·2 answers
  • How many millimeters are there in a centimeter?
    10·1 answer
  • Evaluate, please show work as I don't understand. thanks
    5·1 answer
  • The product of two factors is 4,500. If one of the factors is 90, which is the other factor?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!