Questions tagged [numpy]

NumPy is a scientific and numerical computing extension to the Python programming language.

Filter by
Sorted by
Tagged with
1
vote
1answer
23 views

How can I have the same initialization for all my networks?

I want to have the same weights for layer initializations in all my networks, so that when I'm comparing their first epoch loss they all start from the same value. Is there a way in keras to do this? ...
-1
votes
2answers
48 views

MATCHING AN INTEGER

I have this dataset. I want to create a dataframe from the dataset which starts with a particular integers. This is a sample: ...
1
vote
0answers
30 views

Get right shape of numpy array - (4112, 20, 28, 28)

I'm trying to create an numpy array that resembles = (flattened images, number of examples per class, width, height) This is the original code: ...
0
votes
0answers
17 views

How to convert 1D numpy arrays element-wire into new 1D numpy array? [migrated]

I've n numpy 1D arrays ì_0 = [i00, i01, i02, ...], i_1 = [i10, i11, i12, ...], ... and would ...
0
votes
0answers
11 views

How to maintain CBOW dataset dimension and fit it in Neural Network?

I am new to neural network. I'm trying to train word embeddings without using word2vec package. Using titles from reddit worldnews dataset I'm have done some CBOW representation. For window size ...
1
vote
1answer
28 views

multiplying two array in python3.7

I am trying to multiply two array in python 3.7 using numpy by using the following syntax: ...
-1
votes
1answer
15 views

Export data from yaml format to Excel

This image shows my data in .yaml format. I want to export in column
-2
votes
0answers
14 views

Error in changing datetime format

I am getting errors trying to convert datetime format. My code is: ...
0
votes
0answers
20 views

Upload 'tsv' file to Google Colab / Jupyter Notebook

TSV(Tab separated Value) extension file can't be uploaded to google colab using pandas Used this to upload my file ...
0
votes
0answers
7 views

How to unify all masks from Mask R-CNN into one?

I'm trying to unite all masks that we've got with Mask R-CNN into one mask that would give True/False for the whole picture. I have separate masks with True/False and corresponding boxes with ...
-1
votes
0answers
19 views

Not sure what to do after feature extraction for a clustering problem I'm working on

I am very new to the machine learning scene, and I'm trying to do clustering(kmeans or hierarchical clustering) on a data set of about 31k black and white images of size 200x200 (Each image is ...
1
vote
0answers
17 views

Confusion with initialising weights in a neural network

Here is some code that initialises weights for an RNN: ...
0
votes
0answers
9 views

How do I organize a multi-site multivariate time-series dataset for a Random Forest Regression?

I am trying to do a Random Forest Regression to forecast the next months value. I have a few years of data split by month. In each month I have about 1500 unique sites. There are 14 features.
0
votes
1answer
12 views

Splitting large multi class dataset using leave one out scheme into train and test

I am doing some supervised learning using neural networks, and i have a Targets array containing 1906 samples, which contain 664 unique values. min. count of each unique value==2, by design. Is there ...
1
vote
1answer
27 views

Sklearn train_test_split() error: Found input variables with inconsistent numbers of samples

I am fitting a regression model on randomly generated X1,x2 and Y be the sum of x1, x2 but I am getting this error ValueError: Found input variables with inconsistent numbers of samples: [2, ...
0
votes
0answers
12 views

How to do numpy matmul broadcasting between two numpy tensors?

I have the Pauli matrices which are (2x2) and complex ...
1
vote
1answer
38 views

Why is the difference of datetime = zero in the following dataframe?

This issue that I am facing is very simple yet weird and has troubled me to no end. I have a dataframe as follows : ...
1
vote
1answer
20 views

Converting a Pandas Series string of multiple attributes into individual attributes?

I'm working on an Airbnb dataset in order to predict the nightly price--where each example is one Airbnb listing (ie a listing for someone's house, room, apartment, etc). Each feature is a ...
0
votes
1answer
20 views

Index needs sorting help! [closed]

I want my index which is mixed up (i just sorted out ratings from highest to lowest) to be in ascending (sorted) order corresponding to my sorted ratings. How can I do that?
0
votes
3answers
29 views

How does cost function change by choice of activation function (ReLU, Sigmoid, Softmax)?

I am new to ML and as I take courses for the area DL, I am wondering, by our choice of activation function for the last layer, whether we take sigmoid, relu or softmax, would the formula for ...
0
votes
1answer
62 views

Python: multiplication of sparse matrices slower in csr_matrix than numpy

I am trying to multiply a sparse matrix with itself using numpy and scipy.sparse.csr_matrix. The size of matrix is 128x256. Its 93% values are 0. Ironically the multiplication using numpy is faster ...
0
votes
1answer
176 views

np.loadtxt function showing error, could not convert string to float: '“Date”'

This is my stock market csv data: ...
1
vote
1answer
23 views

numpy array reshape question

Let's say that I have image data with shape $(32, 32, 3)$ and $50000$ If I would like to reshape it to $(50000, 3, 32, 32)$ what should I do? I tried ...
0
votes
1answer
31 views

How to remove outliers using box-plot?

I have data of a metric grouped date wise. I have plotted the data, now, how do I remove the values outside the range of the boxplot (outliers)? All the ['AVG'] data is in a single column, I need it ...
0
votes
2answers
59 views

What is the best way to replace NaN values for ranked columns

I have a column named BsmntQual that gives a ranking on the height of the basement per each house. These are all of the unique values in this column: ...
1
vote
1answer
47 views

Why does np.linalg.eig produce an opposite-signed eigenvector?

I am learning SVD by following this MIT course. In this video, the lecturer is finding the SVD for $$ \begin{pmatrix} 5 & 5 \\ -1 & 7 \end{pmatrix}, $$ which involves finding the ...
1
vote
1answer
96 views

