Attributes-Methods

I would like to know the difference between Atributes, methods and parameters.

A parameter is provided during the creating of a python instance. They are passed to the __init__ method indeed. For instance, the parameter C of the LogisticRegression, where the instantiation is done as:

model = LogisticRegression(C=10)

Methods are python functions that are attached to a Python instance. For instance to train a classifier, you need to call the method fit:

model.fit(X, y)

Attributes are the parameters that are attached to a Python instance. For example, when creating model, scikit-learn will create an attribute C:

model.C

In scikit-learn, we have a convention to distinguish attributes created at the initialization (when __init__ is called) from the fitted attributes (attributes created after calling the method fit). The fitted attributed finish with an underscore (_). For instance, coef_ for LogisticRegression is an attribute available only after calling fit:

model.fit(X, y)
model.coef_

Thanks!!!