:py:mod:`sklearn_pmml_model.base` ================================= .. py:module:: sklearn_pmml_model.base Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: sklearn_pmml_model.base.PMMLBaseEstimator sklearn_pmml_model.base.PMMLBaseClassifier sklearn_pmml_model.base.PMMLBaseRegressor sklearn_pmml_model.base.OneHotEncodingMixin sklearn_pmml_model.base.IntegerEncodingMixin Functions ~~~~~~~~~ .. autoapisummary:: sklearn_pmml_model.base.get_type sklearn_pmml_model.base.findall sklearn_pmml_model.base.parse_array sklearn_pmml_model.base.parse_sparse_array Attributes ~~~~~~~~~~ .. autoapisummary:: sklearn_pmml_model.base.array_regex .. py:data:: array_regex .. py:class:: PMMLBaseEstimator(pmml) Bases: :py:obj:`sklearn.base.BaseEstimator` Base class for estimators, saving basic information on DataFields. :Parameters: **pmml** : str, object Filename or file object containing PMML data. .. !! processed by numpydoc !! .. py:method:: field_mapping() Map field name to a column index and lambda function that converts a value to the proper type. :Returns: { str: (int, callable) } Dictionary mapping column names to tuples with 1) index of the column and 2) type of the column. .. !! processed by numpydoc !! .. py:method:: _get_param_names() :classmethod: Get parameter names for the estimator .. !! processed by numpydoc !! .. py:method:: fields() Return an ordered mapping from field name to XML DataField or DerivedField element. :Returns: OrderedDict { str: eTree.Element } Where keys indicate field names, and values are XML elements. .. !! processed by numpydoc !! .. py:method:: target_field() Return the XML DataField or DerivedField element corresponding to the classification target. :Returns: eTree.Element Representing the target field for classification, or None if no MiningSchema or MiningField specified. .. !! processed by numpydoc !! .. py:method:: fit(x, y) Not supported: PMML models are already fitted. .. !! processed by numpydoc !! .. py:method:: _prepare_data(X) .. py:method:: predict(X, *args, **kwargs) Predict class or regression value for X. This call is preceded with a data preprocessing step, that enables data scaling and categorical feature encoding. For more information on parameters, check out the specific implementation in the scikit-learn subclass. .. !! processed by numpydoc !! .. py:method:: predict_proba(X, *args, **kwargs) Predict class probabilities for X. This call is preceded with a data preprocessing step, that enables data scaling and categorical feature encoding. For more information on parameters, check out the specific implementation in the scikit-learn subclass. .. !! processed by numpydoc !! .. py:function:: get_type(data_field, derives=None) Parse type defined in object and returns it. :Parameters: **data_field** : eTree.Element or XML element that describes a column. **derives** : eTree.Element XML element that the derived field derives. :Returns: callable Type of the value, as a callable function. .. !! processed by numpydoc !! .. py:class:: PMMLBaseClassifier(pmml) Bases: :py:obj:`PMMLBaseEstimator` Base class for classifiers, preparing classes, target fields. :Parameters: **pmml** : str, object Filename or file object containing PMML data. .. !! processed by numpydoc !! .. py:class:: PMMLBaseRegressor(pmml) Bases: :py:obj:`PMMLBaseEstimator` Base class for regressors. :Parameters: **pmml** : str, object Filename or file object containing PMML data. .. !! processed by numpydoc !! .. py:function:: findall(element, path) Safe helper method to find XML elements with guaranteed return type. .. !! processed by numpydoc !! .. py:function:: parse_array(array) Convert or element into list. :Parameters: **array** : eTree.Element (Array or SparseArray) PMML or element, or type-prefixed variant (e.g., ). :Returns: **output** : list Python list containing the items described in the PMML array element. .. !! processed by numpydoc !! .. py:function:: parse_sparse_array(array) Convert element into list. :Parameters: **array** : eTree.Element (SparseArray) PMML element, or type-prefixed variant (e.g., ). :Returns: **output** : list Python list containing the items described in the PMML sparse array element. .. !! processed by numpydoc !! .. py:class:: OneHotEncodingMixin Mixin class to automatically one-hot encode categorical variables. .. !! processed by numpydoc !! .. py:method:: _prepare_data(X) .. py:class:: IntegerEncodingMixin Mixin class to automatically integer encode categorical variables. .. !! processed by numpydoc !! .. py:method:: _prepare_data(X)