Questions tagged [numpy]

NumPy is one of the fundamental packages used for scientific computing in the Python ecosystem. Specifically, NumPy is used for numerical computing and uses n-dimensional arrays.

Filter by
Sorted by
Tagged with
0 votes
0 answers
20 views

Python Implementation of ODE for matrix operations

I am trying to develop a model and I am stuck as to how this should be implemented in python using ODE. My entire population is divided into regions and part of the model takes this into consideration ...
Longestail's user avatar
1 vote
1 answer
27 views

Keras Model Produces Different Outputs, But Outputs Map To The Same Vector

I have a neural network that produces output vectors from input vectors. These output vectors are different depending on what input vector it is being asked to predict for. I have a dictionary that ...
slastine's user avatar
1 vote
1 answer
21 views

Data Skewness is nan or inf

I have checked the Skewness of my data before applying a Log transformation using the next code : print("Skewness: %f" % df['Wind Speed (km/h)'].skew()) ...
baddy's user avatar
  • 165
0 votes
0 answers
9 views

Array column in dataframe as input for classification models

Please consider the following dataframe: My challenge is with the column 'geometry_coordnates'. I've got a column 'geometry_coordnates' that is an array of numbers. It can be a representation of a ...
Paulo Henrique PH's user avatar
0 votes
0 answers
14 views

df['col'] refactoring

I made a big mistake by using df.iterrows() in a computationally heavy project. Now I need to convert it to np loop and need to rename all df['col'] occurrences to np[i]. How can I do it not manually, ...
Myron's user avatar
  • 113
0 votes
0 answers
45 views

Batch processing for a dictionary of dictionaries Python

I have a very large dictionary of the form vf = {key1:{...}, key2:{...}, key3:{...}, ...}, which is stored as an npz file. Trying to load it at once causes a memory error, so I tried to load it in ...
Andrew's user avatar
  • 103
0 votes
1 answer
57 views

Remove outlier from image array in Python

Could someone please suggest me what would be the best way to remove such huge number of outlier data from the image. The regular clipping between data range in numpy array would simply reduce the ...
hillsonghimire's user avatar
0 votes
1 answer
49 views

why np.cos returns erroneous values?

I'm debugging my python program. I have np.cos(param_t_10[0]) returns 5.9168e-06 where ...
dsb's user avatar
  • 103
0 votes
0 answers
58 views

How to deal with "Could not broadcast input array from shape (1141,2) into shape (1141,)" to get Out-of-Bag error while using Random Forest

I have a dataset that consists of 171 features and 39 labels. I captured both features and labels of the dataset through slicing: ...
Ralph Henry's user avatar
0 votes
1 answer
22 views

Trying to write a code that detects a maximum value before a drop off in slope

I'm trying to write code for a force test that will output the maximum force before structural failure occurs. I'm a bit of a novice to python, so the issue here might be something simple that I'm ...
Miriam Cubstead's user avatar
0 votes
1 answer
24 views

Why most keras examples use shape=(None,) instead of shape=(None)?

I'm reading several keras tutorials and found that many examples are written like this: keras.Input(shape=(None,), dtype="int64", name="english")...
skan's user avatar
  • 185
0 votes
0 answers
31 views

What is numpy.dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) in numpy.dot() documentation?

I was trying to understand difference between np.dot and np.matmul and in the docs of np.dot() there is this code dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]). ...
Tinted's user avatar
  • 1
0 votes
0 answers
11 views

How to solve MemoryError problem?

I have audio signals which I need to convert them to melspectrogram. I am using Deepfilternet to remove background noise. when I use the output of Deepfilternet for next phase like padding, it showed ...
Zara Nz's user avatar
0 votes
0 answers
38 views

Perform k-means clustering over multiple columns using python but without library sklearn.kmeans

I'm on a project with the topic "clustering" using the KMeans method. so I have a data set with 10 columns and 1000 rows divided into 5 clusters (in this case there are 5 robot movements). I'...
Higashida Cyza's user avatar
0 votes
0 answers
18 views

Speaker Verification with TRILLsson

I am searching for models suitable for Speaker Verification. I stumbled across the TRILLsson models. It seems to be usable for Speaker Verification, but i haven't managed to make it work yet. I tried ...
Márton's user avatar
-2 votes
2 answers
46 views

Why the numbers 6 and 8 not selected when indexing this numpy array?

