r"""Get parameter names for the estimator
(cls)
| 902 | |
| 903 | @classmethod |
| 904 | def _get_param_names(cls): |
| 905 | r"""Get parameter names for the estimator""" |
| 906 | |
| 907 | # fetch the constructor or the original constructor before |
| 908 | # deprecation wrapping if any |
| 909 | init = getattr(cls.__init__, "deprecated_original", cls.__init__) |
| 910 | if init is object.__init__: |
| 911 | # No explicit constructor to introspect |
| 912 | return [] |
| 913 | |
| 914 | # introspect the constructor arguments to find the model parameters |
| 915 | # to represent |
| 916 | init_signature = signature(init) |
| 917 | # Consider the constructor parameters excluding 'self' |
| 918 | parameters = [ |
| 919 | p |
| 920 | for p in init_signature.parameters.values() |
| 921 | if p.name != "self" and p.kind != p.VAR_KEYWORD |
| 922 | ] |
| 923 | for p in parameters: |
| 924 | if p.kind == p.VAR_POSITIONAL: |
| 925 | raise RuntimeError( |
| 926 | "POT estimators should always " |
| 927 | "specify their parameters in the signature" |
| 928 | " of their __init__ (no varargs)." |
| 929 | " %s with constructor %s doesn't " |
| 930 | " follow this convention." % (cls, init_signature) |
| 931 | ) |
| 932 | # Extract and sort argument names excluding 'self' |
| 933 | return sorted([p.name for p in parameters]) |
| 934 | |
| 935 | def get_params(self, deep=True): |
| 936 | r"""Get parameters for this estimator. |
no outgoing calls