@@ -92,13 +92,27 @@ class Predictor(ABC):
9292 n_input_features : int
9393 The number of features/dimensions of the cell-state representation the predictor was
9494 trained on. This is used for validation of input data.
95+
96+ d : int or None
97+ The intrinsic dimensionality of the data used to create this predictor.
98+ Only stored to provide appropriate warnings for normalization.
99+
100+ d_method : str or None
101+ The method used to compute the intrinsic dimensionality of the data.
102+ Only stored to provide appropriate warnings for normalization.
95103 """
96104
97105 # number of features of input data (x.shape[1]) to be specified in __init__
98106 n_input_features : int
99107
100108 # number of observations trained on (x.shape[0]) to be specified in __init__
101109 n_obs : int
110+
111+ # intrinsic dimensionality of the data, stored only for warning purposes
112+ d : int = None
113+
114+ # method used to compute the intrinsic dimensionality, stored only for warning purposes
115+ d_method : str = None
102116
103117 # a set of attribute names that should be saved to reconstruct the object
104118 _state_variables : Union [Set , List ]
@@ -210,9 +224,30 @@ def mean(self, x, normalize=False):
210224 )
211225 logger .error (message )
212226 raise ValueError (message )
213- logger .warning (
214- 'The normalization is only effective if the density was trained with d_method="fractal".'
215- )
227+ # Check conditions for warning about normalization
228+ if self .d_method == "fractal" :
229+ # No warning needed for fractal method
230+ pass
231+ elif self .d_method == "manual" :
232+ # For manual d, show info message
233+ logger .info (
234+ f"Using normalization with manually set d={ self .d } . "
235+ "Note: Normalization is most effective when d approximates the intrinsic dimensionality of the data."
236+ )
237+ elif self .d_method is None and isinstance (self .d , (int , float )) and float (self .d ).is_integer ():
238+ # For None d_method with integer d, show warning
239+ logger .warning (
240+ f"The normalization is only effective if d approximates the intrinsic dimensionality. "
241+ f"Current values: d_method={ self .d_method } , d={ self .d } . "
242+ f'Consider using d_method="fractal" for more accurate results.'
243+ )
244+ elif self .d_method == "embedding" :
245+ # For embedding method, show warning
246+ logger .warning (
247+ f"The normalization is only effective if d approximates the intrinsic dimensionality. "
248+ f"Current values: d_method={ self .d_method } , d={ self .d } . "
249+ f'Consider using d_method="fractal" for more accurate results.'
250+ )
216251 return self ._mean (x ) - log (self .n_obs )
217252 else :
218253 return self ._mean (x )
@@ -396,6 +431,8 @@ def __getstate__(self):
396431 {
397432 "n_input_features" : self .n_input_features ,
398433 "n_obs" : self .n_obs ,
434+ "d" : self .d ,
435+ "d_method" : self .d_method ,
399436 "_state_variables" : self ._state_variables ,
400437 }
401438 )
@@ -755,9 +792,30 @@ def mean(self, Xnew, time=None, normalize=False):
755792 )
756793 logger .error (message )
757794 raise ValueError (message )
758- logger .warning (
759- 'The normalization is only effective if the density was trained with d_method="fractal".'
760- )
795+ # Check conditions for warning about normalization
796+ if self .d_method == "fractal" :
797+ # No warning needed for fractal method
798+ pass
799+ elif self .d_method == "manual" :
800+ # For manual d, show info message
801+ logger .info (
802+ f"Using normalization with manually set d={ self .d } . "
803+ "Note: Normalization is most effective when d approximates the intrinsic dimensionality of the data."
804+ )
805+ elif self .d_method is None and isinstance (self .d , (int , float )) and float (self .d ).is_integer ():
806+ # For None d_method with integer d, show warning
807+ logger .warning (
808+ f"The normalization is only effective if d approximates the intrinsic dimensionality. "
809+ f"Current values: d_method={ self .d_method } , d={ self .d } . "
810+ f'Consider using d_method="fractal" for more accurate results.'
811+ )
812+ elif self .d_method == "embedding" :
813+ # For embedding method, show warning
814+ logger .warning (
815+ f"The normalization is only effective if d approximates the intrinsic dimensionality. "
816+ f"Current values: d_method={ self .d_method } , d={ self .d } . "
817+ f'Consider using d_method="fractal" for more accurate results.'
818+ )
761819 return self ._mean (Xnew ) - log (self .n_obs )
762820 else :
763821 return self ._mean (Xnew )
0 commit comments