In the below code why the numbers 6 and 8 not selected? ...
Rahul's user avatar
  • 1
0 votes
0 answers
115 views

ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type int) in Python - from_gerator fails

I know this question has answers, but they are not working. why this fails ? (and why tensorflow has troubles in reading numpy!!) ...
user305883's user avatar
0 votes
0 answers
26 views

How do I represent multiple seconds of video in tensors?

I want to use ResNet-18 for image features at the head of a VAE. If I have 10 seconds of video at 30 frames per second, and if ResNet-18 gives me the features of a single frame as a 512-dimensional ...
Rastapopolis's user avatar
0 votes
1 answer
35 views

Counting values from diffrent columns

I'm working with a pandas dataframe that has some columns like these: ...
Arwa Ali's user avatar
0 votes
1 answer
230 views

OpenCV add/subtract functions produce different results from numpy array add/subtract

Im trying to brighten and dim an image using OpenCV with two approaches. Approach 1: Used OpenCV's add and subtract functions to ...
Somanna's user avatar
  • 103
1 vote
0 answers
79 views

Unsupported object type int Error where array is already in float32

I am learning DL. For the following dataset:: spam.csv can be found here::Click here to see. I am trying to implement a simple NN to detect spam email. For the following code:: ...
Ishrat Hossain's user avatar
0 votes
1 answer
306 views

Pandas filtering with np.where as filter not working as expected

working on Kaggle's SpaceShip Titanic dataset and I was doing some analysis of the data. Call tt the pd.DataFrame containing the ...
nico_so's user avatar
  • 13
0 votes
0 answers
15 views

How to change the color of sock images while preserving their natural texture?

In our company, we have a large number of sock images that we need to modify. We want to change the color of specific parts of the sock image, while preserving the natural texture of the socks. We're ...
Mario Arango's user avatar
0 votes
1 answer
465 views

How can I convert a numpy array of tensors to tensor of tensors?

It is my first GRU model so pardon the stupidity. I am trying to learn by training a simple GRU network on variable length sequences. The sequences are numpy arrays of tensors. The length of numpy ...
Ayush Gupta's user avatar
0 votes
0 answers
254 views

Large Numpy array causes error when trying to load

I'm making an ai using image recognition, so I recorded each frames of me playing into a numpy array. It worked just fine when the first time I exported all the images and got the 6 thousand of them. ...
AngelFire's user avatar
0 votes
0 answers
503 views

EagerTensor object has no attribute 'astype'

I am using trained tf model output (TF 2.8) and trying to convert it to numpy array. ...
Akhmad Sumekenov's user avatar
0 votes
1 answer
51 views

problem on converting data to numpy array

I have pandas data frame data=df.loc[[0]] print(data) 0 3.5257,3.5257,3.5257000000000005,3.5257,3.5257... Name: testdata, dtype: object I need to convert it to ...
simond's user avatar
  • 73
0 votes
1 answer
55 views

Change the shape of numpy array

My numpy array has the shape of (99,2) basically it has 2 columns one is the word and the other is a hot encoding vector size of 300 I want to delete the column of words and want to have only encoding ...
Abdul Basit Niazi's user avatar
0 votes
1 answer
62 views

Get the value of second dimension in numpy array

My NumPy array looks like this ...
Abdul Basit Niazi's user avatar
0 votes
0 answers
12 views

Looking for Exercises/labs

If someone knows some labs/exercises where you can train Pandas, numpy, seaborn. I appreciated! I have being looking on Kanggle, but if you guys know other options please let a comment
Galatic_1's user avatar
0 votes
1 answer
97 views

numpy power function output for 2 to the power 63

I am running some test code and observed something strange. the numpy power function giving strange output post 2 to the power 62 ...
veer7's user avatar
  • 146
1 vote
1 answer
62 views

Using python AI mnist to recognize my picture, trained accuracy is 97.99%, but accuracy to my img is less than 20%

Questions like these are difficult to debug, but you'll hopefully find more help on datascience.stackexchange.com than here I see the suggestion that post in Data science is also a good option Using ...
DC con's user avatar
  • 111
0 votes
0 answers
479 views

Binary classification works with softmax, but not sigmoid

I am doing a binary classification problem for seizure classification. I split the data into Training, Validation and Test with the following sizes and shapes dataset_X = ...
Mohammed Nafie's user avatar
0 votes
1 answer
155 views

