115,128 questions
0
votes
0
answers
37
views
Why doesn’t the barycenter method detect subpixel displacements where correlation does?
I’m working with X-ray imaging data.
I have a reference image containing a structured pattern, and a sample image where this pattern is slightly distorted due to the presence of a physical sample.
My ...
1
vote
1
answer
24
views
import gensim binary incompatibility
import gensim
import numpy
import scipy
print("gensim version:", gensim.__version__)
print("numpy version:", numpy.__version__)
print("scipy version:", scipy.__version__)
...
2
votes
2
answers
58
views
Pandas: Fill in missing values with an empty numpy array
I have a Pandas Dataframe that I derive from a process like this:
df1 = pd.DataFrame({'c1':['A','B','C','D','E'],'c2':[1,2,3,4,5]})
df2 = pd.DataFrame({'c1':['A','B','C'],'c2':[1,2,3],'c3': [np.array((...
-1
votes
1
answer
69
views
python interpreter getting killed when writing into large-ish numpy array (but much smaller than the RAM)
The following python code allocates an 8GB numpy array, and writes into it. It kills the python interpreter, regardless of the size of the RAM of the machine (it happens on a server with 384GB of RAM)....
2
votes
1
answer
46
views
Alternative to looping over one numpy axis
I have two numpy arrays a and b such that a.shape[:-1] and b.shape are broadcastable. With this constraint only, I want to calculate an array c according to the following:
c = numpy.empty(numpy....
0
votes
2
answers
64
views
Unexpected behavior with array slicing and mask
It was unexpected that
x=np.empty((2,10,5))
x.shape
>>> (2, 10, 5)
x[0].shape, x[0,:,:].shape
>>> ((10, 5), (10, 5))
mask = [True,True,True,False,False]
x[0,:,mask].shape
>>&...
1
vote
0
answers
23
views
Lightgbm custom multiclass objective vs native [migrated]
I am trying to familiarise myself with the custom objective function in lightgbm. As an exercise, I am trying to rewrite the multiclass classification log loss and compare the result with the inbuilt ...
-2
votes
2
answers
86
views
Fastest way to convert results from tuple of tuples to 2D numpy.array
I'm training my AI model with a huge data set, so that it's impossible to preload all the data into memory at the beginning. I'm currently using psycopg2 to load data from a Postgresql DB during ...
1
vote
1
answer
89
views
Format np.float64 without leading digits
I need to format np.float64 floating values without leading digits before the dot, for example -2.40366982307 as -.240366982307E+01, in python.
This is to allow me to write in RINEX 3.03 the values ...
0
votes
2
answers
33
views
Python Sklearn.Model_Selection giving error numpy.dtype size changed
I have a train test split code
from sklearn.model_selection import train_test_split
train_df, test_df = train_test_split(new_cleaned_df, test_size=0.05, random_state=42, shuffle=True)
train_df....
-2
votes
1
answer
26
views
I am trying to update numpy , i use the online anaconda [closed]
(base) 08:22 ~ $ pip install numpy
Defaulting to user installation because normal site-packages is not writeable
Looking in links: /usr/share/pip-wheels
Requirement already satisfied: numpy in ./....
-1
votes
0
answers
33
views
Efficiently Finding the Indices of the N Largest Values in a NumPy Array Without Sorting the Entire Array [duplicate]
I'm working with very large NumPy arrays (millions to billions of elements) and need to find the indices of the N largest values in the array. Using np.argsort() followed by slicing to get the last N ...
2
votes
4
answers
90
views
Pandas - fillna multiple columns with a given series, matching by index?
I'd like to use a fillna command to fillna multiple columns of a Pandas dataframe with the same series, matching by index:
import numpy as np
import pandas as pd
df_1 = pd.DataFrame(index = [0, 1, 2],...
1
vote
1
answer
43
views
TypeError: Object of type ndarray is not JSON serializable despite custom converter (Nested Dict/NumPy 2.0)
I am working with simulation results stored in a deeply nested defaultdict structure. This structure (data_to_save) mixes standard Python types (lists, ints, floats, None) with NumPy arrays.
I need to ...
1
vote
1
answer
150
views
Unable to torch.load due to pickling/safety error
I am trying to use a pytorch model present on this link:
https://drive.google.com/drive/folders/121kucsuGxoYQu03-Jmy6VCDcPzqlG4cG
since it is used by this project I am trying to run:
https://github....