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
Rope BCA passes through a pulley at point C and supports a crate at point A. Rope segment CD supports the pulley and is attached
djverab [1.8K]

Answer:

363 pounds 32 degrees

Explanation:

Express your answers numerically in pounds and degrees to three significant figures separated by a comma. slader

6 0
3 years ago
Write a function which multiplies the values in odd position values by 10. Odd positions in this case refers to the first value
xxMikexx [17]

Answer:

Using linkedlist on C++, we have the program below.

Explanation:

#include<iostream>

#include<cstdlib>

using namespace std;

//structure of linked list

struct linkedList

{

  int data;

  struct linkedList *next;

};

//print linked list

void printList(struct linkedList *head)

{

  linkedList *t=head;

 

  while(t!=NULL)

  {

      cout<<t->data;

      if(t->next!=NULL)

      cout<<" -> ";

     

      t=t->next;

  }

}

//insert newnode at head of linked List

struct linkedList* insert(struct linkedList *head,int data)

{

  linkedList *newnode=new linkedList;

  newnode->data=data;

  newnode->next=NULL;

 

  if(head==NULL)

  head=newnode;

  else

  {

      struct linkedList *temp=head;

      while(temp->next!=NULL)

      temp=temp->next;

     

      temp->next=newnode;

     

      }

  return head;

}

void multiplyOddPosition(struct linkedList *head)

{

  struct linkedList *temp=head;

  while(temp!=NULL)

  {

      temp->data = temp->data*10; //multiply values at odd position by 10

      temp = temp->next;

      //skip odd position values

      if(temp!= NULL)

      temp = temp->next;

  }

}

int main()

{

  int n,data;

  linkedList *head=NULL;

 

// create linked list

  head=insert(head,20);

  head=insert(head,5);

  head=insert(head,11);

  head=insert(head,17);

  head=insert(head,23);

  head=insert(head,12);

  head=insert(head,4);

  head=insert(head,21);    

 

  cout<<"\nLinked List : ";

  printList(head); //print list

 

  multiplyOddPosition(head);

  cout<<"\nLinked List After Multiply by 10 at odd position : ";

  printList(head); //print list

 

  return 0;

}

5 0
3 years ago
Which of the following sensors is used to provide suspension control module with feedback regarding vehicle cornering​ forces?
Readme [11.4K]

Answer:

A

Explanation:

4 0
3 years ago
In the engineering design process, what do engineers do immediately before
gulaghasi [49]

Answer:

A

Hope this helps!

Explanation:

You need to find what the problem is and what can or can not be done to solve that issue/compete the task

5 0
3 years ago
Esma and hasan are putting the finishing touches on their model for a tiny chip-based energy source to power their lighting syst
Bas_tet [7]

The phase of the engineering design process which should be completed next is to test their work and is denoted as option C.

<h3>What is Engineering design?</h3>

These are the series of steps and techniques which are done by individuals in the making of functional product and services.This employs the use of scientific methods and also ensures an easier living for different individuals.

The first stage involves identifying the problem and then building a prototype through the use of different materials. This is then tested before the final finishing work is done to ensure the parts are properly placed before they are moved for evaluation by other people.

Read more about Engineering design here brainly.com/question/411733

#SPJ1

7 0
2 years ago
Other questions:
  • Next → Fluid Systems: Mastery Test Select the correct answer from each drop-down menu. What type of systems are used in the Indu
    14·1 answer
  • 99 POINTS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    15·2 answers
  • The cubic capacity of a four-stroke over-square spark-ignition engine is 245cc. The over-square ratio is (1.1) The clearance vol
    14·1 answer
  • Mihuv8tr5qwertgyhjzxcvbnfr5y7nnbvcxzwertgyhujio vv solve the riddle
    5·2 answers
  • The efficiency of a transformer is mainly dependent on: a)- Core losses b)- Copper losses c)- Stray losses d)- Dielectric losses
    12·1 answer
  • How is the caliber of a rifle or handgun determined
    9·1 answer
  • You need to lift a 2012 Toyota Highlander and haven't done so in a while. Which of these are reliable sources for checking the c
    10·1 answer
  • Why we use combination of grep with awk, explain with example?
    12·1 answer
  • two cars travel on a straight road from the point. A to point B both cars accelerate to their maximum speed and then continue at
    10·1 answer
  • The alternating current frequency used in the United States is
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!