Stack Overflow » Machine Learning
846 FOLLOWERS
Stack Overflow is the largest, most trusted online community for developers to learn, share their programming knowledge and build their careers. This category is for implementation questions about machine learning algorithms.
Stack Overflow » Machine Learning
2h ago
from imblearn.over_sampling import SMOTE
from imblearn.under_sampling import RandomUnderSampler
from imblearn.pipeline import Pipeline
# Define features and target
X = df.drop('infected', axis=1)
y = df['infected']
# Split the data into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
# Define the resampling strategy
over = SMOTE(sampling_strategy=0.5) # Oversample the minority class to 50% of the majority class
under = RandomUnderSampler(sampling_strategy=0.8) # Undersample the majority class to 80% of its original size ..read more
Stack Overflow » Machine Learning
2h ago
I'm using gluonts.torch implementation of DeepAR to forecast a future sale using search volume as a dependent/input/dynamic variable.
my data look like this:
Date Sale Search
2018-12-30 205 13
2019-01-06 245 19
2019-01-13 207 20
2019-01-20 221 21
2019-01-27 179 17
... ... ...
2023-11-26 142 11
2023-12-03 183 13
2023-12-10 211 14
2023-12-17 236 14
2023-12-24 275 15
I did the following:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from gluonts.dataset.pandas import PandasDataset
from gluonts.torch import DeepAREstimator
from gluonts.evaluation impor ..read more
Stack Overflow » Machine Learning
2h ago
I am working with audio classification using OPENSMILE library. After preprocessing the audio data i am getting a 800x25 shaped data which is just for one file (each files is around 15 seconds long)
for training this dataset and for portability i want to convert to a CSV file, i have 5 folders in total (data/category_0 ... data/category_4) each category have around 50 files insides them (.wav) when processing one of the file data/category_0/audio1.wav after processing using Opensmile i am getting a pd data frame of shape (800x25) how should I train a multiclass classification when the data is ..read more
Stack Overflow » Machine Learning
2h ago
Practical Exam: House sales
Real Agents is a real estate company that focuses on selling houses.
Real Agents sells a variety of types of house in one metropolitan area.
Some houses sell slowly and sometimes require lowering the price in order to find a buyer.
In order to stay competitive, Real Agents would like to optimize the listing prices of the houses it is trying to sell.
They want to do this by predicting the sale price of a house given its characteristics.
If they can predict the sale price in advance, they can decrease the time to sale.
Data
The dataset contains records of previous ho ..read more
Stack Overflow » Machine Learning
2h ago
I'm trying to convert existing depth-anything PyTorch model to CoreML format. I decided to use Google Colab and took the following note for inferencing depth-anything model. However, I meet some exception while trying to import it on iOS side. Here is my code snippet for converting:
# Installing all needed extensions
!pip install coremltools
# ...
import coremltools as ct
import torch
# Convert the PyTorch model to TorchScript
traced_model = torch.jit.trace(depth_anything, torch.rand(1, 3, 518, 518))
# Convert the TorchScript model to CoreML
model_coreml = ct.convert(
traced_model ..read more
Stack Overflow » Machine Learning
2h ago
How to programmatically set alerts for failure in a W&B run?
I'm trying to set up alerts in my W&B (Weights & Biases) project to notify me if a run fails. I've been testing several functions I thought would work based on my research, but none seem to be implemented in the W&B API. Here's the code snippet where I attempt to set up these notifications:
import wandb
mode = 'dryrun'
run_name = 'my_run'
num_batches = 50
path = '/data'
name = 'experiment1'
today = '2023-08-01'
probabilities = [0.1, 0.9]
batch_size = 32
data_mixture_name = 'mix1'
debug = mode == 'dryrun'
run = wand ..read more
Stack Overflow » Machine Learning
2h ago
could someone help me out with my Pytorch installation? My device currently uses Windows OS and an AMD GPU. However, the Pytorch installation does not support Windows OS with ROCm combination. Only when Linux OS is chosen will the ROCm option be available.
Can I use CUDA toolkit in replacement of ROCm? Or do I somehow change my OS to Linux? Is there some way to by pass all of these and still be able to use Pytorch?
Any advice will be greatly appreciated!
I have tried looking for installation tutorials on youtube but they do not have the same OS and GPU combination as I do. (That is Windows OS ..read more
Stack Overflow » Machine Learning
2h ago
I am researching methods to make an attendance system, where the professor clicks few photos (2 to 3) and upload on app where automatic attendance is given for about 80 students. I am limited training Data, which is the biggest drawback and major issue we need to counter. I made a basic model that trains and marks attendance.
I need help to improve it and all the steps, like - How is CNN helpful here ? How do I train it to work like a Reward Punishment system where I can manually tell it who the person is it wasn't able to recognize so it learns on the way. Any help, advice or suggestions.
Thi ..read more
Stack Overflow » Machine Learning
2h ago
I am working on creating a PCA Index in R to understand how it works. I've used 'make up' data for this purpose. However, when I plot the scores of the first component, the results are not as expected. Specifically, the score plot shows that the index performs poorly in the first year and then rapidly improves over time, which is the opposite of what I intended.
pca <- prcomp(data, scale = TRUE, center = TRUE)
score <- scale(data) %*% pca$rotation[, 1]
plot(score)
I'm trying to figure out what I might be doing wrong or how I can interpret the results better. Any insights or suggestions ..read more
Stack Overflow » Machine Learning
2h ago
I'm trying to implement a simple UNet with different modalities. The issue is training is taking way too long and I'm constantly running into OOM errors when num_workers>0.
def train_batch(self, source, target,extra):
with profile(activities=[ProfilerActivity.CPU],profile_memory=True, record_shapes=True) as prof:
source_tensors = [tensor.to(self.device) for tensor in source]
target_tensors = [tensor.to(self.device) for tensor in target]
if ("rgb" in self.config["modalities"] or "semantic" in self.config["modalities"]):
extra_tensors = [tensor.to(devi ..read more