11. Project Setup Flashcards
In a class, what is the meaning of a variable name prefixed with anunderscore(e.g._spam)?
the attribute or the method is intended to be private
Why do we use the name instance variables?
their values characterize an instance of the class, not the class itself
According to the “Data Science Pyramid of Needs”, most of the needs consists of building and training models?
False:
gathering, storing, cleaning data
What definesbehaviorandstatein a Python class?
The set of instance methods defines behavior.
The set of instance variables defines the state
What is the typical structure of a data science folder?
- folder with the notebooks
- data folder with data sources
- package with data processing logic
What is the limitation of arelative importfor a module?
- It depends where you run your notebook
- You cannot easily do a relative import from parent folders
What’s the difference between aclass methodand aninstance method?
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.
What doesOOPstand for?
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())
What’s the class constructor method name in Python?
__init__is a reserved method in Python classes. It is known as aconstructorin object oriented concepts.
When changing code in an external package, how can you avoid restarting your Jupyter Notebook kernel?
Use the IPythonautoreloadextension
How would you define aclass?
A class is just a template for building instances which share common attributes.
What sits at the bottom of the “Data Science Pyramid of Needs”?
data collection