Questions tagged [numpy]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
16 views

Linear regression compute theta

I'm trying to compute the theta for a regression linear exercice. ...
0
votes
0answers
22 views

Backpropagation incorrect only for hidden layer bias node

I am trying to implement a neural network in Python, however I am having some trouble when it comes to the implementation of backpropagation. I have been checking my results with this example and ...
0
votes
1answer
32 views

Sublime Text 2 with Pandas for Excel (Combining Data) & Data Visualization

I'm new to programming with Python, and so far it's been a headache to create a build environment- and need your support and expertise in this area. Background I'm running a MacBook, and using ...
0
votes
0answers
13 views

IndexError: too many indices for array

Attempting to load a dataset and print out a prediction for each array, yet I keep getting an IndexError.... ...
2
votes
0answers
6 views

Feeding uint8 type to NN

I’m facing some (RAM) memory issues to train a neural network. I have an input array consisting of grayscale images encoded as the type numpy.uint8 (therefore the whole range 0-255 can be covered). ...
1
vote
1answer
42 views

how to check all values in particular column has same data type or not?

I have column 'ABC' which has 5000 rows. Currently, dtype of column is object. Mostly it has string values but some values dtype is not string, I want to find all those rows and modify those rows. ...
1
vote
0answers
14 views

How do I plot between 2 variables in a summation equation?

I am new to Python and using Jupyter notebook. Following is the summation equation that I have: $$y(t) = \sum_{i=1}^{t-1} a_{i}y(t-i)$$ How can I plot between variables y and t by formulating this ...
0
votes
2answers
69 views

What's the proper way to do back propagation in Deep Fully Connected Neural Network for binary classification

I tried to implement a Deep fully connected neural network for binary classification using python and numpy and used Gradient Descent as optimization algorithm. ...
2
votes
1answer
26 views

How to deal with memory exceptions while processing large amount of data?

Am trying to develop a python script which reads a large CSV file (approx 1.2 GB historical data) in chunks and performs following steps: Take backup of the file Extract new records of previous day ...
1
vote
0answers
30 views

Would writing a decision tree algorithm in Pytorch or Tensorflow be faster than with Numpy?

Since these libraries can turn CPU arrays into GPU tensors, could you parallelize (and therefore accelerate) the calculations for a decision tree? I am considering making a decision tree class written ...
2
votes
1answer
37 views

Data sets that have strings and numerical data all in one column

I m new to the field of Data Science, but I have a great passion for it. Here's a code I wrote for pre processing a data set. It works ...
1
vote
0answers
12 views

ValueError when reshaping to 4 dim array for the Keras API

DL beginner here. I'm trying to implement LeNet using Keras and apply it on good ol' MNIST. ...
0
votes
1answer
26 views

Subtract Rows of Matrix from rows of another matrix numpy

I have two matrix V_r of shape(19, 300) and vecs of shape(100000, 300). I would like to subtract rows of V_r from from rows of vecs. Currently, I am achieving this with the following code. Is there a ...
1
vote
1answer
26 views

normal conda install vs forge install

In order to install some libraries, we just use: conda install pandas While in other cases we use: ...
0
votes
0answers
36 views

Consecutive multiplication of 3*3 matrix with the 3*1 matrix until a specific condition is met ( pagerank algorithm problem)

I have a 3*3 transition matrix and another 3*1 matrix. On multiplying these two, I get another 3*1 matrix. I must multiply the new 3*1 matrix with the original 3*3 matrix and this will give me another ...
0
votes
1answer
45 views

Getting a transition matrix from a Adjacency matrix in python

I have a 3*3 Adjacency matrix and I'm trying to sum the elements of each column and divide each column element by that sum to get the transition matrix. Can you please help me code this part? Thanks ...
1
vote
1answer
53 views

np.shape[::-1] reversal of dims and np.moveaxis splitting array

I cannot find anything in the documentation but it was used in some starter code for a class I am taking at school. Upon testing per below, it seems to reverse the order of the dimensions of an numpy ...
2
votes
0answers
51 views

Neural network cost is constant never changing during training

I am trying to build a binary classifier to predict a pulsar star with Single Hidden layer Neural Network. But the cost on training dataset after almost 100 iterations has no change, following is the ...
1
vote
1answer
29 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
50 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
34 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
1answer
17 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
35 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
20 views

Export data from yaml format to Excel

This image shows my data in .yaml format. I want to export in column
0
votes
0answers
61 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
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
14 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
20 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
59 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
39 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
21 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
21 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
31 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
261 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
626 views

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

This is my stock market csv data: ...
1
vote
1answer
29 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
206 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
70 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
78 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
103 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
4k views

AttributeError: 'numpy.ndarray' object has no attribute 'columns'

...
0
votes
1answer
188 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
44 views
3
votes
2answers
47 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
56 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
17 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
36 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 ...