Skip to main content

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
1 answer
8 views

AttributeError: 'numpy.ndarray' object has no attribute 'columns' when I try to scale the dataset

...
Pranav Kaushik's user avatar
1 vote
0 answers
14 views

Efficiently Implement a Data Transformation || Pytorch || coding advice

I have created the following class and function to create a 'custom' dataset. The use case was to sample every nth image from a data set to reduce the size of the data set while still maintaining ...
James's user avatar
  • 21
0 votes
0 answers
20 views

Calculation of Covariance Matrices for a QDA classifier in Python Numpy

For a school project, I have to design a QDA classifier for 28x28 pixel images of letters in sign language. I have been given 27455 images for training, which have to be flattened to a 784 pixel ...
Neev Penkar's user avatar
0 votes
0 answers
21 views

Generating a Sample T-Distribution in Python

I'm new to DataScience. I'm going through the stats module and the ways to create a sample T-distribution. Using the below line to generate the sample. However, my question is how is the array ...
naveent2785's user avatar
0 votes
0 answers
8 views

Add a custom loss in a public github repository on distillation

I’m trying to implement a custom loss in a public repository regarding knowledge distillation. The link to the repository is the following: " https://github.com/DefangChen/SimKD " The main ...
PiEmmeC's user avatar
0 votes
1 answer
22 views

Why does largest eigen value used for eigen vector calcuation?

Why is the largest eigenvalue used for eigenvector calculation? What is the significance of using a largest absolute value for the whitening of a picture?
EMKAY's user avatar
  • 105
-1 votes
1 answer
42 views

TypeError: unhashable type: 'slice' K-Means; Custom code for K-Means

Problem Statement The goal is to have the K-Means customer code run for clusters and not use scikit-learn libraries. Learning exercise. This K-means has the standard predict, fix, centroids, cluster ...
Data Science Analytics Manager's user avatar
0 votes
0 answers
11 views

Passing the Parallel API tests in PettingZoo for custom multi-agent environment

from pettingzoo.test import ( parallel_api_test, parallel_seed_test, max_cycles_test, performance_benchmark, ) I have a custom multiagent ...
hridayns's user avatar
  • 121
0 votes
2 answers
554 views

Solve a non-linear system, in Python, with the GAUSS-NEWTON algorithm? (Jacobian matrix J, etc.)

I would like to solve a non-linear system (which contains the goals of a football team in previous matches) using the Gauss-Netwon algorithm, in order to find the parameter (of frequency) to use as ...
Zollikofen4's user avatar
0 votes
0 answers
26 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
37 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
123 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
18 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
19 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
  • 123
0 votes
0 answers
213 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
193 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
90 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
151 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
32 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
77 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
42 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
14 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
63 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
39 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
1 vote
0 answers
275 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
1 answer
102 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
494 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
100 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
577 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
1 answer
540 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
1 answer
147 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
76 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
79 views

Get the value of second dimension in numpy array

My NumPy array looks like this ...
Abdul Basit Niazi's user avatar
0 votes
1 answer
123 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
72 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
560 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
171 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
33 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
1k 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
565 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
404 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
394 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
91 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
1k 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
593 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
375 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
2k views

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

...
Chris dylan J'TEMFACK's user avatar

1
2 3 4 5
8