plqcom.PLQProperty ================== .. py:module:: plqcom.PLQProperty .. autoapi-nested-parse:: PLQProperty: Several functions to check the properties of a PLQ function. .. !! processed by numpydoc !! Functions --------- .. autoapisummary:: plqcom.PLQProperty.is_continuous plqcom.PLQProperty.is_convex plqcom.PLQProperty.check_cutoff plqcom.PLQProperty.find_min plqcom.PLQProperty.plq_to_rehloss Module Contents --------------- .. py:function:: is_continuous(plq_loss) Check whether a PLQ loss function is continuous :Parameters: **plq_loss** : PLQLoss A PLQLoss object :Returns: bool Whether the PLQ function is continuous, True for continuous, False for not continuous .. rubric:: Examples >>> from plqcom import PLQLoss, is_continuous >>> plq_loss = PLQLoss(cutpoints=np.array([0.]),quad_coef={'a': np.array([0, 0]), 'b': np.array([-1, 1]), 'c': np.array([1, 1])}) >>> is_continuous(plq_loss) True .. !! processed by numpydoc !! .. py:function:: is_convex(plq_loss) Check whether a PLQ loss function is convex :Parameters: **plq_loss** : PLQLoss A PLQLoss object :Returns: bool Whether the PLQ function is convex, True for convex, False for not convex .. rubric:: Examples >>> from plqcom import PLQLoss, is_convex >>> plq_loss = PLQLoss(cutpoints=np.array([0.]),quad_coef={'a': np.array([0, 0]), 'b': np.array([-1, 1]), 'c': np.array([1, 1])}) >>> is_convex(plq_loss) True .. !! processed by numpydoc !! .. py:function:: check_cutoff(plq_loss) Check whether there exists a cutoff between the knots, if so, add the cutoff to the knot list and update the coefficients :Parameters: **plq_loss** : PLQLoss A PLQLoss object .. rubric:: Examples >>> from plqcom import PLQLoss, check_cutoff >>> plq_loss = PLQLoss(cutpoints=np.array([0.]),quad_coef={'a': np.array([0, 0]), 'b': np.array([-1, 1]), 'c': np.array([1, 1])}) >>> check_cutoff(plq_loss) >>> plq_loss.cutpoints array([-inf, 0., inf]) .. !! processed by numpydoc !! .. py:function:: find_min(plq_loss) Find the minimum knots and value of the PLQ function, if the minimum value is greater than zero record the minimum value and knot, remove the minimum value from the PLQ function and update the coefficients :Parameters: **plq_loss** : PLQLoss A PLQLoss object .. rubric:: Examples >>> from plqcom import PLQLoss, find_min >>> plq_loss = PLQLoss(cutpoints=np.array([0]),quad_coef={'a': np.array([0, 0]), 'b': np.array([-1, 1]), 'c': np.array([1, 1])}) >>> find_min(plq_loss) >>> plq_loss.min_val 1.0 .. !! processed by numpydoc !! .. py:function:: plq_to_rehloss(plq_loss) convert the PLQLoss function to a ReHLoss function piece by piece. The details are described in the technical details. :Parameters: **plq_loss** : PLQLoss A PLQLoss object :Returns: an object of ReHLoss .. .. rubric:: Examples >>> from plqcom import PLQLoss, plq_to_rehloss >>> plq_loss = PLQLoss(cutpoints=np.array([0]),quad_coef={'a': np.array([0, 0]), 'b': np.array([-1, 1]), 'c': np.array([1, 1])}) >>> reh_loss = plq_to_rehloss(plq_loss) .. !! processed by numpydoc !!