machine-learning

High metrics value for linear regression model

High metrics value for linear regression model Question: I’m working with a dataset of cars, containing 10k rows and 5 columns: id mileage_per_year model_year price sold There are two negative values in the price column, I didn’t know if I should 0 it or just leave it, and so, I left it untouched. I don’t …

Total answers: 1

How do you load a specific GPU from CUDA_AVAILABLE_DEVICES in PyTorch?

How do you load a specific GPU from CUDA_AVAILABLE_DEVICES in PyTorch? Question: I came up with this code but it’s resulting in never ending bugs: def get_device_via_env_variables(deterministic: bool = False, verbose: bool = True) -> torch.device: device: torch.device = torch.device("cpu") if torch.cuda.is_available(): if ‘CUDA_VISIBLE_DEVICES’ not in os.environ: device: torch.device = torch.device("cuda:0") else: gpu_idx: list[str] = …

Total answers: 2

ImportError: cannot import name '_check_weights' from 'sklearn.neighbors._base'

ImportError: cannot import name '_check_weights' from 'sklearn.neighbors._base' Question: I am trying to do Missforest as a method for handling missing values in table data. import sklearn print(sklearn.__version__) ->1.2.1 import sklearn.neighbors._base import sys sys.modules[‘sklearn.neighbors.base’] = sklearn.neighbors._base !pip install missingpy from missingpy import MissForest It was working fine until now, but since yesterday, the following error message …

Total answers: 2

refactor age imputation

refactor age imputation Question: How can I refactor the following code to make sure it easier to read and better using a function. Can reproduce code and data frames used using GitHub https://github.com/hamidpat/titanic posted csv used on my github. import numpy as np import pandas as pd train_df = pd.read_csv("train_df.csv") test_df = pd.read_csv("test_df.csv.csv") combine = …

Total answers: 2

How to use the dataset comes from pytorch random_split()?

How to use the dataset comes from pytorch random_split()? Question: I’m new to pyTorch and this is my first project. I need to split the dataset and feed the training dataset to model. The training dataset must be splitted in to features and labels (which I failed to do that). Here is what I have …

Total answers: 2

AI algorithm for adjust percentages and constant coefficients values

AI algorithm for adjust percentages and constant coefficients values Question: I’m making an application that will help the people to donate stuff in one delivery point and then the application will determine who suits the item donated perfectly (the beneficiaries who receive the donations are inserted in the database previously) I’m making an algorithm to …

Total answers: 1

Tensorflow: The channel dimension of the inputs should be defined

Tensorflow: The channel dimension of the inputs should be defined Question: I am new to Tensorflow, and am trying to train a specific deep learning neural network. I am using Tensorflow (2.11.0) to get a deep neural network model which is described below. The data which I use is also given below: Data: Here is …

Total answers: 1

Python doesn't know the class attributes, while Jupyter does

Python doesn't know the class attributes, while Jupyter does Question: I have this code from StatQuest channel. This code works in Jupyter, however when I run this in a .py file, it reports the error AttributeError: ‘BasicNNTrain’ object has no attribute ‘w00’ This is the code: import torch import torch.nn as nn import torch.nn.functional as …

Total answers: 1