Item = Ĭopied from comment for improved formatting: /python3.5/site-packages/sklearn/linear_model/logistic.py", line 1173, inįile "/python3.5/site-packages/sklearn/utils/validation.py", line 521, inĬheck_X_y ensure_min_features, warn_on_dtype, estimator)įile "/lib/python3.5/site-packages/sklearn/utils/validation.py", line 382, inĬheck_array array = np. array(array, dtypedtype, orderorder, copycopy) 374 375 if ensure2d: ValueError: setting an array element with a sequence. Heartrate = np.array(list(filter(lambda x: x is not None, streams.data)))įixed_heartrate = np.pad(heartrate, (0, 15000 - len(heartrate)), 'constant') Neighbourhood: square (choose size), disk, or more complicated structuring element. The shape of my input x is (7165 x 529) and due to reshaping errors, I added an extra column with zeroes to make it (7165 x 530) and shape of y is (7165. Creating a numpy array from an image file: > from scipy import misc. I am trying to implement Quantum Kernel Ridge Regression (replacing the classical kernel with quantum kernel) in qiskit. 1 Answer Sorted by: 1 So, you pass sequences into KMeans (like 8, 1) and that's why it does not work. Streams = self.strava_client.get_activity_streams(activity_id=act.id, types=) You have this error because your data is not formatted correctly when you call the fit method. ValueError: setting an array element with a sequence for scikit learn. From reading other questions regarding this issue: ValueError: setting an array element with a sequence, it's either due to wrong structure of my data or because my data is of type string. I am using the preprocessing module to prep my data. Here are some code snip-its to help sleuth out the problem: def get_training_set(self):Īfter_date = datetime.utcnow() - timedelta(weeks=8)īefore_date = datetime.utcnow() - timedelta(hours=12)Īctivities = self.strava_client.get_activities(after=after_date, before=before_date) I'm trying to use scikit-learn to do some ML. I suspect that my arrays aren't contiguous in memory and that's what's posing the problem but not sure. It's getting the value error in sklearn/utils/validation.py line 382, in check_array on the line where a copy of the dataframe is done via array = np.array(array, dtype=dtype, order=order, copy=copy). Based on researching others who've also faced this error I've made sure the heartrate arrays are all the same shape/size. I'm attempting to do classification via Logistic Regression using scikit-learn where the X is Intercept and one field that is an array of heartrate data called heartrate.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |