I am trying to fit LSTM model, but it gave me an error with the shape. my dataset has 218 rows and 16 features including the targeted one. I split the data, %80 for training and %20 for testing, after compiling the model and run it, i got this error: Variable definitions: batch_size = 160 epochs = 20 timestep…
What version of dash is needed for core components to work?
I made the mistake of updating a package near the end of a project that utilized the dash core components (to get a feature to work). The project has stopped working. According to this site it states it is dependent on dash, but fails to work with the latest version of dash if I understand correctly. Is there…
pytorch cuda out of memory while inferencing
I think this is a very basic question, my apologies as I am very new to pytorch. I am trying to find if an image is manipulated or not using MantraNet. After running 2-3 inferences I get the CUDA out of memory, then after restarting the kernel also I keep getting the same error: The error is given below: Runt…
What’s the cleanest way of counting the iteration of a queryset loop?
I need to loop through a queryset and put the objects into a dictionary along with the sequence number, i, in which they appear in the queryset. However a Python for loop doesn’t seem to provide a sequence number. Therefore I’ve had to create my own variable i and increment it with each loop. I…
I want to change api response json in fastapi | pydantic
I am new in fastapi and please help me! I got an validation error when I change the default API response comes when I use response_model in fastAPI. The default API response is simple json like object from response_model. user.py schemas.py Now, when I run this code it gives me errors like below mentioned. Be…
Python – compare two string by words using difflib and print only difference
Python newbie here. I have the following code to compare two strings using difflab library. The output is prefixed with ‘+’,’-‘ for words which are different. How to get only the differences printed without any prefix? The expected output for the below code is Not in first string: Nvdi…
Why doesn’t str.replace replace ALL values in selected pandas dataframe column?
I’m working on a huge file that has names in columns that contain extraneous values (like the “|” key) that I want to remove, but for some reason my str.replace function only seems to apply to some rows in the column. My column in the dataframe summary looks something like this: As you can s…
Automate appending yesterday’s date to end of file names using Python?
I’m trying to solve a problem at work, I am not a developer but work in general IT operations and am trying to learn a bit here and there, so I may be way off right now with what I’m trying to do here. I’ve just been utilizing online resources, here and a little bit from the book Automate th…
Apply condition in for loop to each element in a list of lists
I am trying to see if each value in array is less then 0 then output 0, else output the number itself. The output must have the same dimensions as the input. Currently the input is a 3 by 4 but output is a list. How do I get the output size the same (3 by 4 array)? Answer Python’s
In Python, I want to add a number to each element in a list, but I get [[0,1],2] instead of [0,1,2]. How to fix this?
I have For each element in listB, I want to extend it to a length-3 element by adding a number that is in listall but not in this element. My desired output is the following list: As a first step, I tried the following code: However, the output I got is: This is far from what I wanted. As each