0
votes

Can anyone give me a little explanation on how sklearn stores a classifier in memory ? I wonder if it stores a function or a big matrix with the patterns and the labels or some other representation.

1
This is documented, for each estimator, in the Attributes section of its docstring. - Fred Foo

1 Answers

0
votes

What is it specific in sklearn that you want to know? Storing a classifier, or a regression model, or any other machine learning model, means that you need to store parameters from which you can predict a new given input.

In case of linear models, it can mostly be just the coefficients of the features, as for example you see here.

If the model is a support vector, then it would be a set of support vectors, so it is a matrix. Depending on the model, what you need to store changes.

But I'm not sure what you mean by storing a function. Any function is something which gets an input, does some calculations on the input, and returns an output. What you need to store in this case, would be those coefficients or parameters that the function is using. You can not have a function out of the blue, and store it, you always have some parameters in a function which you need to store, to run the function.

So at the end of the day, it would be a bunch of numbers which are being stored.

Not sure if I answered your question, but if you elaborate on it, I might be able to refine my answer.