I'm using Python to write my own machine learning models for practice. There are two ways I can go about it:
For me it makes more sense to go with a class approach as you can save your model as instance of the class and have as class functions something like a
train() to initialize the model and a
predict() method to use your model multiple times without having to retrain it.
Look at the scikit-learn class for Logistic Regression, it makes a lot of sense and is very intuitive.