Questions tagged [numpy]

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

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

How to do Back Propagation Updation for below code?

Below is the code by Siraj Raval for implementing Neural Networks from Scratch. I have some doubts regarding the Code: Why during updation he did W2 = W2 + L1.T.dot(L2_Delta). I Mean shouldn't it be ...
-1
votes
0answers
30 views

NameError: name 'randn' is not defined [closed]

I tried to run this code and it gave me an error saying name 'randn' is not defined Kindly have a look on the code : ...
1
vote
1answer
16 views

How should I improve my Vectorized Gradient descent linear regression model?

I wrote a vectorized Gradient descent implementation of the linear regression model. The Dataset looks something like: It's Not Working properly as I am getting negative R Squared error I don't ...
0
votes
0answers
27 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 ...
2
votes
0answers
9 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: <...
0
votes
1answer
22 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 ...
3
votes
0answers
57 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? ...
0
votes
0answers
17 views

What types of variables are these? And what types of tests could I run?

So, I recently made a sheet of data collected from the 2010 Census on Cincinnati neighborhoods. The data is from demographics about the neighborhoods of the city such as median household income and ...
0
votes
0answers
26 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. ...
0
votes
0answers
33 views

Data Analysis on normally distributed salary with Outliers

I have created normally distributed data with 2 outliers ...
0
votes
0answers
35 views

sess.run in losses.py

now I want to use sess.run in losses.py so that complex codes can be written by python style for customizing error function as below; ...
1
vote
0answers
8 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 ...
0
votes
0answers
50 views

For loop and assignment procedure in losses.py for customizing loss function of ML model

I want to customize a loss function for neural networks. A computation of the loss function requires the inclusion of a for loop like below. However, it is super difficult to implement because ...
0
votes
0answers
18 views

Fastest way to generate mini-batches from structured data

To generate mini-batches for training, I use a for loop to extract slices of a 2-D numpy array. Here is some example code I wrote to demonstrate this. Basically I loop through a 2-D numpy array ...
1
vote
0answers
32 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 ...
1
vote
1answer
36 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 ...
0
votes
1answer
29 views

Linear regression compute theta

I'm trying to compute the theta for a regression linear exercice. ...
0
votes
0answers
29 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
55 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
24 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
109 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
81 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
29 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
56 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
40 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
23 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
37 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
28 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
38 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
133 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
88 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
55 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
30 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
20 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
37 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
44 views

Export data from yaml format to Excel

This image shows my data in .yaml format. I want to export in column
0
votes
1answer
121 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
9 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
15 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
32 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
401 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
17 views

How to do numpy matmul broadcasting between two numpy tensors?

I have the Pauli matrices which are (2x2) and complex ...
1
vote
1answer
42 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
23 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?