2,206,483 questions
Advice
0
votes
0
replies
8
views
Python code in train.py how to update it into confusion matrix
I have a project on iris classifier, I have done most of the steps but I am stuck. How do I:
1 Update the Python code in train.py so that it can:
Save the confusion matrix as a PNG image in an outputs/...
0
votes
0
answers
23
views
One aync lock call or multiple async lock calls, what is better and safer in Python?
I trying to make ratelimiter for users in aiogram bot with middlware, now I created class for requests and class for ratelimiter, where reuqest are. My problem is what is better for performance and ...
-2
votes
0
answers
71
views
Why does my model keep getting stuck in one spot? [closed]
Problem Description
The RL code implements a Gymnasium-compatible environment (DoomEnv) for training reinforcement learning agents in DOOM Retro. It captures game state (observations) via shared ...
-9
votes
0
answers
89
views
What is the purpose of the end parameter in Python’s print() function, especially in loops? [duplicate]
I am learning Python and came across the end parameter in the print() function.
By default, print() adds a newline after each output. However, I saw examples using end="" or end=" "...
1
vote
2
answers
125
views
How can I set a placeholder (sentinel) without using None?
I have a value that always needs to be defined but may not always be meaningful, and I need a placeholder for when it doesn't yet have a meaningful value. Usually, I would use None as that placeholder ...
2
votes
1
answer
40
views
Can't pickle _thread.lock objects when using multiprocessing.Pool with a class-based Logger wrapper
I am trying to parallelize a data-processing task where I've wrapped my logic inside a class. Each instance of the class is supposed to log its own progress to a centralized log file. However, as soon ...
1
vote
0
answers
37
views
Error "InvalidVersion: Invalid version: 'unknown'" when triying to load netcdf files using xarray
I'm trying to load some .nc files this way:
ds = xr.open_dataset('path/to/file.nc')
At first I get no error message, but when I try to operate or simply visualize the data I get this really long ...
Best practices
1
vote
2
replies
38
views
How to create a functional test on an existing resource on Google Cloud?
Let's take a concrete example. I created the following my_function Python function:
from google.cloud.aiplatform import Endpoint
def my_function(existing_endpoint: Endpoint)-> str:
return ...
Advice
0
votes
4
replies
51
views
Why the R^2 value of test data is significantly different from R^2 value of train data?
I am working on a dataset for Housing pricing prediction problem. While I am trying to find an estimation between the features and the dependent variable price, I found there is a significant ...
-4
votes
0
answers
33
views
I am not sure why they use fig,ax = plt.subplots() [duplicate]
Recently I started learning linear algebra using Python and I came across this matplotlib and I am not sure why they use:
fig,ax = plt.subplots()
What does it mean exactly?
-2
votes
2
answers
123
views
How do I return a input value? [duplicate]
I'm trying to return the "user_input" variable in the while loop in the "make_user_choice" function. I don't know how I should go about this.
Here's my code:
import random
"&...
2
votes
2
answers
101
views
How to maintain scale when rotating?
I've been messing around with OpenGL/ModernGL in Python/Pygame, and after getting my images rendered to the screen, I have been having issues rotating them.
I'm aware of the order that I need to ...
Best practices
0
votes
3
replies
62
views
SQL-Test-123456789_question
What sql function will display first 4 terms in a string. string are of 10-25 in total length. string can be number or letters. results should be sorted in descending order. data is for hockey ...
Tooling
0
votes
4
replies
78
views
Why is the code not working, even after import ing it
from selenium.webdriver.support import expected_conditions as EC
import time
\# 1. Setup Service and Driver
service = Service('C:/Users/HP/Desktop/Drivers/chromedriver_win32/chromedriver.exe')
driver ...
Advice
0
votes
2
replies
35
views
With the aiosmtpd python3 module, how to get the IP address of the remote connection?
I'm using the latest aiosmtpd module under Python 3.12 in LinuxMint 22.3.
When a remote SMTP connection is made to a host running aiosmtpd, how can the remote IP address of this connection be obtained ...