Error using sigmoid activation function in the last dense layer of a LSTN

Trying to use sigmoid as an activation function for the last dense layer of a LSTN, I get this error ...
fede72bari's user avatar
0 votes
1 answer
29 views

How can i get this way to create random data?

I need to create random data using this lines ...
user20133451's user avatar
1 vote
1 answer
572 views

Is it advisable to save an ML model as a Joblib/Pickle file?

Part of our thesis project is to create a Diabetes predictor web application, and I have something I like to clarify. Is it a common practice to save an ML model as a Joblib/Pickle file like this one? ...
mynameiswadey's user avatar
0 votes
0 answers
393 views

Creating a scatter plot with matplotlib with large dataset

I am trying to create a scatter plot from instrument peak area data recorded every tenth of a second or so. For some reason, when I try to plot it with Matplotlib, I get a straight line, which is not ...
Peter Bright's user avatar
0 votes
1 answer
328 views

How to convert Torchvision image tensor to base64 directly?

I have this code that is supposed to convert an image entry of a Torchvision dataset to a base64 string. To do that, it serializes the tensor from a Torchvision dataset to a string, modifies that ...
Bengt's user avatar
  • 111
0 votes
1 answer
228 views

How to convert postgresql tabular data to a numpy array?

I'm completely new to data science and I have a problem that I need help in resolving. I have time series data (with 87 million rows currently, though that will grow) with x, y coordinates, a ...
Shawn's user avatar
  • 101
0 votes
1 answer
65 views

Why normalized eigen values and eigen vectors can have imaginary number?

My goal is to prove why normalized eigen values and eigen vectors have imaginary number. According to this website: normalized eigen vector is just ...
kidfrom's user avatar
2 votes
0 answers
723 views

Applyingv a 2D mask onto a 3D rgb color list

Problem I have the following image data as a 3D numpy array containing rgb values of the image in a (n,n,3) shaped list (Image). I also have data of the corresponding black and white mask image in a (...
Hector Edu Nseng's user avatar
0 votes
0 answers
2k views

y_true takes value in {} and pos_label is not specified: either make y_true take value in {0, 1} or {-1, 1} or pass pos_label explicitly

I want to run "4_forgery_detection_result.ipynb" from an available code. In this cell of the code, ...
T_N's user avatar
  • 1
0 votes
0 answers
1k views

Overflow encountered in matmul while doing forward propagation

I wrote this code to do forward propagation ...
Ahmed Ramsey's user avatar
1 vote
0 answers
545 views

logistic regression,machine learning

I just started learning ML, so I tried to implement logistic regression on my own in 2 ways (the first code and the second code), but they aren't working, I cross-checked by using sklearn (third code ...
Prathvik G S's user avatar
1 vote
1 answer
255 views

Creating a grid type 3D data array from data points [closed]

I have a 3 data column $(X, Y, Z)$ ranges from $(min, max)$. For example, $X = (0, 5)$, $Y=(0, 3)$, $Z=(0, 2)$. By using them I need to create a numpy array in the form of $[(0, 0, 0), (0, 0, 1), (0, ...
seVenVo1d's user avatar
  • 123
-1 votes
2 answers
1k views

unable to pass X_train and y_train in my regressor variable. i got a ValueError

...
Chris dylan J'TEMFACK's user avatar
0 votes
0 answers
2k views

How to solve this ValueError: Dimensions must be equal

I'm trying to train an autoencoder model with colored image samples but I got this error ...
nmorsi's user avatar
  • 1
0 votes
1 answer
746 views

How to solve MemoryError problem

I've created and normalized my colored image dataset of 3716 sample and size 493*491 as x_train, its type is list I'm tring to convert it into numpy array as follows ...
nmorsi's user avatar
  • 1
0 votes
1 answer
1k views

Python: calculate the weighted average correlation coefficient

I am calculating the volatility (standard deviation) of returns of a portfolio of assets using the variance-covariance approach. Correlation coefficients and asset volatilities have been estimated ...
Richard H's user avatar
  • 101
1 vote
1 answer
38 views

Tensor dot product with rank one tensor from vector

I'm trying to compute an inner product between tensors in numpy. I have a vector $x$ of shape (n,) and a tensor $y$ of shape ...
fabio's user avatar
  • 11

1
2 3 4 5
8