All Questions
57 questions
0
votes
1
answer
396
views
ValueError: non-broadcastable output operand with shape (291,1) doesn't match the broadcast shape (291,6)
I am creating an LSTM model to predict the traffic volume at certain times during the month. I want to then show the predicted vs true result on a time series graph.
I have managed to create a ...
0
votes
1
answer
39
views
Python Membership Initialisation
I fail to define an array in my InitializeMembershipWeight function. I am currently working on a C-Means clustering algorithm.
#Membership Initialisation
def initializeMembershipWeights():
weight =...
0
votes
2
answers
3k
views
numpy array inhomogeneous shape 2d
training = []
empty_list = [0] *len(classes)
for doc in docs:
bag = []
word_pat = doc[0]
word_pat = [lem.lemmatize((w.lower())) for w in word_pat]
for w in words:
if w in ...
-1
votes
1
answer
242
views
How is my numpy array reshaped in this context PYTHON?
Hi i'm new to machine learning and i'm trying to understand the following code can someone explain to me what is this code doing?
training_set = dataset_train.iloc[:,1:2].values
#print(...
0
votes
1
answer
86
views
ValueError: setting an array element with a sequence in SVM for simple arrays
I am trying to use SVM on my dataset but I am getting the error TypeError: only size-1 arrays can be converted to Python scalars. My inputs are:
y = df['emotion'].values.tolist()
X = df['...
0
votes
2
answers
3k
views
ValueError: y should be a 1d array, got an array of shape () instead
I am trying to make a classifier in Python but I had a value error.
import numpy as np
import matplotlib.pyplot as plt
from sklearn import preprocessing
from sklearn.svm import LinearSVC
from sklearn....
-1
votes
2
answers
503
views
PYTHON3 - How to use List Comprehension with a numpy array, to unpack a tuple of Lists, to avoid running for loop multiple times
In Short ->
How to write this expression correctly?? ->
[(self._mean,self._var,self._priors)] = [ ([X[y==c].mean(axis=0)] , [X[y==c].var(axis=0)],[X[y==c].shape[0] / n_samples ]) for c in self....
0
votes
1
answer
44
views
Numpy Array minimum computation
I'm supposed to create a function that executes the following: I have two datasets U and X filled with vectors. For the dataset X I also have a Labelset Y containing 0 and 1. Now I should calculate ...
0
votes
1
answer
2k
views
XGBOOST: Multiple dimension array as input to model
How would you train a model with a dataset that has 4 matrices per row?
Below is a minimal reproducible example with a (2rows, 4 matrices, 3 X 6 matrix) dataset to train.
import numpy as np
import ...
0
votes
1
answer
615
views
Only size-1 arrays can be converted to Python scalars Scikit Learn
I am trying to use the SGCD model of Scikit Learn but I have an error. I think it's a problem with the shape of my arrays but I don't understand how to solve it.
I did resize my images so that they ...
1
vote
1
answer
53
views
Best way to transform NxD timeseries dataset to (N-T+1)xTxD?
I couldn't come up with a better title unfortunately; I acknowledge that the fact that I couldn't explain it better has likely hindered my ability to search for an already established answer to this.
...
-1
votes
1
answer
334
views
Python ValueError: object of too small depth for desired array
I want to get the direct correlation between each column of X and the target y of my dataframe df. My code raised ValueError: object of too small depth for desired array error.
import numpy as np
...
0
votes
1
answer
80
views
Predictions after modeling: output array [closed]
After fitting a decision tree I want to do some predictions.
How can I make this output predicted array more readable ?
As you can see, the output corresponds to the features' input values but how ...
5
votes
1
answer
2k
views
Read data from numpy array into a pytorch tensor without creating a new tensor
Let's say I have a numpy array arr = np.array([1, 2, 3]) and a pytorch tensor tnsr = torch.zeros(3,)
Is there a way to read the data contained in arr to the tensor tnsr, which already exists rather ...
-1
votes
1
answer
2k
views
Corrected -Different sizes of data for train_test_split
I have input variable X in shape (500, 32) and output variable y in shape (422, 750, 3). I need to train a machine learning model with these variables. When I use train_test_split like this;
X_train, ...