Questions tagged [python]

Use for data science questions related to the programming language Python. Not intended for general coding questions (-> stackoverflow).

Filter by
Sorted by
Tagged with
1 vote
1 answer
22 views

My Linear Regression Model Mean Absolute Error(MAE) is 0.29 and R2 0.20 , Is this a acceptable Model?

My Linear Regression Model Mean Absolute Error(MAE) is 0.29 and R2 0.20 , Is this a acceptable Model ? How can increase the r2 score ?
user avatar
0 votes
1 answer
23 views

How to improve the result? Should I remove the columns?

I am using this dataset, the target column is the last one which is 'DEATH_EVENT', I have separated this last one. I am using KMeans to calculate the number of hits and misses. The result is quite bad,...
user avatar
  • 1
0 votes
0 answers
16 views

Polynomial regression with two variables. How can I find expressions to describe the coefficients?

I'm not sure if this is an appropriate place for this question, so please feel free to redirect me if it is not. I just moved it from Super User, where it seemed like there weren't many similar ...
user avatar
  • 101
0 votes
1 answer
14 views

How does Pandas store timezone information?

Timestamp columns are stored internally in UTC, regardless of whether they have a timezone or not. This is stated in the docs: https://pandas.pydata.org/docs/user_guide/timeseries.html#working-with-...
user avatar
  • 101
1 vote
1 answer
40 views

What is the Purpose of Feature Selection

I have a small medical dataset (200 samples) that contains only 6 cases of the condition I am trying to predict using machine learning. So far, the dataset is not proving useful for predicting the ...
user avatar
  • 335
1 vote
2 answers
169 views

Compare string entries of columns in different pandas dataframes

I have two dataframes, df1 and df2, both with different number of rows. df1 has a column 'NAME', a short string; and df2 has a column 'LOCAL_NAME', a much longer string that may contain the exact ...
user avatar
0 votes
0 answers
24 views

KNN improvements (python)

I rencently had to work on a problem where the best baseline was knn (geolocalised data). I have different targets (binary classification, multiclass classification and regression) and associated ...
user avatar
  • 2,145
0 votes
0 answers
10 views

"Source paper" of the method Reduction in library Sumy

Does anybody know or can help me to find the source paper of the method "Reduction" of the library "sumy"? This method is here: Reduction where it says that it is based on here, ...
user avatar
0 votes
0 answers
25 views

NLP - support comments analysis

I am new to NLP and looking for some direction since after all my reading I haven't found a definite approach and the subject matter is vast. The project is to focus on specific fields of support ...
user avatar
  • 1
0 votes
0 answers
11 views

Time series classification but with a sequence in output

I'm using Python and I have a training set of sequences of this shape: (None, 9, 25), where: 9 are rows representing years from 2012 to 2020 25 are features. So each of this 25 features has a value ...
user avatar
0 votes
0 answers
57 views

How solved "ValueError: y should be a 1d array, got an array of shape () instead."?

...
user avatar
0 votes
0 answers
11 views

Unable to generate useful insights on a highly cardinal data

I'm working on CRM data, did some cleaning, encoding and ran a decision tree classifier from which i plotted a feature_importance graph From that I found that Sales person column is one of the ...
user avatar
0 votes
0 answers
50 views

Pretrain RoBERTa model with new data using PyTorch library

I've pretrained the RoBERTa model with new data using a 'simpletransformers' library: ...
user avatar
  • 105
0 votes
0 answers
12 views

Should I take the entire dataset for Linear Regression Model Training

I am new to the data science and wanted to develop a Linear Regression model to identify important factors to predict a policy holder makes a insurance claim. There are around 750,000 active policy ...
user avatar
0 votes
0 answers
85 views

Excessive GPU memory usage for Keras model.fit()

I am trying to use Keras to do some image analysis using the Xception model. When I run model.fit, GPU memory usage increases rapidly to 16 GB, despite my training data only being (7546, 299, 299, 3) ...
user avatar
  • 101
0 votes
0 answers
8 views

I am trying to save a trained model but its giving me this kind of error "NameError: name 'tfjs' is not defined" Can someone help me out?

This is the code I have written: ...
user avatar
2 votes
1 answer
87 views

Dataframe Python - Conditional Column based on multiple criteria

