100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

Data Preprocessing and Regressions(Machine Learning) test questions and answers 2024

Rating
-
Sold
-
Pages
14
Grade
A+
Uploaded on
15-11-2024
Written in
2024/2025

Data Preprocessing and Regressions(Machine Learning) test questions and answers 2024

Institution
Data Mining
Course
Data Mining









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Data Mining
Course
Data Mining

Document information

Uploaded on
November 15, 2024
Number of pages
14
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

Data Preprocessing and
Regressions(Machine Learning)
test questions and answers
2024
Numpy package
Allows us to work with arrays
matplotlib package
Allows to make charts and graphs
pandas package
imports and manipulates data
How do you import a csv dataset file
pd.read_csv(~~~~~~~~~~~.csv)
How do you split a dataset up into different variables, with specific rows
and columns
x=dataset.iloc[rows,columns].values
y=dataset.iloc[rows,columns].values
What does iloc do?
locates the columns/rows by its index
What does SimpleInputer from sklearn do?
Find missing values of a variable, and assign it to the mean of the other
values of that variable
What is the code to replace missing values of a dataset from columns 1
and 2 using imputer?
from sklearn.impute import SimpleInputer
imputer=SimpleInputer(missing_values=np.nan,strategy='mean')
imputer.fit(x.iloc[:,1:3]
x.iloc[:,1:3]=imputer.transform(x.iloc[:,1:3])
Why should you never assign 1,2,3,.... to a categorical variable whose
values range is not a boolean?

, The machine might think that there is a pattern. The alternative way is to
use onehotencoding
When encoding categorical data, when should you use np.array and
ColumnTransformer package from sklearn?
When your variable has more than one category ***You never use this for
LabelEncoder
What are all of the sklearn packages to use when doing categorical data
encoding?
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OneHotEncoder
from sklearn.preprocessing import LabelEncoder
How would you use ColumnTransformer to encode the 1st index of variable
x using OneHotEncoder?
ct=ColumnTransformer(transformers=[('encoding', OneHotEncoding,[0])],
remainder='passthrough')

x=np.array(ct.fit_transform(x))
How would you use ColumnTransformer to encode the 1st index of variable
y using LabelEncoder?
ct=ColumnTransformer(transformers=[('encoding', LabelEncoder(), [0])],
remainder='passthrough')

y=np.array(ct.fit_transform(y))
Why is the idea of training and testing data and why do we do it?
It is a method to measure the accuracy of your model. The dataset is split
randomely from a 80:20 ratio. The trained data is the 80 and that is what
the machine learns. The test is what the machine tests based on what is
learned with the trained data. If the test and trained are similar, that
means the fit of the model is good, otherwise it is not
How do you use sklearn to declare trained and test for 2 variables using
train_test_split?
from sklearn.model_selection import train_test_split

x_train, x_test, y_train, y_test= train_test_split(x,y,test_size=0.2,
random_state=#)
Should you do feature scaling before or after train/test?
After doing train/test

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
BRAINBOOSTERS Chamberlain College Of Nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
648
Member since
2 year
Number of followers
250
Documents
22594
Last sold
2 days ago

In this page you will find all documents , flashcards and package deals offered by seller BRAINBOOSTERS

4.5

340 reviews

5
264
4
30
3
21
2
5
1
20

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions