Code Logic

I’m trying to understand the code logic in category of “Train-test data split”

The code is:

accuracy = model.score(data_test, target_test)
model_name = model.class.name

My question is this format of code “model.class.name” is belong to specific part of Python rules ? Is there any documentation to understand the logic that why we write in this way ?

Hello @NimaGh,

Here are links to the relevant entries in the Python documentation:

To put it in simple terms, __class__ gives the class to which an instance belongs, and __name__ gives the name of the class as a string.

1 Like