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
0answers
8 views

Is it possible to perform Semantic Textual Similarity without using NLTK and Genism?

College restricted us to make projects in object oriented programming languages but without using any other libraries except standard ones. We can not use APIs also
-1
votes
0answers
9 views

LSE linear regression

I have the following: Training set - X values mapped to 4 different y values [400x5] Test set - X values mapped to 1 y value [400x2] The objective is to get the best function which minimizes the LSE....
3
votes
1answer
9 views

Extract date/duration from text

The text and output to be extracted are similar to the following : "Check it every two weeks" - two weeks "Check it on day 1 and day 14" - day 1 and day 14 "day 19 and day ...
-1
votes
0answers
9 views

Multiple Audio chunk export to a directory [closed]

We want to split each audio files in 10 audio chunks. This is our code: ...
0
votes
1answer
13 views

How to Connect Convolutional layer to Fully Connected layer in Pytorch while Implementing SRGAN

I was implementing the SRGAN in PyTorch but while implementing the discriminator I was confused about how to add a fully connected layer of 1024 units after the final convolutional layer My input ...
0
votes
0answers
4 views

Unidentified Image error while loading images on Google Colab

I'm writing a code to make movie genre classification with movie posters. I opened a github repository where I put all the posters and cloned it on Colab. Until here, eveything works fine. When I'm ...
0
votes
0answers
7 views

object detection algorithm for video

Is there any way to convert the detected object from an object detection algorithm (Mask RCNN in my case) to a white silhouette (while the background has been set to black)? I have commented on the ...
0
votes
0answers
14 views

ValueError: Could not guess the value column! Please hand it to the function as an argument

I'm using the tsfresh library to extract features on my data but I keep getting an error: ...
0
votes
0answers
6 views

Why Spyder Python throwing error in I/O operation despite it?

Why Spyder Python stated that my code has error valued I/O operation & [SpyderKernelApp] ERROR | Error in message handler while when I run in PyCharm or copy it in Jupyter the code seems fine? ...
2
votes
1answer
15 views

how to programmatically introduce grammatical errors in sentences

I've a set of sentences in English language. I'm exploring ways to create a dataset of sentences with grammatical errors programmatically. The following options has been tried out randomly - identify ...
0
votes
0answers
22 views

Custom Machine translation not giving correct output even when using the training data for prediction

Python : 3.7 Tensorflow : 2.3 model : ...
0
votes
0answers
13 views

Feature Engineering and prediction with R and python

I have a sequential dataset, and have 2000 rows for 300 ID. I have 20 variables (i.e in my real dataset) ...
0
votes
0answers
13 views

How to use pivot_table on a dataframe? How to handle exceptions.UFuncTypeError?

I tried to use the pivot_table function on a dataframe. This was working at the beginning now I get all the time errors, and don't really get why. ...
0
votes
1answer
14 views

Is it ok to fill a pandas dataframe with NaN values?

Is it correct to fill a pandas dataframe with NaN values? In specific: if I have a dataframe with a user name and his age is it ok to fill the age column with int and NaN values. ...
1
vote
0answers
17 views

Top-K vs AUC - communicating results and next steps

I have a bi-LSTM multi-label text classification model which when training on a highly imbalanced dataset with 1000 possible labels gives a top-k (k=5) categorical accuracy of 86% and a focal loss of ...
-2
votes
0answers
14 views

KeyError: 'tweets' [closed]

i am having issues with sentiment-analysis with flask api , it giving me error,kindle share some knowledge thanks in advance ...
0
votes
0answers
9 views

Preprocessing of images [closed]

Except for edge detection, what other techniques in opencv do you recommend for pre-processing of x ray images to be used in detecting soft tissues and joints? Thank you in advance for your help.
0
votes
0answers
9 views

Correcting for seasonality on multiple timelines

I have many time-series of economic data, broken down quarterly. There is always an element of seasonality in each timeline, but it can very wildly. See the below charts: I'd like to correct for ...
0
votes
2answers
12 views

How to retrieve column names from applying a wrapper method in feature selection?

This question probably has a simple answer to it, so I will get to the point... How do I retrieve the names of the columns from applying a wrapper method in feature selection? Code I have used: ...
-1
votes
2answers
33 views

Machine Learning for medical researchers [closed]

My friend is a medical researcher and he want to use machine learning for prediction. Is there any one who is not a computer science person and he learnt programming and machine learning in a very ...
0
votes
1answer
13 views

Trying to run a kaggle notebook

I'm found an interesting problem on kaggle and more or less solved it with my limited knowledge of machine learning. I was curious how other people solved and checked the solution with the highest ...
1
vote
0answers
14 views

Interpreting in higher dimensions with maximal spacing

I have data that I would like to interpret in higher dimension (sort of the opposite of an auto-encoder). What I intent to achieve is, an m dimension data being ...
1
vote
1answer
15 views

How to determine whether a semantic concept is present in a string

I need to find a way to detect if a large string contains a specific substring. Imagine that I have a full contract page converted to string in my Python program. What I want to do is to say if a ...
0
votes
1answer
26 views

Problem reading python code

Can someone explain the following python code. value_geojson["features"][0]["properties"]["title"] value_geojson is a geojson ...
0
votes
2answers
32 views

Error when trying .transform for OrdinalEncoder from Scikit Learn

