You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [19]: a.fit(b)
/share/apps/python/2.7.11/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/utils/validation.py:386: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and willraise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample.
DeprecationWarning)
/share/apps/python/2.7.11/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/utils/validation.py:386: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and willraise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample.
DeprecationWarning)
/scratch/mohamed.ayed/python/lib/python2.7/site-packages/pyxmeans/xmeans.pyc in _cluster_variance(cls, num_points, clusters, centroids)
127 denom = float(num_points - len(centroids))
128 for cluster, centroid in zip(clusters, centroids):
--> 129 distances = euclidean_distances(cluster, centroid)
130 s += (distances*distances).sum()
131 return s / denom
/share/apps/python/2.7.11/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/metrics/pairwise.py in euclidean_distances(X, Y, Y_norm_squared, squared, X_norm_squared)
206 paired_distances : distances betweens pairs of elements of X and Y.
207 """
--> 208 X, Y = check_pairwise_arrays(X, Y)
209
210 if X_norm_squared is not None:
/share/apps/python/2.7.11/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/metrics/pairwise.py in check_pairwise_arrays(X, Y, precomputed)
95 else:
96 X = check_array(X, accept_sparse='csr', dtype=dtype)
---> 97 Y = check_array(Y, accept_sparse='csr', dtype=dtype)
98
99 if precomputed:
/share/apps/python/2.7.11/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/utils/validation.py in _assert_all_finite(X)
52 and not np.isfinite(X).all()):
53 raise ValueError("Input contains NaN, infinity"
---> 54 " or a value too large for %r." % X.dtype)
55
56
ValueError: Input contains NaN, infinity or a value too large for dtype('float64').
The text was updated successfully, but these errors were encountered:
I get "ValueError: Input contains NaN, infinity or a value too large for dtype('float64')" when trying to fit the data . Can you please help?
In [17]: b=np.random.random((300, 7000))
In [18]: b
Out[18]:
array([[ 0.32307771, 0.25185051, 0.65950904, ..., 0.07361776,
0.14508455, 0.95536933],
[ 0.73879883, 0.15227882, 0.73709136, ..., 0.46127292,
0.16149633, 0.55478285],
[ 0.33343231, 0.74376996, 0.17680955, ..., 0.17281043,
0.69592014, 0.11823333],
...,
[ 0.12729313, 0.70065767, 0.16744481, ..., 0.97365921,
0.32745413, 0.82913982],
[ 0.57948363, 0.8199712 , 0.40820909, ..., 0.36342576,
0.67581305, 0.80445348],
[ 0.75098905, 0.56323658, 0.91718958, ..., 0.86885992,
0.81540044, 0.38880498]])
In [19]: a.fit(b)
/share/apps/python/2.7.11/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/utils/validation.py:386: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and willraise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample.
DeprecationWarning)
/share/apps/python/2.7.11/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/utils/validation.py:386: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and willraise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample.
DeprecationWarning)
ValueError Traceback (most recent call last)
in ()
----> 1 a.fit(b)
/scratch/mohamed.ayed/python/lib/python2.7/site-packages/pyxmeans/xmeans.pyc in fit(self, data)
65
66 bic_parent = XMeans.bic([points], [centroid,])
---> 67 bic_child = XMeans.bic([cluster1, cluster2], test_model.centroids)
68 logging.info("\t\tbic_parent = %f, bic_child = %f", bic_parent, bic_child)
69 if bic_child > bic_parent:
/scratch/mohamed.ayed/python/lib/python2.7/site-packages/pyxmeans/xmeans.pyc in bic(cls, clusters, centroids)
97 num_dims = clusters[0][0].shape[0]
98
---> 99 log_likelihood = XMeans._loglikelihood(num_points, num_dims, clusters, centroids)
100 num_params = XMeans._free_params(len(clusters), num_dims)
101
/scratch/mohamed.ayed/python/lib/python2.7/site-packages/pyxmeans/xmeans.pyc in _loglikelihood(cls, num_points, num_dims, clusters, centroids)
115 t1 = fRn * np.log(fRn)
116 t2 = fRn * np.log(num_points)
--> 117 variance = XMeans._cluster_variance(num_points, clusters, centroids) or np.nextafter(0, 1)
118 t3 = ((fRn * num_dims) / 2.0) * np.log((2.0 * np.pi) * variance)
119 t4 = (fRn - 1.0) / 2.0
/scratch/mohamed.ayed/python/lib/python2.7/site-packages/pyxmeans/xmeans.pyc in _cluster_variance(cls, num_points, clusters, centroids)
127 denom = float(num_points - len(centroids))
128 for cluster, centroid in zip(clusters, centroids):
--> 129 distances = euclidean_distances(cluster, centroid)
130 s += (distances*distances).sum()
131 return s / denom
/share/apps/python/2.7.11/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/metrics/pairwise.py in euclidean_distances(X, Y, Y_norm_squared, squared, X_norm_squared)
206 paired_distances : distances betweens pairs of elements of X and Y.
207 """
--> 208 X, Y = check_pairwise_arrays(X, Y)
209
210 if X_norm_squared is not None:
/share/apps/python/2.7.11/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/metrics/pairwise.py in check_pairwise_arrays(X, Y, precomputed)
95 else:
96 X = check_array(X, accept_sparse='csr', dtype=dtype)
---> 97 Y = check_array(Y, accept_sparse='csr', dtype=dtype)
98
99 if precomputed:
/share/apps/python/2.7.11/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/utils/validation.py in check_array(array, accept_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)
396 % (array.ndim, estimator_name))
397 if force_all_finite:
--> 398 _assert_all_finite(array)
399
400 shape_repr = _shape_repr(array.shape)
/share/apps/python/2.7.11/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/utils/validation.py in _assert_all_finite(X)
52 and not np.isfinite(X).all()):
53 raise ValueError("Input contains NaN, infinity"
---> 54 " or a value too large for %r." % X.dtype)
55
56
ValueError: Input contains NaN, infinity or a value too large for dtype('float64').
The text was updated successfully, but these errors were encountered: