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
List one advantage and one disadvantage of the use of the commutator?
Mariulka [41]

Answer and  Explanation:

Commutator are used in DC machine commutator is mainly used for the reversing the direction of the current .It is connected to the armature of the DC generator or motor

ADVANTAGE OF COMMUTATOR The main advantage of the commutator in DC motor is to keep keep the direction of the toque always in the same direction by changing the current direction

DISADVANTAGE OF COMMUTATOR : The main disadvantage is due to the friction between the commutator and brushes there is a friction loss.

3 0
3 years ago
If you get a flat in the front of your car, your car will:
juin [17]

Answer:

stop and might even crash

Explanation:

6 0
2 years ago
Kinetic energy is defined as energy of an object in:
Murrr4er [49]

your answer is c. motion

5 0
3 years ago
Read 2 more answers
Briefly describe the function of the thermostatic expansion valve in a vapour compression refrigeration system
dalvyx [7]

Answer:

Explanation:

Thermostatic expansion valve is mainly a throttling device commonly used in air conditioning systems and refrigerators.

It is an automatic valve that maintains proper flow of refrigerant in the evaporator according to  the load inside the evaporator. When the load in the evaporator is higher the valve opens and  allows the increase in flow of refrigerant and when the load reduces the valve closes a bit and  reduces the flow of refrigerant. This process leads to higher efficiency of compressor as well as the whole refrigeration system.  Thus TEV works to reduce the pressure of refrigerant from higher condenser pressure to the lower evaporator pressure. It also keeps the evaporator active.      

4 0
3 years ago
The regulated voltage of an alternator is stated as 13.6 to 14.6 volts at 3000 rpm with the
lions [1.4K]

Answer:

  d)  1 volt​

Explanation:

The allowable range is 1 volt​. The allowed tolerance (deviation from nominal) depends on what the nominal voltage is.

5 0
3 years ago
Other questions:
  • Calculate the availability of a system where the mean time between failures is 900 hours and the mean time to repair is 100 hour
    15·1 answer
  • Define initial set and final set. Briefly discuss one method used to determine them. The following laboratory tests are performe
    12·1 answer
  • 21. How long can food that requires time-temperature control be left in the danger zone?
    7·2 answers
  • 1000 lb boulder B is resting on a 500 lb platform A when truck C accidentally accelerates to the right (truck in reverse). Which
    15·1 answer
  • Traditional password entry schemes are susceptible to "shoulder surfing" in which an attacker watches an unsuspecting user enter
    13·1 answer
  • Write a program that uses while loops to perform the following steps: Step a: Prompt the user to input two integers: firstNum an
    12·1 answer
  • ... is an actual sequence of interactions (i.e., an instance) describing one specific situation; a ... is a general sequence of
    9·1 answer
  • How many 3-digits numbers which are greater than 300 can be formed from 6
    12·1 answer
  • Differentiate between isohyetal method and arithmetical average method of rainfall​
    10·1 answer
  • PLZZZZZ HELP
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!