X-Received: by 10.66.165.39 with SMTP id yv7mr62908770pab.28.1452448535408; Sun, 10 Jan 2016 09:55:35 -0800 (PST) X-Received: by 10.50.114.105 with SMTP id jf9mr187254igb.1.1452448535378; Sun, 10 Jan 2016 09:55:35 -0800 (PST) Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!h5no2667039igh.0!news-out.google.com!l1ni9575igd.0!nntp.google.com!o2no1753954iga.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.python Date: Sun, 10 Jan 2016 09:55:34 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=70.55.121.141; posting-account=SZ_svQkAAACWRFG2bDA-zgq8ILyl4-vo NNTP-Posting-Host: 70.55.121.141 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <4ee5810e-abe9-4c4b-9ebd-d989b5c2b341@googlegroups.com> Subject: What use of these _ prefix members? From: Robert Injection-Date: Sun, 10 Jan 2016 17:55:35 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: csiph.com comp.lang.python:101442 Hi, When I read a sample file from hmm learn package, which is on top of scikit-learn package, I see there are many member functions (prefix with '_') have no caller. That is, I don't see anything uses those functions. Below is a sample part from class GMMHMM(_BaseHMM): ////////// def __init__(self, n_components=1, n_mix=1,........ params="stmcw", init_params="stmcw"): _BaseHMM.__init__(self, n_components,......... params=params, init_params=init_params) # XXX: Hotfit for n_mix that is incompatible with the scikit's # BaseEstimator API self.n_mix = n_mix self.covariance_type = covariance_type self.covars_prior = covars_prior self.gmms_ = [] for x in range(self.n_components): if covariance_type is None: gmm = GMM(n_mix) else: gmm = GMM(n_mix, covariance_type=covariance_type) self.gmms_.append(gmm) def _init(self, X, lengths=None): super(GMMHMM, self)._init(X, lengths=lengths) for g in self.gmms_: g.set_params(init_params=self.init_params, n_iter=0) g.fit(X) def _compute_log_likelihood(self, X): return np.array([g.score(X) for g in self.gmms_]).T def _generate_sample_from_state(self, state, random_state=None): return self.gmms_[state].sample(1, random_state=random_state).flatten() //////////// Some online tutorials tell me '_' prefix is a kind of convention of private members. hmm is not a formal package. Do these '_' member functions are unfinished? Or, they may be used in some way I don't know yet? Thanks,