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
Ice dams are most directly related to:
musickatia [10]

Answer:

(B) heated air in an uninsulated, unvented attic.

Explanation:

-Ice dams are formed by an interaction between snow cover, outside temperatures, and heat lost through the roof – more specifically, from heat loss through the poorly insulated ceiling of the house into the attic area and under the roof.

-Hot, humid air trapped in attics can also cause moisture to accumulate, resulting in mold or mildew.

7 0
3 years ago
The Clean Air Act Amendments of 1990 prohibit service-related releases of all ________.
ozzi

Answer:

D) Refrigerants.

Explanation:

Refrigerants refers to any chemical substance that undergoes a phase change (liquid and gas) so as to enable the cooling and freezing of materials. They are typically used in air conditioners, refrigerators, water dispensers, etc.

In the United States of America, the agency which was established by US Congress and saddled with the responsibility of overseeing all aspects of pollution, environmental clean up, pesticide use, contamination, and hazardous waste spills is the Environmental Protection Agency (EPA). Also, EPA research solutions, policy development, and enforcement of regulations through the resource Conservation and Recovery Act .

The Clean Air Act Amendments of 1990 prohibit service-related releases of all refrigerants such as R-12 and R-134a. This ban became effective on the 1st of January, 1993.

3 0
3 years ago
1. A turbine in a steam power plant operates isentropically with an inlet pressure (P3) of 3.5 MPa and inlet temperature (T3) of
sergey [27]

Answer:

See attached picture.

Explanation:

See attached picture for explanation.

4 0
3 years ago
An automobile having a mass of 1100 kg initially moves along a level highway at 120 km/h relative to the highway. It then climbs
soldier1979 [14.2K]

Answer:

-6111.11\ \text{kJ}

863.28\ \text{kJ}

Explanation:

m = Mass of automobile = 1100 kg

v = Velocity of car = 120 km/h = \dfrac{120}{3.6}\ \text{m/s}

h = Height of hill = 80 m

g = Acceleration due to gravity = 9.81\ \text{m/s}^2

Change in kinetic energy

KE=\dfrac{1}{2}m(u^2-v^2)\\\Rightarrow KE=\dfrac{1}{2}\times 1100\times (0-(\dfrac{120}{3.6})^2)\\\Rightarrow KE=-611111.11\ \text{J}

Change in kinetic energy is -6111.11\ \text{kJ}

Change in potential energy is given by

PE=mgh\\\Rightarrow PE=1100\times 9.81\times 80\\\Rightarrow PE=863280\ \text{J}

The change in potential energy is 863.28\ \text{kJ}.

8 0
3 years ago
Which of these physical concepts is most important in civil engineering? A. energy transformations B. motion under gravity C. he
melamori03 [73]

Answer:

energy transformations

7 0
3 years ago
Other questions:
  • You have just finished your OST takeoffs for a single-story home and found 175 LF of interior walls with 2x6 studs 14" OC. The h
    14·1 answer
  • What is the main advantage of climb milling over conventional milling operations?
    12·1 answer
  • How does gravity affect your vehicle?
    10·1 answer
  • An automobile travels along a straight road at 15.65 m/s through a 11.18 m/s speed zone. A police car observed the automobile. A
    9·1 answer
  • Convert 86.1 cm to inches​
    7·1 answer
  • There are three MUXes in the EX stage. Among them, the 2 MUXes located at the top is meant to provide correct ALU source data 1
    13·1 answer
  • Two kilograms of air in a piston-cylinder assembly undergoes an isothermal
    11·1 answer
  • One of the flaws in the engineers' reasoning for galloping gertie's design was that they attributed prior failures of suspension
    12·1 answer
  • 5√1024/4√1296+3√56/3√2401-4√16/3
    6·1 answer
  • 9. A piece of Cherry wood is 5/4 x 4" X 4'<br> What is the length in inches?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!