Object Oriented Programming

Created by Chia, Jonathan on Apr 09, 2022

Introduction

Some notes on OOP.

See: https://www.kdnuggets.com/2019/08/object-oriented-programming-data-scientists-estimator.html

Difference between self and other variables

Notice here how output predicted_ gets saved into self.

The difference between X and self is that X is a variable that comes in, whereas self is a variable that is saved and used throughout the whole class. self.predicted_ can be used in other defs

Notice the self.intercept_ and self.coef_. Instead of starting the def with predict(coef_, intercept_, X), I can start the def with just predict(self, X).


Document generated by Confluence on Apr 09, 2022 16:54

Atlassian

Last updated