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
Products. of sheet metal​
Blababa [14]
Automobiles and Airplanes is what I can think of
3 0
3 years ago
At a certain location, wind is blowing steadily at 7 m/s. Determine the mechanical energy of air per unit mass and the power gen
Kaylis [27]

Answer:

Explanation:

From the information given;

The velocity of the wind blow V = 7 m/s

The diameter of the blades  (d) = 80 m

Percentage of the overall efficiency \eta_{overall} = 30\%

The density of air \rho = 1.25 kg/km^3

Then, we can use the concept of the kinetic energy of the wind blowing to estimate the mechanic energy of air per unit mass by using the formula:

e_{mechanic} = \dfrac{mV^2}{2}

here;

m = \rho AV

= 1.25 \times \dfrac{\pi}{4}(80)^2 \times 7

= 43982.29 kg/s

∴

W = e_{mechanic} = \dfrac{mV^2}{2}

= \dfrac{43982.29 \times 7^2}{2}

= 1077566.105 \ W

\mathbf{ =1077.566 \ kW}

The actual electric power is:

W_{electric} = \eta_{overall} \times W

W_{electric} = 0.3 \times 1077.566

\mathbf{W_{electric} =323.26 \ kW}

8 0
2 years ago
Design a PI controller to improve the steady-state error. The system should operate with a damping ratio of 0.8. Compute the ove
blondinia [14]

Answer:

The MATLAB Code for this PI Controller will be:

Kp = 350;

Ki = 300;

Kd = 50;

C = pid(Kp,Ki,Kd)

T = feedback(C*P,1);

t = 0:0.01:2;

step(T,t)

Explanation:

When you are designing a PID controller for a given system, follow the steps shown below to obtain a desired response.

Obtain an open-loop response and determine what needs to be improved

Add a proportional control to improve the rise time

Add a derivative control to reduce the overshoot

Add an integral control to reduce the steady-state error

Adjust each of the gains $K_p$, $K_i$, and $K_d$ until you obtain a desired overall response.

The further explanation is attached in the Word File.

Download docx
5 0
3 years ago
Which of the following is true regarding screw gauges and shank?
agasfer [191]
correct me if i’m wrong i’m pretty sure it’s B i’ve had the same question
6 0
2 years ago
A circular ceramic plate that can be modeled as a blackbody is being heated by an electrical heater. The plate is 30 cm in diame
MakcuM [25]

Answer:

Heater power = 425 watts

Explanation:

Detailed explanation and calculation is shown in the image below

6 0
3 years ago
Other questions:
  • . A roadway is being designed capable of allowing 70 mph vehicle speed. The superelevation around one curve is 0.05 inches per i
    15·1 answer
  • After a capacitor is fully chargerd, a small amount of current will flow though it. what is this current called?
    14·1 answer
  • Matthew wants to manufacture a large quantity of products with standardized products having less variety. Which type of producti
    5·1 answer
  • Water drains at a constant rate through a saturated soil column with a diameter of 1.5 feet and a height of 3 feet. The hydrauli
    11·1 answer
  • The gas-turbine cycle of a combined gas–steam power plant has a pressure ratio of 8. Air enters the compressor at 290 K and the
    15·1 answer
  • The price of a single item within a group of items is
    8·1 answer
  • A Carnot engine is operated between two heat reservoirs at temperatures of 520 K and 300 K. It receives heat from the 520 K rese
    8·1 answer
  • Digital leaders are people who __ others down a particular path.
    13·2 answers
  • All of these are true about steel EXCEPT that:
    7·1 answer
  • The phase angle in a circuit is 45 degrees what's the power factor of this circuit?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!