11. Project Setup Flashcards

1
Q

In a class, what is the meaning of a variable name prefixed with anunderscore(e.g._spam)?

A

the attribute or the method is intended to be private

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why do we use the name instance variables?

A

their values characterize an instance of the class, not the class itself

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

According to the “Data Science Pyramid of Needs”, most of the needs consists of building and training models?

A

False:

gathering, storing, cleaning data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What definesbehaviorandstatein a Python class?

A

The set of instance methods defines behavior.

The set of instance variables defines the state

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the typical structure of a data science folder?

A
  1. folder with the notebooks
  2. data folder with data sources
  3. package with data processing logic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the limitation of arelative importfor a module?

A
  • It depends where you run your notebook

- You cannot easily do a relative import from parent folders

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What’s the difference between aclass methodand aninstance method?

A

Aninstance methodtakes a first parameter,self, which points to an instance ofMyClasswhen the method is called.

Instead of accepting aselfparameter,class methodstake aclsparameter that points to the class - and not the object instance - when the method is called.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What doesOOPstand for?

A

OOPmeansObject-Oriented Programming, and it’s a paradigm based on a concept of objects which are composed of attributes (for storing data associated to the object - e.g.kevin.age) and its behavior, coded in the object’smethods(e.g.kevin.say())

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What’s the class constructor method name in Python?

A

__init__is a reserved method in Python classes. It is known as aconstructorin object oriented concepts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When changing code in an external package, how can you avoid restarting your Jupyter Notebook kernel?

A

Use the IPythonautoreloadextension

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How would you define aclass?

A

A class is just a template for building instances which share common attributes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What sits at the bottom of the “Data Science Pyramid of Needs”?

A

data collection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly