/r/CodingHelp
Join our discord server: https://discord.gg/r-codinghelp-359760149683896320
1. FLAIR YOUR POSTS! Don't put tags in post titles!
2. Do not ask us to do all the coding for you unless you have money to spend. (If you have got money to spend, make that clear and the amount in question).
3. Do not post spam and/or misleading titles.
4. Do not be abusive to other coders.
5. Please format code properly, or use a site such as Gist or Pastebin. If possible please provide a live example of your issue.
6. Do not downvote people because you think they asked a dumb question. Just because you think that someone has a dumb question, doesn't mean that it is dumb to them.
7. Do not have a misleading user flair. Keep them sensible, describing your level of coding ability and/or languages you know and/or your profession.
8. Please do not ask unethical questions, such as asking for homework to be written by someone else, or asking someone to copy another project directly.
9. Make sure to follow the Reddit Rules.
Check our website https://codinghelp.site we have all the information you need there!
If you have any suggestions for flairs (programming languages or generic coding topics) that we should add, please use the button below to message the mods with your suggestion.
If approved as a sensible flair for the community to use, it will be added to our bot for automated suggestions and to the flair list for everyone to use!
Anyone who abuses this by spamming mods will be banned.
Green
Web Related Languages (Eg HTML, CSS)
Blue
App Related Languages (Eg Python, C#)
Red
Generic Coding Topics (Eg Open Source)
Yellow
Other Flairs (Eg Random, Meta)
/r/CodingHelp
I’m looking to buy a custom program that sorts discrepancies between sports betting markets and sorts by the largest discrepancy. Would this be possible given I have an account to each betting market? Could an addition to the program be written to place bets automatically? If this can’t be done exactly I’d love to just talk with someone who is interested and we can come up with a useful solution. Thank you.
I’m a university student who knows basically nothing about coding and am looking for a way to automatically refresh a tab or automatically hit the f5 key at an exact time (12:15:00.001) in order to get sports tickets before they sell out within a few seconds. I use windows on a Lenovo thinkpad laptop if that’s relevant
(Not sure what to flair this with so I picked Java)
Hello everyone, I'm trying to solve this CSES question: Grid Paths.
Here's the geeksforgeeks solution:
// C++ Code
#include <bits/stdc++.h>
using namespace std;
// Macro to check if a coordinate is valid in the grid
#define isValid(a) (a >= 0 && a < 7 ? 1 : 0)
// Direction constants
#define right 0
#define left 1
#define down 2
#define up 3
// Direction vectors for right, left, down, and up
int dx[4] = { 0, 0, 1, -1 };
int dy[4] = { 1, -1, 0, 0 };
// The path description string
string str;
int vis[7][7];
// Function to count the number of paths that match the
// description
int countPaths(int x, int y, int pos)
{
// If we have processed all characters in the string and
// we are at the lower-left square, return 1
if (pos == (int)str.length())
return (x == 6 && y == 0);
// If we have reached the lower-left square before
// processing all characters, return 0
if (x == 6 && y == 0)
return 0;
// If the current cell is already visited, return 0
if (vis[x][y])
return 0;
// Array to keep track of the visited status of the
// neighboring cells
vector<bool> visited(4, -1);
for (int k = 0; k < 4; k++)
if (isValid(x + dx[k]) && isValid(y + dy[k]))
visited[k] = vis[x + dx[k]][y + dy[k]];
// If we are at a position such that the up and down
// squares are unvisited and the left and right squares
// are visited return 0
if (!visited[down] && !visited[up] && visited[right]
&& visited[left])
return 0;
// If we are at a position such that the left and right
// squares are unvisited and the up and down squares are
// visited return 0
if (!visited[right] && !visited[left] && visited[down]
&& visited[up])
return 0;
// If we are at a position such that the upper-right
// diagonal square is visited and the up and right
// squares are unvisited return 0
if (isValid(x - 1) && isValid(y + 1)
&& vis[x - 1][y + 1] == 1)
if (!visited[right] && !visited[up])
return 0;
// If we are at a position such that the lower-right
// diagonal square is visited and the down and right
// squares are unvisited return 0
if (isValid(x + 1) && isValid(y + 1)
&& vis[x + 1][y + 1] == 1)
if (!visited[right] && !visited[down])
return 0;
// If we are at a position such that the upper-left
// diagonal square is visited and the up and left
// squares are unvisited return 0
if (isValid(x - 1) && isValid(y - 1)
&& vis[x - 1][y - 1] == 1)
if (!visited[left] && !visited[up])
return 0;
// If we are at a position such that the lower-left diagonal
// square is visited and the down and right squares are
// unvisited return 0
if (isValid(x + 1) && isValid(y - 1)
&& vis[x + 1][y - 1] == 1)
if (!visited[left] && !visited[down])
return 0;
// Mark the current cell as visited
vis[x][y] = 1;
// Variable to store the number of paths
int numberOfPaths = 0;
// If the current character is '?', try all four
// directions
if (str[pos] == '?') {
for (int k = 0; k < 4; k++)
if (isValid(x + dx[k]) && isValid(y + dy[k]))
numberOfPaths += countPaths(
x + dx[k], y + dy[k], pos + 1);
}
// If the current character is a direction, go in that
// direction
else if (str[pos] == 'R' && y + 1 < 7)
numberOfPaths += countPaths(x, y + 1, pos + 1);
else if (str[pos] == 'L' && y - 1 >= 0)
numberOfPaths += countPaths(x, y - 1, pos + 1);
else if (str[pos] == 'U' && x - 1 >= 0)
numberOfPaths += countPaths(x - 1, y, pos + 1);
else if (str[pos] == 'D' && x + 1 < 7)
numberOfPaths += countPaths(x + 1, y, pos + 1);
// Unmark the current cell
vis[x][y] = 0;
// Return the number of paths
return numberOfPaths;
}
// Driver Code
int main()
{
// Example 1:
str = "??????R??????U??????????????????????????LD????"
"D?";
cout << countPaths(0, 0, 0) << endl;
}
And here's my code:
#include <bits/stdc++.h>
#define PRINT_VECTOR(vec) for (auto &i : vec) cout << i << " "; cout << endl;
using namespace std;
#define TRUE 1
#define FALSE 0
#define RIGHT 0
#define LEFT 1
#define DOWN 2
#define UP 3
#define IS_VALID1(a) (a >= 0 && a < 7 ? TRUE : FALSE)
#define IS_VALID2(a,b) (a >= 0 && a < 7 && b >= 0 && b < 7 ? TRUE : FALSE)
string path;
int visited[7][7];
int dfs(int row, int col, int index) {
// cout << index << ": " << row << ", " << col << '\n';
if (index == (int)path.length()) return (row == 6 && col == 0);
if (row == 6 && col == 0) return 0;
if (visited[row][col]) return 0;
int visitedDirection[4] = {FALSE, FALSE, FALSE, FALSE}; // 2875578
if (col < 6) visitedDirection[RIGHT] = visited[row][col + 1];
if (col > 0) visitedDirection[LEFT] = visited[row][col - 1];
if (row < 6) visitedDirection[DOWN] = visited[row + 1][col];
if (row > 0) visitedDirection[UP] = visited[row - 1][col];
if (!visitedDirection[DOWN] && !visitedDirection[UP] && visitedDirection[RIGHT] && visitedDirection[LEFT]) return 0;
if (!visitedDirection[RIGHT] && !visitedDirection[LEFT] && visitedDirection[DOWN] && visitedDirection[UP]) return 0;
if (IS_VALID1(row-1) && IS_VALID1(col+1) && visited[row-1][col+1] && !visitedDirection[RIGHT] && !visitedDirection[UP]) return 0;
if (IS_VALID1(row+1) && IS_VALID1( col+1) && visited[row+1][col+1] && !visitedDirection[RIGHT] && !visitedDirection[DOWN]) return 0;
if (IS_VALID1(row-1) && IS_VALID1( col-1) && visited[row-1][col-1] && !visitedDirection[LEFT] && !visitedDirection[UP]) return 0;
if (IS_VALID1(row+1) && IS_VALID1( col-1) && visited[row+1][col-1] && !visitedDirection[LEFT] && !visitedDirection[DOWN]) return 0;
visited[row][col] = TRUE;
int sum = 0;
if (path[index] == '?') {
if (col < 6) sum += dfs(row, col + 1, index + 1);
if (col > 0) sum += dfs(row, col - 1, index + 1);
if (row < 6) sum += dfs(row + 1, col, index + 1);
if (row > 0) sum += dfs(row - 1, col, index + 1);
} else if (path[index] == 'R' && col < 6) {
sum = dfs(row, col + 1, index + 1);
} else if (path[index] == 'L' && col > 0) {
sum = dfs(row, col - 1, index + 1);
} else if (path[index] == 'D' && row < 6) {
sum = dfs(row + 1, col, index + 1);
} else if (path[index] == 'U' && row > 0) {
sum = dfs(row - 1, col, index + 1);
}
visited[row][col] = FALSE;
return sum;
}
int main() {
cin >> path;
cout << dfs(0, 0, 0);
}
Which seems much faster because I don't use vectors, only C arrays and I removed redundant checks and for loops. My code does return the same answer but is slower and doesn't pass the test because of that.
I'm incredibly confused as to why is my code slower and I'll greatly appreciate if someone is willing to give a look. Thanks in advance!
Do i need to become really good at coding to code a trading system? I understand the more complex the system is the harder it is but what skill level should i be at ? Let’s say i want to build a algo that is kinda like mcmc. And what level should i be at if i want to be a hedge fund manager?
Totally non coder here, don't shoot. Just a poor filmmaker trying to make horror films.
I'm generating videos on Minimax (or hailuoai), and it seems that the site reviews the video for content compliance AFTER it is fully generated. A few days ago you could actually see the latency and had around one second to click the "download" button before being hit with the "The video generation failed as it does not comply with community policies" message.
I've tried with various coding tools to trigger the dl before fully generated but so far it's a miss.
I get the same message : net::ERR_BLOCKED_BY_CLIENT
I am wondering if there is a way around that potential latency time for validation? Do I even get this right? Anyone has an opinion on this?
Minimax is super interesting and give interesting results in pretty dark and grim images, it will occasionally slip a boob, but is still pretty restricted unfortunately. The UI is a pain, but I managed to automate the generation launch.
Hi everyone,
I'm trying to work with Coqui TTS, following the tutorial for beginners here, but I keep running into a permission error. I’m using the following code for training:
import os
import torch
from trainer import Trainer, TrainerArgs
from TTS.tts.configs.glow_tts_config import GlowTTSConfig
from TTS.tts.configs.shared_configs import BaseDatasetConfig
from TTS.tts.datasets import load_tts_samples
from TTS.tts.models.glow_tts import GlowTTS
from TTS.tts.utils.text.tokenizer import TTSTokenizer
from TTS.utils.audio import AudioProcessor
output_path = "tts_train_dir"
dataset_config = BaseDatasetConfig(
formatter="ljspeech", meta_file_train="metadata.csv", path=os.path.join(output_path, "LJSpeech-1.1/")
)
config = GlowTTSConfig(
batch_size=32,
eval_batch_size=16,
num_loader_workers=4,
num_eval_loader_workers=4,
run_eval=True,
test_delay_epochs=-1,
epochs=1000,
text_cleaner="phoneme_cleaners",
use_phonemes=True,
phoneme_language="en-us",
phoneme_cache_path=os.path.join(output_path, "phoneme_cache"),
print_step=25,
print_eval=False,
mixed_precision=True,
output_path=output_path,
datasets=[dataset_config],
)
ap = AudioProcessor.init_from_config(config)
tokenizer, config = TTSTokenizer.init_from_config(config)
train_samples, eval_samples = load_tts_samples(
dataset_config,
eval_split=True,
eval_split_max_size=config.eval_split_max_size,
eval_split_size=config.eval_split_size,
)
model = GlowTTS(config, ap, tokenizer, speaker_manager=None)
if torch.cuda.is_available():
model = model.to("cuda:0")
trainer_args = TrainerArgs()
trainer = Trainer(
trainer_args, config, output_path, model=model, train_samples=train_samples, eval_samples=eval_samples
)
trainer.fit()TTS.utils.audio
TTS.utils.audio
TTS.utils.audio
When I try to run it, I get the following error:
Traceback (most recent call last):
File "C:\Users\1luki\AppData\Local\Programs\Python\Python39\lib\site-packages\trainer\trainer.py", line 1833, in fit
self._fit()
File "C:\Users\1luki\AppData\Local\Programs\Python\Python39\lib\site-packages\trainer\trainer.py", line 1785, in _fit
self.train_epoch()
File "C:\Users\1luki\AppData\Local\Programs\Python\Python39\lib\site-packages\trainer\trainer.py", line 1503, in train_epoch
for cur_step, batch in enumerate(self.train_loader):
...
File "C:\Users\1luki\AppData\Local\Programs\Python\Python39\lib\shutil.py", line 625, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'D:/Dataset AI Voice/TTS/tts_train_dir/run-November-09-2024_05+42PM-dbf1a08a\\trainer_0_log.txt'
Despite following the tutorial instructions, I'm stuck with a persistent "permission error" that I can't seem to troubleshoot. Does anyone have tips or suggestions for dealing with permission issues in this setup?
hi, my name is Joel , I am a uk based software engineer.
I have been working on an idea, using JS and a REST API in Django. the general gist of it is that it is using the canvas and added in functionality to allow users to design a functional webpage where they can choose buttons and redirects make queries and send and receive data, and use stripe to sell subscriptions or products. Basic website stuff. the webapp would include this, but also a team dashboard and hub for people to collaborate and find people who would be interested in making these webpages for business purposes. I'm thinking of letting the custom webpages leverage google maps for increased utility. I also would like to add GPT assistance features for if people want to use them on there custom webpages
Is this all too much for one application? any feedback would be appreciated.
I'm also open to any interested to help me out on what's left of the project, I have no qualms sharing credit or anything thereafter
hi so I have been scripting this for epic gen for some time now and I'm having this really annoying issue where selenium just cannot get the epic email code if anyone can help or guide me that would be helpful I'm using the website www.eztempmail.com to get the OTP for epic.
here is the code element
954727
Xpath : //*[@id="tm-body"]/main/div[1]/div/div[2]/div[2]/div/div[1]/div/div[2]/div[3]/table/tbody/tr[2]/td/table/tbody/tr[2]/td/table/tbody/tr[3]/td/table/tbody/tr/td/text()
full xpath: /html/body/main/div[1]/div/div[2]/div[2]/div/div[1]/div/div[2]/div[3]/table/tbody/tr[2]/td/table/tbody/tr[2]/td/table/tbody/tr[3]/td/table/tbody/tr/td/text()
like the title, im looking for like email bots that signs up and opens emails sent to them. If anyone knows where i can get this, please let me know thank you!
Hello.
I’m currently working on a project for a class, and I could really use some help. The task involves using linear algebra to analyze train routes, specifically finding how many ways I can travel from point A to point B on a railway network. To do this, I need to build an adjacency matrix that represents the railway system and its connections, on which I then can apply different algorithms on to find things of interest.
I’m a novice when it comes to programming, so I’m hoping to get some guidance on how to approach this problem step-by-step.
Here’s what I have so far:
I have a few questions:
Any help will be appreciated.
Thanks in advance.
Hi all,
I am a beginner working with the MOIRAIForecaster from the sktime library to predict outliers in the Description column of my dataset. My dataset is multivariate, with several sensor readings and cycle data, and I'm trying to fit and predict using the Moirai model, but I'm facing issues. Here's a summary of the dataset I'm working with:
Q_VFD1_Temperature float64
Q_VFD2_Temperature float64
Q_VFD3_Temperature float64
Q_VFD4_Temperature float64
Q_Cell_CycleCount float64
CycleState float64
I_R01_Gripper_Load float64
I_R01_Gripper_Pot float64
M_R01_BJointAngle_Degree float64
M_R01_LJointAngle_Degree float64
M_R01_RJointAngle_Degree float64
M_R01_SJointAngle_Degree float64
M_R01_TJointAngle_Degree float64
M_R01_UJointAngle_Degree float64
I_R02_Gripper_Load float64
I_R02_Gripper_Pot float64
M_R02_BJointAngle_Degree float64
M_R02_LJointAngle_Degree float64
M_R02_RJointAngle_Degree float64
M_R02_SJointAngle_Degree float64
M_R02_TJointAngle_Degree float64
M_R02_UJointAngle_Degree float64
I_R03_Gripper_Load float64
I_R03_Gripper_Pot float64
M_R03_BJointAngle_Degree float64
M_R03_LJointAngle_Degree float64
M_R03_RJointAngle_Degree float64
M_R03_SJointAngle_Degree float64
M_R03_TJointAngle_Degree float64
M_R03_UJointAngle_Degree float64
I_R04_Gripper_Load float64
I_R04_Gripper_Pot float64
M_R04_BJointAngle_Degree float64
M_R04_LJointAngle_Degree float64
M_R04_RJointAngle_Degree float64
M_R04_SJointAngle_Degree float64
M_R04_TJointAngle_Degree float64
M_R04_UJointAngle_Degree float64
Cycle_Count_New float64
I_Stopper1_Status float64
I_Stopper2_Status float64
I_Stopper3_Status float64
I_Stopper4_Status float64
I_Stopper5_Status float64
I_MHS_GreenRocketTray float64
Description float64
actual_state float64
dtype: object
Q_VFD1_Temperature float64
Q_VFD2_Temperature float64
Q_VFD3_Temperature float64
Q_VFD4_Temperature float64
Q_Cell_CycleCount float64
CycleState float64
I_R01_Gripper_Load float64
I_R01_Gripper_Pot float64
M_R01_BJointAngle_Degree float64
M_R01_LJointAngle_Degree float64
M_R01_RJointAngle_Degree float64
M_R01_SJointAngle_Degree float64
M_R01_TJointAngle_Degree float64
M_R01_UJointAngle_Degree float64
I_R02_Gripper_Load float64
I_R02_Gripper_Pot float64
M_R02_BJointAngle_Degree float64
M_R02_LJointAngle_Degree float64
M_R02_RJointAngle_Degree float64
M_R02_SJointAngle_Degree float64
M_R02_TJointAngle_Degree float64
M_R02_UJointAngle_Degree float64
I_R03_Gripper_Load float64
I_R03_Gripper_Pot float64
M_R03_BJointAngle_Degree float64
M_R03_LJointAngle_Degree float64
M_R03_RJointAngle_Degree float64
M_R03_SJointAngle_Degree float64
M_R03_TJointAngle_Degree float64
M_R03_UJointAngle_Degree float64
I_R04_Gripper_Load float64
I_R04_Gripper_Pot float64
M_R04_BJointAngle_Degree float64
M_R04_LJointAngle_Degree float64
M_R04_RJointAngle_Degree float64
M_R04_SJointAngle_Degree float64
M_R04_TJointAngle_Degree float64
M_R04_UJointAngle_Degree float64
Cycle_Count_New float64
I_Stopper1_Status float64
I_Stopper2_Status float64
I_Stopper3_Status float64
I_Stopper4_Status float64
I_Stopper5_Status float64
I_MHS_GreenRocketTray float64
Description float64
actual_state float64
dtype: object
from sktime.forecasting.moirai_forecaster import MOIRAIForecaster
import pandas as pd
import numpy as np
import torch
df = pd.read_csv(r"C:\Users\HP\Documents\AIISC\TimeSeries\Data\FF_resampled.csv")
# Step 1: Convert '_time' column to datetime format
df['_time'] = pd.to_datetime(df['_time'], format='ISO8601')
# Step 2: Set '_time' as index
df.set_index('_time', inplace=True)
# Step 3: Sort by index to ensure chronological order
df.sort_index(inplace=True)
# Load your dataset
# Define the target variable y and feature variables X
y = df['Description'] # Replace 'your_target_column' with the name of the column you want to forecast
X = df.drop(columns=['Description']) # Drop the target from X
# Initialize the forecaster
morai_forecaster = MOIRAIForecaster(checkpoint_path="sktime/moirai-1.0-R-small")
# Fit the forecaster
morai_forecaster.fit(y, X=X)
# Prepare test data for prediction (modify as needed for your forecasting horizon)
X_test = X.iloc[-10:] # Last 10 samples as an example, adapt based on your needs
forecast = morai_forecaster.predict(fh=range(1, 11), X=X_test)
print(forecast)
from sktime.forecasting.moirai_forecaster import MOIRAIForecaster
import pandas as pd
import numpy as np
import torch
df = pd.read_csv(r"C:\Users\HP\Documents\AIISC\TimeSeries\Data\FF_resampled.csv")
# Step 1: Convert '_time' column to datetime format
df['_time'] = pd.to_datetime(df['_time'], format='ISO8601')
# Step 2: Set '_time' as index
df.set_index('_time', inplace=True)
# Step 3: Sort by index to ensure chronological order
df.sort_index(inplace=True)
# Load your dataset
# Define the target variable y and feature variables X
y = df['Description'] # Replace 'your_target_column' with the name of the column you want to forecast
X = df.drop(columns=['Description']) # Drop the target from X
# Initialize the forecaster
morai_forecaster = MOIRAIForecaster(checkpoint_path="sktime/moirai-1.0-R-small")
# Fit the forecaster
morai_forecaster.fit(y, X=X)
# Prepare test data for prediction (modify as needed for your forecasting horizon)
X_test = X.iloc[-10:] # Last 10 samples as an example, adapt based on your needs
forecast = morai_forecaster.predict(fh=range(1, 11), X=X_test)
print(forecast)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[21], line 3
1 # Prepare test data for prediction (modify as needed for your forecasting horizon)
2 X_test = X.iloc[-10:] # Last 10 samples as an example, adapt based on your needs
----> 3 forecast = morai_forecaster.predict(fh=range(1, 11), X=X_test)
5 print(forecast)
File c:\ProgramData\anaconda3\Lib\site-packages\sktime\forecasting\base\_base.py:2482, in _BaseGlobalForecaster.predict(self, fh, X, y)
2480 # we call the ordinary _predict if no looping/vectorization needed
2481 if not self._is_vectorized:
-> 2482 y_pred = self._predict(fh=fh, X=X_inner, y=y_inner)
2483 else:
2484 # otherwise we call the vectorized version of predict
2485 y_pred = self._vectorize("predict", y=y_inner, X=X_inner, fh=fh)
File c:\ProgramData\anaconda3\Lib\site-packages\sktime\forecasting\moirai_forecaster.py:318, in MOIRAIForecaster._predict(self, fh, y, X)
315 pred_df = self._convert_hierarchical_to_panel(pred_df)
316 _is_hierarchical = True
--> 318 ds_test, df_config = self.create_pandas_dataset(
319 pred_df, target, feat_dynamic_real, future_length
320 )
322 predictor = self.model.create_predictor(batch_size=self.batch_size)
323 forecasts = predictor.predict(ds_test)
File c:\ProgramData\anaconda3\Lib\site-packages\sktime\forecasting\moirai_forecaster.py:478, in MOIRAIForecaster.create_pandas_dataset(self, df, target, dynamic_features, forecast_horizon)
470 dataset = PandasDataset.from_long_dataframe(
471 df,
472 target=target,
(...)
475 future_length=forecast_horizon,
476 )
477 else:
--> 478 dataset = PandasDataset(
479 df,
480 target=target,
481 feat_dynamic_real=dynamic_features,
482 future_length=forecast_horizon,
483 )
485 return dataset, df_config
File <string>:12, in __init__(self, dataframes, target, feat_dynamic_real, past_feat_dynamic_real, timestamp, freq, static_features, future_length, unchecked, assume_sorted, dtype)
File c:\ProgramData\anaconda3\Lib\site-packages\gluonts\dataset\pandas.py:119, in PandasDataset.__post_init__(self, dataframes, static_features)
114 if self.freq is None:
115 assert (
116 self.timestamp is None
117 ), "You need to provide freq along with timestamp"
--> 119 self.freq = infer_freq(first(pairs)[1].index)
121 static_features = maybe.unwrap_or_else(static_features, pd.DataFrame)
123 object_columns = static_features.select_dtypes(
124 "object"
125 ).columns.tolist()
File c:\ProgramData\anaconda3\Lib\site-packages\gluonts\dataset\pandas.py:335, in infer_freq(index)
331 freq = pd.infer_freq(index)
332 # pandas likes to infer the start of x frequency, however when doing
333 # df.to_period("<x>S"), it fails, so we avoid using it. It's enough to
334 # remove the trailing S, e.g MS -> M
--> 335 if len(freq) > 1 and freq.endswith("S"):
336 return freq[:-1]
338 return freq
TypeError: object of type 'NoneType' has no len()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[21], line 3
1 # Prepare test data for prediction (modify as needed for your forecasting horizon)
2 X_test = X.iloc[-10:] # Last 10 samples as an example, adapt based on your needs
----> 3 forecast = morai_forecaster.predict(fh=range(1, 11), X=X_test)
5 print(forecast)
File c:\ProgramData\anaconda3\Lib\site-packages\sktime\forecasting\base\_base.py:2482, in _BaseGlobalForecaster.predict(self, fh, X, y)
2480 # we call the ordinary _predict if no looping/vectorization needed
2481 if not self._is_vectorized:
-> 2482 y_pred = self._predict(fh=fh, X=X_inner, y=y_inner)
2483 else:
2484 # otherwise we call the vectorized version of predict
2485 y_pred = self._vectorize("predict", y=y_inner, X=X_inner, fh=fh)
File c:\ProgramData\anaconda3\Lib\site-packages\sktime\forecasting\moirai_forecaster.py:318, in MOIRAIForecaster._predict(self, fh, y, X)
315 pred_df = self._convert_hierarchical_to_panel(pred_df)
316 _is_hierarchical = True
--> 318 ds_test, df_config = self.create_pandas_dataset(
319 pred_df, target, feat_dynamic_real, future_length
320 )
322 predictor = self.model.create_predictor(batch_size=self.batch_size)
323 forecasts = predictor.predict(ds_test)
File c:\ProgramData\anaconda3\Lib\site-packages\sktime\forecasting\moirai_forecaster.py:478, in MOIRAIForecaster.create_pandas_dataset(self, df, target, dynamic_features, forecast_horizon)
470 dataset = PandasDataset.from_long_dataframe(
471 df,
472 target=target,
(...)
475 future_length=forecast_horizon,
476 )
477 else:
--> 478 dataset = PandasDataset(
479 df,
480 target=target,
481 feat_dynamic_real=dynamic_features,
482 future_length=forecast_horizon,
483 )
485 return dataset, df_config
File <string>:12, in __init__(self, dataframes, target, feat_dynamic_real, past_feat_dynamic_real, timestamp, freq, static_features, future_length, unchecked, assume_sorted, dtype)
File c:\ProgramData\anaconda3\Lib\site-packages\gluonts\dataset\pandas.py:119, in PandasDataset.__post_init__(self, dataframes, static_features)
114 if self.freq is None:
115 assert (
116 self.timestamp is None
117 ), "You need to provide freq along with timestamp"
--> 119 self.freq = infer_freq(first(pairs)[1].index)
121 static_features = maybe.unwrap_or_else(static_features, pd.DataFrame)
123 object_columns = static_features.select_dtypes(
124 "object"
125 ).columns.tolist()
File c:\ProgramData\anaconda3\Lib\site-packages\gluonts\dataset\pandas.py:335, in infer_freq(index)
331 freq = pd.infer_freq(index)
332 # pandas likes to infer the start of x frequency, however when doing
333 # df.to_period("<x>S"), it fails, so we avoid using it. It's enough to
334 # remove the trailing S, e.g MS -> M
--> 335 if len(freq) > 1 and freq.endswith("S"):
336 return freq[:-1]
338 return freq
TypeError: object of type 'NoneType' has no len()
|| || ||
Does the MOIRAIForecaster support multivariate forecasting out of the box? If not, are there any recommended workarounds?
Could the error be related to the dataset structure, or am I missing something in terms of preprocessing?
Apologies if this is a basic question—I’m still learning the ropes! I'd greatly appreciate any advice or pointers to help me get this working.
Thanks in advance!
I have a a number of code blocks in a folder that have three separate types of files mixed up. I have to reconstruct each file type, using all the blocks of code. I have been trying with python, but certain snippets of code that I know belong to one file type keep getting tagged as one of the other file types. I'm getting frustrated and just looking for suggestions on how to approach this, not actual code of any kind. Idk if I explained this right; picture three loaves of bread sliced up. You can tell the beginning and end of each loaf, but since all the loaves are the same color you have to determine the ingredients of each slice, and which order to put each loaf back together. Thanks for any help!
I can't seem to find the mistake in my code, maybe someone else could help:
#!/bin/bash
# Set the path to my SRA accession list file
accession_list="my_path"
# Read each accession number from the file
while IFS= read -r accession; do
echo "Processing $accession..."
# Download the SRA file with prefetch
prefetch "$accession"
if [[ $? -ne 0 ]]; then
echo "Error: prefetch failed for $accession"
continue
fi
# Convert the SRA file to FASTQ format
fasterq-dump "$accession" -O .
if [[ $? -ne 0 ]]; then
echo "Error: fasterq-dump failed for $accession"
continue
fi
# Compress the resulting FASTQ files if they exist
if [[ -f "${accession}_1.fastq" && -f "${accession}_2.fastq" ]]; then
gzip "${accession}_1.fastq" "${accession}_2.fastq"
else
echo "Error: FASTQ files for $accession not found, skipping compression."
continue
fi
# Delete the original SRA file
rm -f "$HOME/ncbi/public/sra/${accession}.sra"
if [[ $? -ne 0 ]]; then
echo "Warning: Failed to delete SRA file for $accession"
fi
echo "$accession processed successfully."
Any course or youtube channel?
Key Takeaways
Hey everyone! I’m working on a project for a college where we need to create an analytical dashboard. Basically, teachers, workers, and students will get rated on ~30 weighted questions by five different people.
I’m thinking of using Flask for taking inputs and Dash for the visualizations, something like a Power BI experience but custom-built in Python.
Would really appreciate any advice, feedback, or suggestions. Thanks a lot in advance!
Hey everyone,
I'm trying to install the TTS
package in Visual Studio Code using pip install TTS
, but I keep getting build errors, and I'm not sure what’s going wrong.
Here’s the error I’m seeing:
An error happened while installing `TTS` in editable mode.
The following steps are recommended to help debug this problem:
- Try to install the project normally, without using the editable mode.
Does the error still persist?
(If it does, try fixing the problem before attempting the editable mode).
- If you are using binary extensions, make sure you have all OS-level
dependencies installed (e.g. compilers, toolchains, binary libraries, ...).
- Try the latest version of setuptools (maybe the error was already fixed).
- If you (or your project dependencies) are using any setuptools extension
or customization, make sure they support the editable mode.
After following the steps above, if the problem still persists and
you think this is related to how setuptools handles editable installations,
please submit a reproducible example
(see https://stackoverflow.com/help/minimal-reproducible-example) to:
https://github.com/pypa/setuptools/issues
See https://setuptools.pypa.io/en/latest/userguide/development_mode.html for details.
********************************************************************************
!!
cmd_obj.run()
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building editable for TTS
Failed to build TTS
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (TTS)
I’ve tried a few different things so far, including:
pip
version (pip install --upgrade pip
)But nothing seems to work. Has anyone else had this issue with TTS
or a similar package? Any help would be greatly appreciated!
Hello I need to change this code to select ‘A’ instead of ‘B+’. I essentially need to mass select grades and inputting them one by one is timing consuming. A is one space above B+. I get this code my hitting “control + command + C “ on my evaluation list. I am obviously an amateur.
This is the current code:
$("td select").each(function(){ $(this).val(2).change() });
for( var i = 0; i < $('.select-top select option').length; i++){ $('.select-top select').val(i).change(); $(".btn_right button").click(); }
Hello all, I want to build a program that can recognize an application on my computer screen and take various important parts such as the certain color or shape of an object in any given spot on the screen and can recognize certain assets/ objects on the application window and convert all of this relevant information into a text document. Any ideas on the most efficient way to do a project like this? I was thinking Image recognition but i’m wondering if my project is simple enough to use something less advanced. Am I way underestimating the difficulty and workload of this project?
I've looked up answers and have yet to find one that can help with this current issue. I've been trying to work on an AI that can translate different languages into another language using tts and stt. It continues to give me:
AttributeError: 'NoneType' object has no attribute 'group'
I only have 35 lines of code since I haven't gotten that far with it, but the only line in my code it mentions is line 21. translation = translator.translate(text, dest='en')
I've tried everything I can, and I can't seem to get anywhere with it. I just need someone to help me understand what I'm doing wrong with this particular line and why I can't get it to work. If this post ain't allowed, just go ahead and take it down. I'm not used to asking for help all that much, but the has gotten unbearable.
I am trying to bind an image in the PDF. In the local environment it is working fine. When I deployed to IIS the image is not binding. Is that because the image URL don't have any SSL certificate?
Technology: .NET Core 3
Heya. So I've got a little C++ project where I want to be able to store information in a local database for the user. I figured that I'd use SQLite3 because, hey, I love SQLite3 for so many reasons. I managed to figure out how to link the SQLite3 library into my project, figuring once I had that part done, it would be easy from there.
Insert laughtrack.
(Not sure how relevant it is, but I started by adapting code from here.)
The main issue I'm running into is that the SQLite3 library is technically not C++ but C, which 1) I don't really have experience in, 2) doesn't have std::string
. In fact, it only appears to accept char *
for the SQL commands (and I'm admittedly rusty on how exactly pointers work).
And technically, stuff like this will work...
sql = "create table test (" \
"ID int primary key
not null);";
(Despite my compiler throwing a warning that converting a string literal this way isn't allowed.)
But my REAL issue is that I want to use variables in my SQL commands. (And I honestly wonder what database would really be usable without them.) And I'm having a heck of a time trying to figure out how to make that work. I've tried a bunch of things (mainly strcat()
, strncat()
and/or strcopy()
combined with .c_str()
) without finding an approach that doesn't result in some kind of error.
(And of course, a lot of the answers to these questions consist of telling people to just use str::string
, generally saying it's superior. Believe you me, I agree, and I would if I could, but I can't, so I shan't. 🙄 And I can't help but wonder if it was the same for any of the other askers...)
It also occurred to me kind of belatedly that it'd probably be smarter to keep everything as a std::string
until I convert it at the last second, but the problem is basically the same. I think the only guide I found for converting std::string
for use with C-based code uses non-pointer-based char[]
s, which doesn't help as well if you don't remember how to convert to char *
. 😅 I also want to avoid basic arrays, in general, because I'm going to have very little idea how long the strings might get, and want to be on the safest side possible on that front.
I'm at a point where I want to avoid unnecessary trial and error, and am very willing to consider alternatives that achieve the same goal. 😅
So my main questions:
std::string
to char *
?I would also like to kindly ask that you politely refrain from answering questions that I didn't specifically ask, unless you see a REALLY good reason to do so, because people making (often incorrect) assumptions about what the coder is trying to accomplish has kind of been my bane, lately. (This isn't the only thing related to this project where I've run into that. 😂)
Thanks. 🙂
I've been working to create live practice sessions to help job seekers not bomb their interviews. So far there are 150+ different templates and practice sessions. There was a lot of engineering to create real-time experiences, so please feel free to check out mercor.com/interviews
Main features:
You can take as many interviews as you want for free here: mercor.com/interviews .Comment or DM me with any feedback/suggestions.
I can’t send any pictures here but I would be really glad if someone would help me
Create a Pseudocode for the Following Problem
Question:
Daily Life Magazine wants an analysis of the demographic characteristics of its readers. The marketing department has collected reader survey records containing the age, gender, marital status, and annual income of readers. Design an application that allows a user to enter reader data and, when data entry is complete, produces a count of readers by age groups as follows: younger than 20, 20–29, 30–39, 40–49, and 50 and older.
Hint:
You will need 3 tables, one to store the low-end for AGE_RANGE like the pseudocode on p. 254, an ageCnt to count the number of people in each age range like on p. 236 and the Ch 6 Program Example. In addition, you will define a table to store the various AGE_GROUPS for the output (which will be like what we did on p. 236 in the FinishUp() module -- see output example below.
In the Declaration the tables would look like this: Hope this helps
num ageCnt [SIZE] = 0
num AGE_RANGE [SIZE] = 0, 20, 30, 40, 50
string AGE_GROUP [SIZE] = 'under 20', '20 thru 29', '30 thru 39', '40 thru 49', '50 and over'
string HEADING1 = " Age Range Count"
p. 254 Example:
start
Declarations
num quantity
num SIZE = 4
num DISCOUNTS[4] = 0, 0.10, 0.15, 0.20
num QUAN_LIMITS[4] = 0, 9, 13, 26
num x
num QUIT = -1
housekeeping()
while quantity <> QUIT
determineDiscount()
endwhile
finish()
stop
housekeeping()
output "Enter quantity ordered or ", QUIT, " to quit "
input quantity
returndetermineDiscount()
x = SIZE - 1
while quantity < QUAN_LIMITS[x]
x = x - 1
endwhile
output "Your discount rate is ", DISCOUNTS[x]
output "Enter quantity ordered or ", QUIT, " to quit "
input quantity
return
finish()
output "End of job"
return
I assume my professor wants my code to look like the example given, thanks for any help!
All my npm commands are hanging. They were working well initially, but the issue started after I installed Docker (I was using Docker Desktop). Could this issue be Docker-related and how can I fix it?
Hey there, Im coding on my note pad, using command prompt to run my software. Ive come to a road block where as my software goes through google pages, it’s inevitably hit with a captcha. Are there any ways to deal with this. I code with phyton.
Thanks
Hey there everyone!
Recently, I've started looking into a hard technical skill, mainly for the reason of growing a career out of it.
My first guess was getting into coding.
I'm 19 years old, in my senior year in highschool, so I wouldn't be too late for the party I reckon.
So then, do you think this skill is worth investment into?
I'd be more than happy if you shared your experiences, learning lessons, anything important to you on your journey!
Thanks! ;)
Hi All
I've built a Coding Tutor for Python, JavaScript, PHP, Bash and PowerShell - you need to register to make use of it - but there is a free option for the first 10 lessons of each beginner class. There is also a guide to explain how to set your system up if you need help. I welcome feedback https://autocodewizard.com/courses_home/ - Happy coding!