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
0 answers
38 views

How the Pandas Dataframe and Numpy masking technique works

I'm trying to understand how the masking technique works. I've a dataframe with some values (say one_row_incidents) some of the are not unique. By grouping them .by the duplicate index, I can get the ...
Andrea Moro's user avatar
2 votes
1 answer
155 views

Error when drawing random numbers from a custom continuous distribution using scipy.rv_continuous

I am trying to generate a sample of random numbers from a custom distribution $$ p(x) = x^{n}e^{-xtn}. $$ After reading the tutorial on scipy's website, I wrote a subclass which I called kbayes: <...
pelegs's user avatar
  • 121
1 vote
1 answer
310 views

empty fields to be filled with previous values

In the above sample data, I have empty fields and now the task is to fill the fields with previous values. my columns are dates and the values are a number of items present for that particular article ...
LIONEL JOSEPH's user avatar
9 votes
2 answers
395 views

Are there any graph embedding algorithms like this already?

I wrote an algorithm for generating node embeddings based on the graph's topology. Most of the explanation is done in the readme file and the examples. The question is: Am I reinventing the wheel? ...
monomonedula's user avatar
1 vote
0 answers
235 views

Reshape Time series data for Conv2d Block

I am modelling my time series data into a supervised learning problem for the input to a conv2d block in pytorch from this tutorial. ...
Scrappy Coco's user avatar
1 vote
1 answer
493 views

Handling a large dataset consisting of npy files

I have a high number of npy files (448 files) each consisting of around 12k frames (150x150 RGB images) which together make the input to my neural network (X). However, since it is impossible to load ...
Amin Marshal's user avatar
1 vote
0 answers
117 views

Method for 'Simple' Clustering?

In a recent adult education class I took the prof shared a spreadsheet that was written in VBA code and takes ages to execute, I'm sure ...
Programming_Learner_DK's user avatar
2 votes
1 answer
2k views

Numpy arithmetic operation between two columns

Below is the numpy array. I need to perform two operations on this array. Add one column with value [column 1] - [column 3]. Add another column with value [column 1] - [previous value of column1]. I ...
Rajesh das's user avatar
1 vote
1 answer
221 views

Linear regression compute theta

I'm trying to compute the theta for a regression linear exercice. ...
Xero's user avatar
  • 113
1 vote
1 answer
978 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 ...
Laythesmack's user avatar
3 votes
1 answer
362 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). ...
leo.b.'s user avatar
  • 176
9 votes
1 answer
31k 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. ...
Kiran's user avatar
  • 205
2 votes
0 answers
32 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 ...
Ak001's user avatar
  • 21
2 votes
2 answers
601 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. ...
Amith Adiraju's user avatar
3 votes
1 answer
504 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 ...
Optimizor's user avatar
1 vote
1 answer
1k 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 ...
Nicolas Gervais's user avatar
3 votes
1 answer
258 views

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

Here's a code I wrote for pre-processing a data set. It works ...
Dulangi_Kanchana's user avatar
1 vote
0 answers
99 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. ...
Tarun Narayanan's user avatar
1 vote
2 answers
1k 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 ...
Nasir Aziz's user avatar
2 votes
1 answer
1k 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: ...
boredaf's user avatar
  • 161
0 votes
1 answer
2k 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 ...
VishwaV's user avatar
  • 379
1 vote
1 answer
695 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 ...
mLstudent33's user avatar
3 votes
0 answers
84 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 ...
Chinmaya B's user avatar
1 vote
1 answer
262 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? ...
Moeinh77's user avatar
  • 221
0 votes
2 answers
61 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: ...
UZOCHUKWU URUAKPA's user avatar
1 vote
0 answers
43 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: ...
Bia Calico Cat's user avatar
2 votes
1 answer
92 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 ...
exiled's user avatar
  • 123
1 vote
1 answer
188 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: ...
Charvi Yadav's user avatar
-1 votes
1 answer
4k views

Export data from yaml format to Excel

This image shows my data in .yaml format. I want to export in column
Manish Kumar's user avatar
0 votes
1 answer
4k 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 ...
Mohseen Mulla's user avatar
1 vote
0 answers
24 views

Confusion with initialising weights in a neural network

Here is some code that initialises weights for an RNN: ...
Finn Williams's user avatar
1 vote
1 answer
221 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 ...
Burple's user avatar
  • 41
1 vote
1 answer
6k 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, ...
salman's user avatar
  • 11
1 vote
1 answer
591 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 : ...
dravid07's user avatar
  • 131
2 votes
1 answer
141 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 ...
Greg Rosen's user avatar
0 votes
1 answer
30 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?
oazed lium's user avatar
1 vote
3 answers
1k 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 ...
user avatar
1 vote
1 answer
6k 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 ...
shaifali Gupta's user avatar
0 votes
1 answer
17k views

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

This is my stock market csv data: ...
coding_ninza's user avatar
1 vote
1 answer
450 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 ...
eum sangwon's user avatar
15 votes
3 answers
70k 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 ...
Uday T's user avatar
  • 352
0 votes
2 answers
1k 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: ...
Andros Adrianopolos's user avatar
2 votes
1 answer
2k 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 ...
Jay's user avatar
  • 425
2 votes
1 answer
156 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}{\...
Jay's user avatar
  • 425
2 votes
2 answers
134k views

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

...
Balu's user avatar
  • 29
9 votes
2 answers
41k 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: ...
Josh Zwiebel's user avatar
1 vote
0 answers
98 views

Please explain the error in detail and how should i resolve it [closed]

Code: ...
Umang's user avatar
  • 21
3 votes
2 answers
1k 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: ...
Sabito stands with Ukraine's user avatar
2 votes
1 answer
581 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 ...
Ravi's user avatar
  • 183
0 votes
0 answers
27 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 ...
TvCasteren's user avatar

1
4
5
6 7 8