Category "numpy"

ML on apache logs

I am trying to visualize and predict application logs (I am using category model), my label category is on response time, my sample log is on below format 172.1

Deep neural network gives a constant value as output

I have implemented a neural network from scratch. I have taken random values as both input and output. When I use a single layer( with sigmoid activation) the n

mypy fails for numpy sum

This code snippet works: py -c "import numpy; print(numpy.array([[1,2,3],[4,5,6]]).sum(axis=0) % 2)" [1 1 1] But mypy gives an error: py -m mypy -c "import num

How to convert a numpy array with dtype=object to a numpy array of int?

Now I have a numpy array: In [1]: import numpy as np In [2]: a = np.ones(10) * (1 << 64) In [3]: a Out[3]: array([1.8446744073709552e+19, 1.84467440737

Given a matrix, return a list (or generator) of all it's pairwise-neighbors

Let's say i have this matrix: (doesn't have to be squared) a b c d e f g h i I want to return a list, or a generator, of all it's pairwise-neighbors. Meaning:

Saving data in the table

How I can save this: a=1b=2c=3d=4 into the table like this (I do not need header): 1 2 3 4 Thanks.

Exception has occurred: ModuleNotFoundError No module named 'tensorflow.python'

im working on Simple RNN code with python, i want to use keras but when i run the code it show to me ( tensorflow error ), i uninstall tensorflow then i install

Python Script cannot run using Batch File

hihi, I just installed Anaconda3, and my script was able to run smoothly using Spyder. But when I call it using batch file, the below error is show: C:\Users\De

Tensorflow data pipeline stops working during training

I made a Tensorflow pipeline for loading numpy arrays (video data shape (40,160,160,3)). However, it stops working after loading the first x batches. The proble

TypeError: int() argument must be a string, a bytes-like object or a number, not 'Image'

I have a folder with images, I read all the images and resize them from 300x300 to 96x96 with this code: from PIL import Image import os size = (96,96) list_of

How to sort 3d numpy masked array on time axis at each grid i.e at specific latitude and longitude for climate dataset

I have a NetCDF file of Climate dataset having 3D structure with a shape of 20 * 445 * 445 as (time, latitude, longitude) I have read it as numpy.ma.core.Masked

How to combine winter months that span 2 years?

I have a dataframe p90results that contains daily counts of temperature exceedances from 12/01/1952-12/31/2021. I want to create a plot that sums the daily exc

How to write a method to check independence which returns a dictionary of length 3

I having some difficulty to try to understand the question and I am not very sure how to get a method to returns a dictionary of length 3. This is the sample ta

Expand 2-D Numpy integer Array as binary but in parallel

I want to convert arrays of integers to 0 or 1s, padding with 0s if the other array possesses the larger value. Examples: ex1 = np.array([[0],[3]]) => array(

Using numpy.where function with multiple conditions but getting valueError

So I have a dataframe with multiple columns with numbers in them. It looks like this: H C T P R 300 200 500 0.3 500 400 300 0.2 I'm trying to perform operat

np.max() error: TypeError: only integer scalar arrays can be converted to a scalar index

I'm trying to get the np.max() function to work like a relu() function but keep getting this error: >>>np.max(0, np.arange(-5, 5)) -------------------

Working with a multiindex dataframe, to get summation results over a boolean column, based on a condition from another column

We have a multiindex dataframe that looks like: date condition_1 condition_2 item1 0 2021-06-10 06:30:00+00:00

What is the syntax for writing txt file with multiple numpy arrays+scalars and how to read it in again?

I have 2 numpy arrays of same length lets call them A and B and 2 scalar values named C and D. I want to store these values into a single txt file. I thought of

Convert numpy array into Ray dataset

What is the correct way to convert numpy array into ray's dataset? I tried the following, but its not working. import numpy as np arr = np.array([[1.9, 1.0, 1.1

How to detect the colors nicely using OpenCV python

(It is not the whole code, it's just the main part) It's just a simple project I wanted to do, not school or anything. I want to segment out the red parts nicel