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
A natural-draft cooling tower receives 250,000 ft3/min of air at standard atmospheric pressure, 70oF, and 45 percent relative hu
notsponge [240]

Find the attachment for complete solution

5 0
3 years ago
A Pelton wheel is supplied with water from a lake at an elevation H above the turbine. The penstock that supplies the water to t
gayaneshka [121]

Answer:

Following are the proving to this question:

Explanation:

\frac{D_1}{D} = \frac{1}{(2f(\frac{l}{D}))^{\frac{1}{4}}}

using the energy equation for entry and exit value :

\to \frac{p_o}{y} +\frac{V^{2}_{o}}{2g}+Z_0  = \frac{p_1}{y} +\frac{V^{2}_{1}}{2g}+Z_1+ f \frac{l}{D}\frac{V^{2}}{2g}

where

\to p_0=p_1=0\\\\\to Z_0=Z_1=H\\\\\to v_0=0\\\\AV =A_1V_1 \\\\\to V=(\frac{D_1}{D})^2 V_1\\\\\to V^2=(\frac{D_1}{D})^4 V^{2}_{1}

         = (\frac{1}{(2f (\frac{l}{D} ))^{\frac{1}{4}}})^4\  V^{2}_{1}\\\\

         = \frac{1}{(2f (\frac{l}{D})  )} \  V^{2}_{1}\\

\to \frac{p_o}{y} +\frac{V^{2}_{o}}{2g}+Z_0  =\frac{p_1}{y} +\frac{V^{2}_{1}}{2g}+Z_1+ f \frac{l}{D}\frac{V^{2}}{2g} \\\\

\to 0+0+Z_0 = 0  +\frac{V^{2}_{1} }{2g} +Z_1+ f \frac{l}{D} \frac{\frac{1}{(2f(\frac{l}{D}))}\ V^{2}_{1}}{2g}   \\\\\to Z_0 -Z_1 = +\frac{V^{2}_{1}}{2g} \ (1+f\frac{l}{D}\frac{1}{(2f(\frac{l}{D}) )} )  \\\\\to H= \frac{V^{2}_{1}}{2g} (\frac{3}{2}) \\\\\to  \frac{V^{2}_{1}}{2g} = H(\frac{3}{2})

L.H.S = R.H.S

7 0
3 years ago
Brainliest need help
insens350 [35]

Answer:

answer c

Explanation:

4 0
2 years ago
What is the formula for measuring the speed of an object
STALIN [3.7K]
S= d/t
Speed= distance/time
8 0
3 years ago
Determine the hydraulic radius for the following rectangular open channel width =23m water depth =3m
Romashka-Z-Leto [24]

Answer:

2.379m

Explanation:

The width = 23m

The depth = 3m

The radius is denoted as R

The wetted area is = A

The perimeter perimeter = P

Hydraulic radius

R = A/P

The area of a rectangular channel

= Width multiplied by Depth

A = 23x3

A = 69m²

Perimeter = (2x3)+23

P = 6+23

P= 29

Hydraulic radius R = 69/29

= 2.379m

This answers the question

Thank you!

8 0
3 years ago
Other questions:
  • A bar of 75 mm diameter is reduced to 73mm by a cutting tool while cutting orthogonally. If the mean length of the cut chip is 7
    10·1 answer
  • The air contained in a room loses heat to the surroundings at a rate of 60 kJ/min while work is supplied to the room by computer
    7·2 answers
  • 1. What is an op-amp? List the characteristics of an ideal op-amp
    11·1 answer
  • Two mass streams of the same ideal gas are mixed in a steady-flow chamber while receiving energy by heat transfer from the surro
    11·1 answer
  • The velocity of a point mass that moves along the s-axis is given by s' = 40 - 3t^2 m/s, where t is in seconds. Find displacemen
    7·1 answer
  • A 50 mol% mixture of propane (1) and n-butane (2) enters an isothermal flash drum at 37°C. If the flash drum is maintained at 0.
    12·1 answer
  • Question 3. Assign boston_under_10 and manila_under_10 to the percentage of rides that are less than 10 minutes in their respect
    14·1 answer
  • What is the line called that has the red arrow pointing to it in the attached picture?
    6·1 answer
  • Everyone has only one learning style. True or false? hurry pleasle this exp carees class
    11·1 answer
  • Airbags may deploy in the<br> of the passenger or<br> driver, or from the<br> of the vehicle.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!