Questions tagged [python]

Use for data science questions related to the programming language Python. Not intended for general coding questions (which should be asked on Stack Overflow).

Filter by
Sorted by
Tagged with
0 votes
1 answer
36 views

What do special tokens used for in Roberta?

When I use this code: ...
0 votes
1 answer
6k views

Reading a json-file from an API, getting "AttributeError: 'Response' object has no attribute 'data' "error

Title says it all. Im trying to read a json file im accessing via an API. But when I try, I get the error: 'AttributeError: 'Response' object has no attribute 'data'...
0 votes
2 answers
83 views

How to handle this kind of timeseries

I am using Python and I have a sample dataset of this kind: ...
1 vote
1 answer
609 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 ...
0 votes
1 answer
18 views

Why is there a kmeans and kmeans_plusplus function in scikit-learn?

I want to use the kmeans method in the scikit-learn library and I was reading the documentation to see if there was a parameter to use kmeans++. It turns out that this is the default behavior. However,...
0 votes
0 answers
7 views

kernal failure on data science ICA algorithm for independent component analysis

ICA algorithm Problem Statement The goal is to have the ICA algorithm for independent component analysis custom python code perform convergence on many independent audio wave files, e.g., 10, 15, 20, ...
0 votes
1 answer
27 views

Customer Lifetime expectancy

I'm trying to compute Customer Lifetime Expectancy based on a table of subscriptions, that have 3 columns : user_id, user_subscription_start, user_subscription_end ...
0 votes
1 answer
219 views

Why does keras.Model subclass behave differently to the sequential API?

I have implemented WGAN based on this blog. I tried to implement define_critic() as a subclass of keras.Model with the goal of having the same result. ...
0 votes
0 answers
27 views

Quantifying heat map data

I have heatmap data (the x and y axis take in angles as inputs, and the color of that particular spot on the grid represents the "divergence.") I am unsure on how to numerically describe my ...
0 votes
1 answer
2k views

ValueError: bad input shape (111, 3)

...
0 votes
1 answer
261 views

RAM crashed for XML to DataFrame conversion function

I have created the following function which converts an XML File to a DataFrame. This function works good for files smaller than 1 GB, for anything greater than that the RAM(13GB Google Colab RAM) ...
0 votes
1 answer
64 views

Different accuracy scores with sklearn roc_auc_score on same model using sklearn.metrics

Why do these below lines give different outputs while the input is the same? I need to report these results in paper, but I am unsure which is better and why. ...
12 votes
4 answers
8k views

Prohibitive size of random forest when saved to disk

When saved to disk using cPickle: https://stackoverflow.com/questions/20662023/save-python-random-forest-model-to-file, my random forest is 6.57 GB. ...
1 vote
1 answer
71 views

Building a content-based recommendation system using products' metadata as features?

I am currently working on an apparel recommendation system, where I have tabulated data containing a list of products with their respective metadata (brand, category, color etc.) I have an additional ...
0 votes
1 answer
142 views

How do I print data after fitting data into a pipeline?

I was using 3 functions form scipy: TFIDF vectorizer, Multioutput classifier and Linear SVC. The code goes like this. ...
0 votes
1 answer
109 views

Incorporating data over time into lightgbm

So I'm in the situation where I know what it is I'm trying to find, but not the terminology for it and I think that's why a lot of my google searches are directing me in the wrong direction, so ...
0 votes
1 answer
62 views

confusing regarding to kmeans clulstering for data correlation

I am trying to think through my process before doing any real coding. However, got really confused easily. Say I have 100 instruments and I know their price movements every day for a year. So I can ...
1 vote
1 answer
664 views

Grouping/clustering similar words python

I have a question regarding grouping of similar words for example I have list of words give below: artificialintelligence Artificial Intelligence AI Machine Learning ML Data Analytics Data & ...
1 vote
2 answers
77 views

Predict average duration of a contract

I would like to predict the average duration of a contract. I have worked with different machine learning models before, especially from Scikit-learn, but this task seems to be somehow different for ...
0 votes
1 answer
322 views

How to write custom de-identification algorithm in Python?

I have tried a simple algorithm to anonymize my data using the de-identification technique. But the code doesn't work for me. I want to anonymize the data by slightly changing the values. The data ...
2 votes
1 answer
118 views

How to select good inputs and fitness function to achive good results with NEAT for Icy Tower bot

I'm trying to make a bot to the famous "Icy Tower" game. I rebuilt the game using pygame and I'm trying to build the bot using Python-NEAT. Every generation a population of 70 characters tries to ...
1 vote
0 answers
31 views

How do I know the appropriate number of iterations when using Miceforest for imputation?

I want to know how to avoid overfitting without having to increase the number of iterations excessively in Python with the Miceforest library. I know you can make a correlation map of data sets but I ...
0 votes
1 answer
35 views

How to optimize my CNN classification architecture

I have this CNN based model architecture that takes an RGB image. Now I'm trying to change it for a color classification case on an object (10 color classes: white, black, yellow, etc). This current ...
0 votes
0 answers
28 views

How to Determine the Minimum Value of a Continuous Variable for Predicting Categorical variable using Logistic Regression?

I am using logistic regression to predict df['MortSubiteCardiaque'], which contains 0 and 1, based on my continuous variable df['NTProBNP']. I would like to determine the threshold for df['NTProBNP'], ...
1 vote
1 answer
596 views

Why are my predictions broken when performing image segmentation with TensorFlow?

