np.nan_to_num replaces NaN's with zeros. If you want to take into account the fact that you are normalizing over less entries, you need to do
normalize(np.nan_to_num(X)) * np.sqrt(np.isnan(X).sum(0) / float(X.shape[0])) On Mon, Jun 15, 2015 at 5:28 PM, Andreas Mueller <t3k...@gmail.com> wrote: > Hey. > Not with scikit-learn but it should be about three lines in numpy to do it > yourself. > I would replace them with 0 for computing the norm, that is all there is, > right? > > Andy > > > On 06/15/2015 10:43 AM, William Correa beltran wrote: > > Hello, > > I would like to know if there is a way to normalize a numpy array using > the preprocessing.normalize function when some of the values are of type > nan. I prefer not to imput then, just to ignore them at the normalize > process. > > Thanks in advance, > William Correa > > > ------------------------------------------------------------------------------ > > > > _______________________________________________ > Scikit-learn-general mailing > listScikit-learn-general@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/scikit-learn-general > > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Scikit-learn-general mailing list > Scikit-learn-general@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/scikit-learn-general > >
------------------------------------------------------------------------------
_______________________________________________ Scikit-learn-general mailing list Scikit-learn-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/scikit-learn-general