I'm having a lot of issues using scikit learn recently and was hoping someone could help me with my problem. I can use other methods to ordinal encode but i want to figure this one out. ...
2
votes
1answer
63 views

ML/NN as Function Evaluator for further Optimization (maximization) - Practical Example

I am working on a production optimization problem; a very similar idea to what is described by Vegard Flovik How to use machine learning for production optimization. The following image, taken from ...
1
vote
2answers
23 views

How do I calculate distance of test data point from centroids in KMeans scikit-learn?

I am using Kmeans clustering on my data After training the model, I want to calculate the distance between Test Data points and CLuster centers. How do I do it? ...
0
votes
0answers
22 views

different results than in tutorial about matplotlib and heatmaps [closed]

According to a tutorial/blogpost I should get the value '20.00 ' when running the following code: ...
0
votes
0answers
27 views

Confusion Matrix after XGBoost is showing positive as negative class

Please can you help me with confusion matrix. I've implemented the XGBoostClassifier. After fitting the model when I looked to the confusion matrix to view the performance on Test data. The confusion ...
0
votes
2answers
21 views
0
votes
0answers
11 views

Forecasting Weekly Average Usage

In python/pandas what would you suggest as a couple of good basic methodologies to use to forecast weekly average usage of user activity on a given platform?
0
votes
0answers
16 views

Opencv installation problem

I tried to install opencv using cmake to work with gpu. After installation, I try to confirm installation. So, I open anaconda prompt and python >> then import cv2. However, I got the error of ...
0
votes
0answers
13 views

Linear regression on car dehko dataset , validation loss lower than traiing

I was performing a simple regression on the car dehko dataset (Version 3, you can find it here), and I found that the validation loss is always lower than the training one. Generally, I did some basic ...
1
vote
1answer
8 views

Replace Missing Values with Most Frequent number under Condition

I'm trying to replace missing values of column "Age" but under condition of other columns on this data Titanic - Machine Learning from Disaster ...
1
vote
0answers
21 views

Extracting rules in regression tree in Python

I don't know if this question is a complicated question or not. I wanna train a regression tree in which in leaves, linear regression is applied to predict. Then, when the tree and linear regression ...
0
votes
0answers
19 views

Optimizing regression weights for NN outputs with PyTorch

So I'm basically trying to fit a regression on the relation of the input and output of a neural network model. Then the idea is, that these estimated regression weights should be optimized to some ...
0
votes
0answers
10 views

Rating Sports Teams: How to perform least squares minimization with a constraint?

I am trying to rate NFL teams by minimizing the sum of squared errors subject to a constraint. My data looks like: ...
0
votes
1answer
19 views

Document Image Layout Classification

I am trying to create a OCR model that can extract text from images of documents. There are two types of resumes. Resumes that are kind of plain in terms of 'layout' (unlike the resumes that I have ...
0
votes
2answers
25 views

Variance of product of a matrix and vector using Python

I am trying to calculate the variance of the product of matrix A and vector b. As it was mathematically discussed on another post https://math.stackexchange.com/questions/2365166/what-is-the-variance-...
0
votes
0answers
9 views

What exactly negative/positive value of Captum's Integrated Gradient mean?

I use Captum's Integrated Gradient to interprete my PyTorch's neural network. I know that from github and original paper mentioned that ... Positive attribution score means that the input in that ...
0
votes
1answer
20 views

How to replace values in a numpy array?

I'm learning how to implement and evaluate a Logistic Regression Model, for this I need to change the values of my array from strings to 0 & 1. I have the following numpy ndarray as a result of a <...
1
vote
1answer
30 views

Is there a flexible way to get the original data indices from each cell of a confusion matrix?

Let's say I have model A and model B, that I want to compare the performance of by inspecting a confusion matrix. They both produce a list of predictions, pred_A ...
-1
votes
0answers
14 views

Python output problem [closed]

I am web scraping a web page with python. But I have a problem with the outputs. This is the code: ...
0
votes
0answers
10 views

How can I compute the feature's score by using entropy based feature selection with python? [closed]

I have a dataset that contains n features scaled between [0,1]. I would use an unsupervised feature selection algorithm (entropy-based) by attributing a score for each feature. How can I do this with ...
1
vote
1answer
21 views

PyTorch: LSTM for time-series failing to learn

I'm currently working on building an LSTM network to forecast time-series data using PyTorch. I tried to share all the code pieces that I thought would be helpful, but please feel free to let me know ...
0
votes
0answers
8 views

Search n-grams in a text against a list of n-grams

So, I need to perform word extraction from a python string by matching it against a list of tokens that can have bigrams as well as unigrams, but this can go to higher order n-grams. Expected size of ...
0
votes
2answers
59 views

Xgboost : A variable specific Feature importance

I have a data set something like this: ...
0
votes
0answers
24 views

Implementing Gaussian Mixture Model from scratch on an Image dataset

I recently learned about GMM. From what I understand it basically gives a probability that a given data point belongs to a specific cluster. I need to implement GMM on the STL10 training dataset with ...
0
votes
1answer
16 views

How to use prediction model after onehot encoding?

I have created a prediction model for this dataset ...
1
vote
1answer
66 views

AttributeError: 'numpy.ndarray' object has no attribute 'nan_to_num'

I'm trying to run a Random Forest model from sklearn but I keep getting an error: ValueError: Input contains NaN, infinity or a value too large for dtype('float32')....

1
2 3 4 5
100