I am attempting semantic image segmentation with TensorFlow. Just to get something working, I am taking this one training image, training the network on that image for a little while, and then "...
0 votes
1 answer
47 views

Illegal action reward strategy for reinforcement learning : reward shaping and termination / truncation

I have some questions about strategy to adopt regarding illagal action handling in reinforcement learning (Stable Baselines 3 / SAC algo). First is about reward shaping, second is about terminating / ...
0 votes
1 answer
29 views

Why was the learning rate decreased for Roberta compared to LSTM?

I'm reading the codebase of a project that uses Bidirectional-LSTM. The learning rate for it is 0.02. Later, someone improved the project by replacing LSTM with Roberta and decreased the learning rate ...
1 vote
2 answers
995 views

What would be the best way to map similar ngrams

I'm trying to map similar ngrams using Wordnet and synsets. For example: elder brother and older sibling should map to the same ...
0 votes
1 answer
272 views

Best python library for training using Hidden Marov model with Gaussian Mixture

I would like to train my data using HMM- GMM (Baum Welch approach with gaussian Mixture) to find the best parameters suited for my data. Note : My data is ...
1 vote
1 answer
589 views

Using if statement as a model in orange

I am seeking to evaluate logistic regression against a rule-based (nested if-else statements) classification in Orange. The steps I've taken to investigate this are as follows: I could not identify ...
1 vote
2 answers
1k views

How to create a df that gets sum of columns based on a groupby column?

...
0 votes
0 answers
47 views

How to find adjacent neighbours using Python?

Full problem description at stackoverflow I need to find the adjacent neighbours (not necessarily nearest neighbours) to a given point in a multidimensional space. As shown in the screenshot below, I ...
0 votes
1 answer
314 views

Facebook Prophet add Regressor

I've been searching for a long time to answer my question, but I haven't found anything. So I hope you can help. I'm searching for an opportunity to add a regressor to my prophet model in python. I ...
0 votes
1 answer
6k views

bad input shape (5634, 2)

I tried everything and I am not sure how to resolve the following error: ValueError: bad input shape (5634, 2) This is my first machine learning example so please bear with me. This is the python ...
0 votes
1 answer
145 views

Mixed effect random forest model for Python Windows

Does anybody know if there is a Mixed effect random forest model for Python Windows? The merf package https://anaconda.org/search?q=merf+ seems to only be available on a linux environment? thanks!
1 vote
1 answer
1k views

Found input variables with inconsistent numbers of samples: [11232, 5616]

I don't know what is the reason for the error please guide me and help me out. I am at a learning stage.
1 vote
1 answer
65 views

Filling created feature with values

I'm trying to improve accuracy. I created a few new features based on old features. So I need to fill new feature's empty cell with same values in order to equaling shapes.Then, I tried it with median ...
0 votes
1 answer
198 views

Cross Validation with One Class Classification in Python

I'm trying to do cross-validation with One Class Classification - I'm using the PyOD lib - but I don't know if I'm doing it right. The precision is too low and I'm also not able to bring up the mean ...
0 votes
0 answers
9 views

sampling points on an interpolated curve

I have this interpolated curve (black) using black data points. I used scipy.interpolate.griddata to obtain the curve, I was wondering if there's a way to sample function values from this ...
1 vote
1 answer
460 views

What is the most straightforward way to run python code in a chrome extension?

I am currently trying to develop a chrome extension for a project. My knowledge of Javascript is quite limited and this is my first using it, so I am trying to reduce as much as possible its use. The ...
1 vote
1 answer
66 views

LogisticRegression Loading problem

Saving Model Part ...
2 votes
1 answer
177 views

What do these terms mean in the context of Roberta?

When I read articles about Roberta, I often read the terms "transfer learning" and "fine-tuning". Additionally, they also mention "feature extraction". What are the ...
6 votes
1 answer
20k views

'RandomForestClassifier' object has no attribute 'oob_score_ in python

I am getting: AttributeError: 'RandomForestClassifier' object has no attribute 'oob_score_'. But I can see the attribute ...
0 votes
0 answers
16 views

Are there any data processing documentation tools?

I was responsible of generating a table report to a commercial area of my job. It is currently being updated daily by DAG in airtomation that runs a python script. The problem is that now I have to ...
1 vote
1 answer
369 views

Beautifulsoup iterating through scraped data

I have this html code that is repeating multiple times: ...
1 vote
1 answer
1k views

Clustering for Sparse Data Matrix of high dimension

I currently have a dataset of 1000 entries with 512 features that are sparse. I want to cluster them. I have attempted using kmeans, but found that the clustering wasn't very good, and have been ...
0 votes
1 answer
30 views

What are the differences between Embedding Layer and Roberta Embedding?

I'm reading an article about the Embedding Layer: The Embedding Layer learns word embeddings from raw text. It is initialized with small random numbers and can be learned simultaneously with a neural ...
2 votes
1 answer
200 views

How can I reduce the number of dimensions using a Clustering algorithm in a mixed dataset?

I am working with a mixed data set, corresponding to TV consumption data, with the aim of reducing the number of features to only those relevant to detect TV consumption patterns (or consumption ...
0 votes
0 answers
21 views

sklearn Random Forest classifier vs R’s Random Forest classifier

I’m trying to implement the R’s random forest classifier equivalent in python- ...
1 vote
1 answer
67 views

Which pre-trained model to select to generate embeddings from shop names written in English?

Good afternoon! I have a dataset with thousands of shop names written in English. Several shop names might belong to one business entity, for instance, shops with names "KFC 001", "WWW....

1
2 3 4 5
134