You are misreading the original example. `init_network` is defined as a method on the class, and called in its initializer. There is no property named "init_network".
On Mon, Jun 29, 2020 at 1:18 PM joseph pareti <joeparet...@gmail.com> wrote: > I have piece of code with constructs as follows: > > *class* *SentimentNetwork**:* > > *def* __init__*(*self*,* reviews*,* labels*,* hidden_nodes *=* 10*,* > learning_rate *=* 0.1*):* > > > > np*.*random*.*seed*(*1*)* > > > > self*.*init_network*(**len**(*self*.*review_vocab*),*hidden_nodes*,* > 1*,* learning_rate*)* > > > > > > > > *def* init_network*(*self*,* input_nodes*,* hidden_nodes*,* > output_nodes > *,* learning_rate*):* > > # Store the number of nodes in input, hidden, and output layers. > > self*.*input_nodes *=* input_nodes > > self*.*hidden_nodes *=* hidden_nodes > > self*.*output_nodes *=* output_nodes > > which makes me think about the redundant usage of* init_network:* > > 1. as a method, AND > 2. as a property > > So far I have only seen codes where the 2 things are separated, e.g. : > > *import* insurance *as* ins > > *class* *Vehicle**:* > > *def* __init__*(*self*,* speed*,* make*):* > > self*.*speed *=* speed > > self*.*make *=* make > > *class* *car**(*Vehicle*):* > > *def* __init__*(*self*,* speed*,* make*):* > > Vehicle*.*__init__*(*self*,* speed*,* make*)* > > self*.*insurance *=* ins*.*calc*(*make*)* > > *def* show_out*(*self*):* > > *print**(*'vehicle is '*,*self*.*make*,*' insurance premium > '*,*self > *.*insurance*)* > > *def* claim*(*self*,* discount*):* > > X *=* self*.*insurance *+* discount > > *return* X > > > And hence I am not sure about the behavior of the first code in this email. > -- > Regards, > Joseph Pareti - Artificial Intelligence consultant > Joseph Pareti's AI Consulting Services > https://www.joepareti54-ai.com/ > cell +49 1520 1600 209 > cell +39 339 797 0644 > -- > https://mail.python.org/mailman/listinfo/python-list > > -- CALVIN SPEALMAN SENIOR QUALITY ENGINEER cspea...@redhat.com M: +1.336.210.5107 [image: https://red.ht/sig] <https://red.ht/sig> TRIED. TESTED. TRUSTED. <https://redhat.com/trusted> -- https://mail.python.org/mailman/listinfo/python-list