is there a way to normalize [-3,1] to ${\begin{bmatrix} \dfrac{-3}{\sqrt{10}}\\ \dfrac{1}{\sqrt{10}}\\ \end{bmatrix}}$ with python?

I am learning SVD by following this MIT course The lecturer is trying to normalize a vector $${\begin{bmatrix} -3\\ 1\\ \end{bmatrix}}$$ to $${\begin{bmatrix} \dfrac{-3}{\sqrt{10}}\\ \dfrac{1}{\...
1
vote
1answer
909 views
0
votes
1answer
70 views

How to determine input shape in keras?

I am having difficulty finding where my error is while building deep learning models, but I typically have issues when setting the input layer input shape. This is my model: ...
1
vote
0answers
39 views
3
votes
2answers
46 views

Is there a difference between np.matrix(np.array([0,0])) and np.matrix([0,0])?

I was reading this code, for implemnting linear regression from scratch: ...
1
vote
0answers
39 views

Integration of NLP and Angular application

I'm doing a small POC in which I've trained my Machine Learning model (Naive Bayes) and is saved in ".pkl" (pickle) format. Now my next task is to develop a web application which asks the user to ...
0
votes
0answers
16 views

Fixed: Keras Neural Network on handwritten digits labeling: Model reads the surrounding space instead of digit

Our assignment consists of labeling handwritten numbers, ranging from 0 to 9. We build a Convolutional Neural Network that achieves a good accuracy on our labeled testset. We now want to use this ...
1
vote
1answer
33 views

Is it a good idea to use tensorflow instead of numpy for numerical approximations?

I intend on perfroming some numerical approximations for a problem in physics. The main gist of the program will be to perform a svd on large sparse matrices and also calculating the trace of a ...
1
vote
0answers
27 views

Email clustering using numpy and pandas

Im trying to cluster my raw email data using numpy and pandas only. Hence Im Trying to create an email dataframe from raw emails that I have. However the issue that I have is that I keep getting an ...
0
votes
0answers
80 views

Implementation of Bhattacharyya distance for filtering images that are far off from their cluster

I need assistance with the python implementation of Bhattacharyya-distance for the below use case: Here, the polygons P1, P2..Pn refer to the different images where each pixel is represented by 'n' ...
0
votes
1answer
76 views

What is Difference Between np.zeros() and np.empty() [duplicate]

Can Anyone Please Explain me the Difference Between them In Terms Of Any Operation or Computation and Values Stored in them
1
vote
0answers
366 views

How to convert a TensorFlow tensor to a NumPy array within tf.Dataset.map() while multithreading/multiprocessing?

I use TensorFlow 1.12 in eager execution. I have a very expensive function which I map onto this dataset using tf.Dataset.map(). Inside this function — which I ...
0
votes
0answers
20 views

How to go from a tensor of 2D masks to a tensor of one-hot vector encodings for image segmentation in TensorFlow?

I use TensorFlow 1.12 in eager execution in order to perform semantic segmentation (one label per pixel) on images. My ground truth dataset is structured in instances however (multiple instances, or "...
1
vote
2answers
258 views

Is numpy.corrcoef() enough to find correlation?

I am currently working through Kaggle's titanic competition and I'm trying to figure out the correlation between the Survived column and other columns. I am using <...
0
votes
1answer
19 views

Is my iPython Installation Valid?

I just want to know if my ipython is properly installed. I have both Python and Anaconda installed on my Windows. I entered the "pip3 install ipython" command on the Command Prompt and it downloaded ...
0
votes
0answers
18 views

Using Matplotlib [duplicate]

I am new to data science. I use Anaconda on windows 7. I plotted a sine curve by doing the following on iPython: ...
1
vote
1answer
28 views

Naming the Axes of my Graph on iPython Using Matplotlib.pyplot

I am new to data science. I use Anaconda on windows 7. I plotted a sine curve by doing the following on iPython: ...
0
votes
1answer
42 views

What is .numpy()?

I searched for numpy.numpy() and tried replacing .numpy() with .np() because numpy is ...
0
votes
0answers
12 views

I am building a gesture recognition system using video data from ConGD Dataset and am not able to create the 5D array,as input to the network

I need a 5D input for my network using ConvLSTM and 3D-CNN. Converting the videos to an array of videos would contain a 5D array (Num of examples, Num of frames, FrameWidth, FrameHeight, NoOfChannels),...
7
votes
4answers
265 views

How to replace NaN values for image data?

My data set has a total of 200 columns, where each column corresponds to the same pixel in all of my images. In total, I have 48,500 rows. The labels for the data range from 0-9. The data looks ...
0
votes
0answers
23 views

Keras input shape error on predicting vectors

I have trained a Keras model (autoencoder) on embeddings that are 52,388-dimensional. I am trying to use that model to make predictions on a held-out data set that I am loading into Spark. The code to ...
2
votes
1answer
35 views

Model prediction on meshgrid in python

Suppose I have data with two independent variable $X_1$, $X_2$ and one dependent variable say $y$, as follows: $X_1$: $x_{1,1}$, $x_{1,2}$ , $x_{1,3}$ $X_2$: $x_{2,1}$, $x_{2,2}$, $x_{2,3}$ $y$: $...
2
votes
0answers
136 views

Cosine similarity with arrays contaning NaN

I am trying to calculate a cosine similarity using Python in order to find similar users basing on ratings they have given to movies. As it can be expected there are a lot of NaN values. I am using ...
0
votes
0answers
37 views

Issue in computing matrix inverse

I need to compute inverse of a matrix that has very small values of the range of 10^-9. When I use numpy.linalg.inv it gives all entries of the inverse matrix as 0. I checked in the original matrix ...