Questions tagged [numpy]
NumPy is one of the many modules in Python that adds support of large multidimensional arrays and matrixes, along with a large library of high-level mathematical functions for operations with these arrays.
numpy
114,586
questions
1
vote
2
answers
51
views
Why is trapz returning negative values, even when x is sorted ascending and y is all positive?
y = np.array([59817478.73563218, 56195352.29885057, 59679547.70114943,
61071789.08045977, 56678110.91954023, 56900812.06896552,
61942478.73563218, 57360582.18390805, 57423800.57471264,
...
0
votes
0
answers
15
views
Need help on solving numerical stability issue on hand craft NN use numpy
I try to craft an NN from scratch using Numpy.
When I try to run it, the loss goes to the nan value after a few epochs, also the loss increases instead of decreasing. Am I doing something wrong and ...
1
vote
1
answer
32
views
How does numpy.polyfit return a slope and y-intercept when its documentation says it returns otherwise?
I have seen examples where slope, yintercept = numpy.polyfit(x,y,1) is used to return slope and y-intercept, but the documentation does not mention "slope" or "intercept" anywhere.
...
0
votes
0
answers
26
views
PyTorch huge dataset constraints?
I'm training a model in Pytorch to do image-to-image processing. My data is huge, shape is (64152, 3, 5, 2, 64, 144). I'm using memmapping to save on memory as much as humanly possible.
The issues ...
0
votes
0
answers
17
views
Issue with installing wrf-python
i am not able to install wrf-python in linux. it always tells me that numpy module is not found however i have already installed numpy. can anyone help out.
tried pip, pipx, sudo, nothing is working. ...
3
votes
1
answer
72
views
np.where on a numpy MxN matrix but return M rows with indices where condition exists
I am trying to use np.where on a MxN numpy matrix, where I want to return the same number of M rows but the indices in each row where the element exists. Is this possible to do so? For example:
a = [[...
0
votes
1
answer
17
views
How to avoid "UserWarning: Reading `.npy` or `.npz` file required additional header parsing..."
I'm creating .npz files in Python 2 (yes, Python 2, not 3 and I can't change it) full of .npy files. When reading those .npz files, I'm having the warning message: "UserWarning: Reading .npy or ....
-2
votes
1
answer
46
views
Optimizing Nanogrinding Algorithms with Python for Metal Powders at Room Temperature
I'm working on an advanced nanogrinding technology that enables grinding metals like copper at room temperature, achieving results that are currently deemed impossible with conventional methods. The ...
0
votes
1
answer
62
views
Reshape array to RGB array with missing values
I'm creating a tkinter user interface to display several images which a user will manipulate (translate and rotate) over each other. As the user is manipulating the images I need to calculate the new ...
5
votes
3
answers
75
views
Apply permutation array on multiple axes in numpy
Let's say I have an array of permutations perm which could look like:
perm = np.array([[0, 1, 2], [1, 2, 0], [0, 2, 1], [2, 1, 0]])
If I want to apply it to one axis, I can write something like:
v = ...
0
votes
0
answers
45
views
Numpy is not available (numpy has been installed [duplicate]
I tried running the code (i.e. "Basic Components") provided in BOTorch for Bayesian Optimization on my windows system Jupyter Notebook loaded via powershell.
https://botorch.org/docs/...
1
vote
3
answers
85
views
Create a boolean array with True for any value between two entries in a certain array
I have a tensor called idx which has integers from 0 to 27, for instance:
idx = torch.tensor([9, 0, 6, 5, 2, 1, 10, 18, 26, 0, 11])
I want to generate another array/tensor which has boolean values. I ...
-1
votes
2
answers
65
views
Numpy geta mask of false positives from the given two vectors of y_true and y_pred
Given three classes (5,6,7) of two arrays:
y_true = np.array([5,6,7,5])
y_pred = np.array([5,7,7,5])
Since second element is false, how to return one-hot encoded array of false positive array like ...
0
votes
1
answer
35
views
Scikit-Learn's feature_names_in Method
A number of scikit-learn's classes have a feature_names_in method, which would be a real time saver if I could understand it better. Specifically, assume your X is a nested list of strings [['A', 'B',...
1
vote
1
answer
58
views
Panda's value_counts() method counting missing values inconsistently
Please consider this simple dataframe:
df = pd.DataFrame({'x': [1, 2, 3, 4, 10]}, index = range(5))
df:
x
0 1
1 2
2 3
3 4
4 10
Some indices:
ff_idx = [1, 2]
sd_idx= [3, 4]
One way of ...