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]
2 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]2 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 Clausius inequality expresses which of the following laws? i. Law of Conservation of Mass ii. Law of Conservation of Energy
DanielleElmas [232]

Answer:

(iv) second law of thermodynamics

Explanation:

The Clausius  inequality expresses the second law of thermodynamics it applies to the real engine cycle.It is defined as the cycle integral of change in entropy of a reversible system is zero. It is nothing but mathematical form of second law of thermodynamics . It also states that for irreversible process the cyclic integral of change in entropy is less than zero

3 0
3 years ago
A hydraulic cylinder is to be used to move a workpiece in a manufacturing operation through a distance of 50 mm in 10 s. A force
svetlana [45]

Answer:

The answer to this question is 1273885.3 ∅

Explanation:

<em>The first step is to determine the required  hydraulic flow rate liquid if working pressure and  if a cylinder with a piston diameter of 100 mm is available.</em>

<em>Given that,</em>

<em>The distance = 50mm</em>

<em>The time t =10 seconds</em>

<em>The force F = 10kN</em>

<em>The piston diameter is = 100mm</em>

<em>The pressure = F/A</em>

<em> 10 * 10^3/Δ/Δ </em>

<em> P = 1273885.3503 pa</em>

<em>Then</em>

<em>Power = work/time  = Force * distance /time</em>

<em> = 10 * 1000 * 0.050/10</em>

<em>which is  =50 watt</em>

<em>Power =∅ΔP</em>

<em>50 = 1273885.3 ∅</em>

5 0
3 years ago
It is given that 50 kg/sec of air at 288.2k is iesntropically compressed from 1 to 12 atm. Assuming a calorically perfect gas, d
denis23 [38]

The exit temperature is 586.18K and  compressor input power is 14973.53kW

Data;

  • Mass = 50kg/s
  • T = 288.2K
  • P1 = 1atm
  • P2 = 12 atm

<h3>Exit Temperature </h3>

The exit temperature of the gas can be calculated isentropically as

\frac{T_2}{T_1} = (\frac{P_2}{P_1})^\frac{y-1}{y}\\ y = 1.4\\ C_p= 1.005 Kj/kg.K\\

Let's substitute the values into the formula

\frac{T_2}{T_1} = (\frac{P_2}{P_1})^\frac{y-1}{y} \\\frac{T_2}{288.2} = (\frac{12}{1})^\frac{1.4-1}{1.4} \\ T_2 = 586.18K

The exit temperature is 586.18K

<h3>The Compressor input power</h3>

The compressor input power is calculated as

P= mC_p(T_2-T_1)\\P = 50*1.005*(586.18-288.2)\\P= 14973.53kW

The compressor input power is 14973.53kW

Learn more on exit temperature and compressor input power here;

brainly.com/question/16699941

brainly.com/question/10121263

6 0
2 years ago
A study of online dating found that when including emoticons in their profiles, response rates for female users _______ by _____
Dvinal [7]

Answer:

Increased, 5%

Explanation:

Recent studies conducted on online dating sites established that the response of female users increased by 5% when emotions are in their profiles even as for male users' response also increased by 8%. Another study also revealed that those who have never used online dating sites and/or mobile dating apps believe that people who use dating apps are desperate.

8 0
2 years ago
Consider the diffusion of water vapor through a polypropylene (PP) sheet 1 mm thick. The pressures of H2O at the two faces are 3
Neko [114]

Answer:

\boxed{0.000000266 \frac {cm^{3}.STP}{cm^{2}.s}}

Explanation:

Diffusion flux of a gas, J is given by

J=P_m\frac {\triangle P}{\triangle x} where P_m is permeability coefficient, \triangle P is pressure difference and x is thickness of membrane.

The pressure difference will be 10,000 Pa- 3000 Pa= 7000 Pa

At 298 K, the permeability coefficient of water vapour through polypropylene sheet is 38\times 10^{-13}(cm^{3}. STP)(cm)/(cm^{2}.s.Pa)

Since the thickness of sheet is given as 1mm= 0.1 cm then

J=38\times 10^{-13}(cm^{3}. STP)(cm)/(cm^{2}.s.Pa)\times \frac {7000 pa}{0.1cm}=0.000000266 \frac {cm^{3}.STP}{cm^{2}.s}

Therefore, the diffusion flux is \boxed{0.000000266 \frac {cm^{3}.STP}{cm^{2}.s}}

7 0
2 years ago
Other questions:
  • A hanging wire made of an alloy of nickel with diameter 0.19 cm is initially 2.8 m long. When a 59 kg mass is hung from it, the
    15·1 answer
  • A copper wire of original diameter .80 m exhibits a maximum tensile load/ strength at an engineering stress= 248.2 mpa. its duct
    11·1 answer
  • g A 30-m-diameter sedimentation basin has an average water depth of 3.0 m. It is treating 0.3 m3/s wastewater flow. Compute over
    8·1 answer
  • A compound machine contains three simple machines with IMAs of 2, 4 and 5, respectively. What is the overall ideal mechanical ad
    15·1 answer
  • What is a business cycle? a period of economic growth followed by economic contraction the amount of time it takes a business to
    13·2 answers
  • Determine the minimum required wire radius assuming a factor of safety of 3 and a yield strength of 1500 MPa.
    15·1 answer
  • What would happen if the brake pedal was released while the bleed screw was open during brake bleeding?
    7·1 answer
  • Stress that acts in the plane of a cut section, rather than at right angles to the section is called:_______
    6·1 answer
  • You are coming to this intersection, and are planning on turningright. There is a vehicle close behind you. You should?
    15·1 answer
  • the left rear brake drum is scored, but the right rear drum looks as good as new. technician a says the left-side drum should be
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!