All Questions
Tagged with numpy python-2.x
32 questions
2
votes
0
answers
148
views
Find the available squares for rooks in empty board using boolean arrays
I will describe two techniques, then the question will be how I can make an algorithm that is more efficient, if possible.
I want to find an efficient way to determine the squares where the pieces on ...
0
votes
1
answer
540
views
Image color-moment extractor [closed]
I was just wondering if there is a way to speed up the performances of this for loops in Python.
I'm trying to process an image to get the color-moments without using libraries.
It takes about 12sec ...
2
votes
0
answers
123
views
Extract cell values from multiband rasters
I have the following function and code snippet to extract cell values for multiple years, format it, and save to a list. Each raster has 365 bands — one for each day. A separate operation is performed ...
5
votes
1
answer
1k
views
Improving the speed of creation for three Perlin Noise Maps in Python?
I am interested in learning how I can improve the speed of the code in this pygame file. I iterate over 6400 * 1800 * 3 or 34,560,000 elements of various numpy arrays here to apply noise values to ...
7
votes
1
answer
1k
views
Plotting terrain pixels with PyGame based on random NumPy array
I am experimenting with Perlin Noise and random map generation. I have a 2D numpy ndarray full of 16-bit floats called map_list that I call from the singleton ...
2
votes
3
answers
443
views
Code to find the sum of the product of all size-n combinations of an array
The title is a bit of a mouthful, so here's a quick example:
You've got an array, maybe just the digits 1-3, and you want to get the sum of product of all size-2 combinations of the array. Those ...
6
votes
2
answers
3k
views
Remove outliers from a point cloud
This function accepts a cloud of points, and returns those points that are within delta distance of the average (mean) position.
...
3
votes
2
answers
4k
views
Calculate True Positive, False Positive, True Negative and False negative and colourize output
Objective : Calculate True Positive, False Positive, True Negative and False negative and colourize the image accordignly, based on ground-truth and prediction from my classifier model.
Problem : ...
5
votes
1
answer
214
views
Using NumPy to scale data in 2 out of 3 columns
The below code takes a csv containing age, weight, height and prints the betas determined through linear regression to an output csv. It runs for 10 iterations using a different alpha for each, and ...
5
votes
1
answer
5k
views
Applying Laplacian smoothing to vertices in a mesh
I'm totally new in Python and I wrote some code. It is a simple algorithm to smooth objects. I need to find adjacent vertices in mesh and sum their coordinates and after that divide by a number of ...
3
votes
0
answers
1k
views
Implementing the stochastic gradient descent algorithm of the softmax regression with only NumPy [closed]
I am implementing the stochastic gradient descent algorithm. I think there is plenty of room for improvement.
...
5
votes
2
answers
1k
views
A command-line utility to solve a system of linear equations
I was re-checking my answers for a Math paper on my laptop. I needed to verify my solution for a system of linear equations. Unfortunately, I found no quick way to do that. That's why I wrote a (...
5
votes
2
answers
850
views
Python Cartesian Product in a constrained dictonary
I want to calculate the Cartesian product of n copies of a small list, marker=[0,1,2]. I want to use these Cartesian product ...
4
votes
1
answer
336
views
Surface Density Profile
I am trying to compute the surface density profile, given the spherical density profile in 3D for different parameters in order to interpolate and have it as a function of them to use later on for ...
2
votes
1
answer
183
views
Slicing a big NumPy array
I have a function that takes a four-dimensional NumPy array M and, for each value i of its second index, takes all of M without the i-th "column", evaluates the product over all other columns, and ...