I want someone to correct my code in python. My goal is to create a code that will add a new column that is based on the conditional function of two columns in my dataframe. I want to add a fees ...
user avatar
0 votes
0 answers
4 views

Identifing this dataset for sanitising

I am beginner here starting with data science for analytics. I am trying to figure out what data set this is and how to read it from python. I have an idea of the steps but not sure how to code it in ...
user avatar
  • 1
0 votes
0 answers
11 views

Can orange datamining python script in_data only one widget table?

If you receive in_data from two orange widget tables with an orange Python script, you don't know how to read them like in_data1, in_data2. Can I in_data only one table? Please tell me how to import ...
user avatar
0 votes
1 answer
201 views

AttributeError: 'Functional' object has no attribute 'predict_classes''

I am trying to use run a GoogLeNet code using FERET datasets. When I run the code, I get the following error message: ...
user avatar
  • 11
1 vote
0 answers
17 views

Catboost not working properly when I remove non important variables (source of randomness?)

I was wondering if anyone has encountered the same. The thing is, when I run a catboost boosting model, delete non important variables (feature importance by prediction importance = 0, in fact these ...
user avatar
  • 111
0 votes
0 answers
12 views

Wave Function in Python

How to apply Wave Function to a Data Set in Python to derive frequency distribution and probability amplitude?
user avatar
0 votes
0 answers
8 views

how to apply segmentation on objects only

i have this image which is an output from my object detection model i wanted to apply segmentation on this image so that my mask will be like that i used grabcut algorithm but the results was too ...
user avatar
  • 1
1 vote
1 answer
68 views

How to add class labels to confusion matrix of multi class classification

How do I add class labels to the confusion matrix? The label display number in the label not the actual value of the label Eg. labels = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',...
user avatar
  • 23
1 vote
0 answers
16 views

Can I "fit" a k-nearest neighbors classifier without precomputing anything?

I am currently trying to fit a KNeighborsClassifier (scikit-learn implementation) to about a gigabyte of training data. From every resource I've read online, a k-nearest-neighbors classifier is a &...
user avatar
0 votes
0 answers
8 views

Optimally sample from multiple distributions

I have two datasets both of the form from the table below. I am interested in downselecting from dataset A by sampling from the distribution of values from dataset B. However, I want to consider both ...
user avatar
-1 votes
2 answers
35 views

unable to pass X_train and y_train in my regressor variable. i got a ValueError

...
user avatar
1 vote
1 answer
21 views

Combining two separate confusion matrix results from two seperate machine learning model to overall increase the True Positive accuracy

What are the steps involved if it is possible to add two confusion matrix results together to get a better final prediction. we have calculated two confusion matrixs as follows from naive bayes and ...
user avatar
2 votes
1 answer
51 views

Is there anyway to classify the category on give amazon reviews using python

I am trying to find a model or way to classify text which falls into a category and its a positive or negative feedback. For ex. we have three columns Review : Camera's not good battery backup is not ...
user avatar
0 votes
0 answers
16 views

How to train ML model for time series data

I am trying to build a machine learning model in python. I used pytorch and sklearn to make the model. My model is a bit ...
user avatar
  • 101
0 votes
1 answer
25 views

Using Sci-Kit Learn Clustering and/or Random-Forest Classification on String Data with Multiple Sub-Classifications

I have a set of data with some numerical features and some string data. The string data is essentially a set of classes that are not inherently related. For example: ...
user avatar
-1 votes
2 answers
141 views

Why Do a Set of 3 Clusters Across 1 Dimension and a Set of 3 Clusters Across 2 Dimensions Form 9 Apparent Clusters in 3 Dimensions?

I am sorry if this is a well-known phenomenon but I can't quite wrap my head around this. I have a related question: How To Develop Cluster Models Where the Clusters Occur Along Subsets of Dimensions ...
user avatar
1 vote
0 answers
35 views

Accuracy drops when adding a fully connected layer for dimensionality reduction to a ResNet50

I'm training a ResNet50 for image classification and I'm interested in decreasing the dimensionality of the embedded layer, in order to apply some clustering techniques. The suggested dimension is ...
user avatar
  • 61
0 votes
1 answer
14 views

Can anyone tell me how can I get the following output?

Here is my code; ...
user avatar
1 vote
1 answer
18 views

Random search grid not displaying scoring metric

I want to do a grid search of some few hyperparameters through a XGBClassifier of a binary class, but whenever i run it the score value (roc_auc) is not being ...
user avatar
0 votes
0 answers
8 views

In Python, how can I transfer/remove duplicate columns from one dataset, such that the rows and columns of all datasets would be equal?

So I've been trying to improve my Random Decision Tree model for the Titanic Challenge on Kaggle by introducing a Validation Dataset, and now I encounter this roadblock, as shown by the images below: ...
user avatar
0 votes
0 answers
88 views

How to solve this ValueError: Dimensions must be equal

I'm trying to train an autoencoder model with colored image samples but I got this error ...
user avatar
  • 1
0 votes
0 answers
6 views

ML methods for vector correlation

I am dealing with a timeseries consisting of input flow sampled every 5 minutes over 441 days. My aim is to find any possible correlation from data coming from: The same day of the week The same ...
user avatar
0 votes
1 answer
27 views

Need an example of a custom class whose instance is fed to sklearn Pipeline / make_pipeline to use with GridSearchCV

According to sklearn.pipeline.Pipeline documentation, the class whose instance is a pipeline element should implement fit() and transform(). I managed to create a custom class that has these methods ...
user avatar
  • 131
0 votes
0 answers
27 views

OpenCV warpAffine error during image augmentation using Albumentations

I have been trying to do image augmentation using a library called Albumentations. But I got some error from OpenCV while transforming the images. I ran the code below on Kaggle's notebook. The ...
user avatar
  • 1
0 votes
0 answers
19 views

Neural network model in Google Colab significantly slower with increased data points

I've made a neural network in google colab. The original data contained 12 000 rows (csv 350KB). 4 features and 2 labels. Each epoch would run within a few ms. I tried to increase the amount of data ...
user avatar
  • 103
0 votes
1 answer
36 views

How to solve MemoryError problem

I've created and normalized my colored image dataset of 3716 sample and size 493*491 as x_train, its type is list I'm tring to convert it into numpy array as follows ...
user avatar
  • 1
0 votes
0 answers
20 views

How to match the input image with the ground truth image (the order)

I'm a beginner learning deep learning and trying to do semantic segmentation problems on histologic image using python and TensorFlow. There is 2 main file : Images.npy and Labels.npy (Ground truth). ...
user avatar
  • 1
0 votes
0 answers
19 views

How to optimize Pandas DataFrame reorganizing?

I have a DataFrame which looks like this: date person value 2022-05-01 A 5 2022-05-01 B 4 2022-05-02 A 5 2022-05-02 B 9 I want to convert it to that form: ...
user avatar
0 votes
0 answers
12 views

semantic segmentation using kmeans or mean shift

i know what semantic segmentation is and i know how to do semantic segmentation using deep learning but my question here can i do semantic segmentation with a traditional way like kmeans or mean shift ...
user avatar
  • 1
0 votes
0 answers
33 views

How to optimize hyperparameters in Bert?

I am using the BERT model in order to classify stereotypes in sentences. I wanted to know if there is a way to automate the optimization of hyperparameters such as 'epochs', 'batchs' or 'learning rate'...
user avatar
  • 302
0 votes
0 answers
17 views

Python: How to construct a joyplot with values taken from a column in pandas dataframe as y axis

I have a dataframe df in which the column extracted_day consists of dates ranging between 2022-05-08 to 2022-05-12. I have another column named gas_price, which consists of the price of the gas. I ...
user avatar
1 vote
1 answer
25 views

High Performance Classification or Similarity Algorithim for Mixed Data Types?

I have a database holding 10-ish features that describe different breeds of dogs. They are mostly categorical features, but some provide ranges for values. Here's a demo representation of the database,...
user avatar
0 votes
0 answers
9 views

After a certain number of moves my tictactoe program raise an exception

I'm trying to build an AI to play tictactoe(cs50ai pset0). i have built 7 essential functions for this purpose. 1.player function that takes as an argument a board and returns whose turn is it. ...
user avatar
  • 1
0 votes
1 answer
10 views

expanding 1x1xn global average pooling output to the size of the input map HxWxn

I am trying to recreate the model in this paper : BiSeNetV2 There is one module called Context Embedding Block, in which Global Average Pooling is used to embed global information into the feature ...
user avatar